Drawable Class
A Drawable is the base class for any graphical representation of
a GeoObject.
Drawable is a superclass for other classes and must not be directly
instantiated by the developer.
Rotations can be applied to Drawables. The local coordinate system of a Drawable is defined as a righthanded coordinate system, following the definitions below:
- The origin of the coordinate system is in the location of the Object the Drawable is attached to.
- The x axis is pointing right
- The y axis is pointing up
- The z axis is pointing out of the screen.
Rotations are defined and applied in roll-tilt-heading definition (in this order), using static axis.
A drawable can be mirrored when using the front cam, by setting the mirrored flag. By default all drawables are mirrored except labels and HTMLDrawables, but the setting can be overridden.
Item Index
Methods
Properties
- destroyed
- enabled
- heading deprecated
- mirrored
- roll deprecated
- rotate.heading
- rotate.roll
- rotate.tilt
- tilt deprecated
Events
- onClick
- triggers.onClick deprecated
Methods
destroy
()
Destroys the object.
Properties
enabled
Boolean
Flag to enable/disable the Drawable. If the Drawable is disabled, it will never appear on the screen and triggers on this Drawable will never be fired. In case it is enabled, it can be rendered on the screen and fire triggers.
Default: true
mirrored
Boolean
Flag to enable/disable mirroring for this Drawable. When using the front camera, a mirrored drawable will be rotated 180 degree around its y axis.
Default: true for generic drawables, false for labels and HTMLDrawables
rotate.heading
Number
Defines a rotation of the Drawable around the y-axis, specified in degrees. Values will be applied modulo 360. A value of 361 degrees has the same effect as setting the value to 1 degree.
Default: 0
rotate.roll
Number
Defines a rotation of the Drawable around the z-axis, specified in degrees. Values will be applied modulo 360. A value of 361 degrees has the same effect as setting the value to 1 degree.
Default: 0
rotate.tilt
Number
Defines a rotation of the Drawable around the x-axis, specified in degrees. Values will be applied modulo 360. A value of 361 degrees has the same effect as setting the value to 1 degree.
Default: 0
Events
onClick
When the Drawable is clicked, the system will trigger Drawable.onClick(ARObject). A click on the screen might hit multiple Drawables, thus a click creates a "clicked Drawables-queue", with the uppermost Drawable in the front of the queue. The return value of the function determines if, after the onClick()-Function was executed for this Drawable, the queue shall continue to execute onClick() for the next Drawable in the queue. In case the last Drawable in the queue still requests to continue the click-queue, ARObject.onClick() will be executed. If the queue still continues, context.onScreenClick() will be executed.
The return value of the function determines what happens next. If false, the click-queue should not stop with this Drawable. Thus, the next Drawable's onClick() function will be executed. This is the default value in case no return value is set or the function is not defined for this Drawable. If true, the queue-execution will stop at the current Drawable, underlying Drawables will not receive onClick() calls.
Event Payload:
-
arObject
ARObjectthe ARObject the clicked Drawable is attached to.
The trigger is null by default, and will thus result in no action executed when the trigger fires. A developer can add custom functionality by assigning a custom function to onClick.