DGM_ZoomComponent Class
This component is used to zoom or dezoom the 2D canvas with a double tap on the screen. Double tap on the left of the screen for a dezoom and on the right of the screen for a zoom. The zoom factor can be modified. It's possible to use this feature with a the double click mouse event.
Constructor
DGM_ZoomComponent
(
-
core
Parameters:
-
core
CoreThe main engine.
Item Index
Methods
Methods
_onDoubleTap
(
private
-
event
Called on a double tap/dougle click event. It increases or decreases the zoom.
Parameters:
-
event
ObjectThe event.
destroy
()
Method called when the component is destroyed
disable
()
Disables the component
enable
()
Enables the component
getTargeted
(
Object
-
vector
Finds out if the given position is over an element handled by the component
Parameters:
-
vector
VectorA position, usually the cursor's one.
Returns:
Object:
The targeted element, or null if nothing is found.
initialize
()
Initializes the component.
onContextChanged
(
-
context
Method called when the context is switched (2D -> 3D or 3D -> 2D)
Parameters:
-
context
StringThe new context
setMouseEnabled
(
-
enabled
Enabled or disable the mouse support.
Parameters:
-
enabled
BooleanSet to
true
to enable the mouse support, otherwise set it tofalse
.
setZoomFactor
(
-
zoomFactor
Sets the zoom factor.
Parameters:
-
zoomFactor
NumberThe desired zoom factor.
startListening
()
Starts the event listeners.
stopListening
()
Stop the event listeners.
update
()
Generic update method, called on every frame