Constructs a new MapControls
object.
MapView this controller modifies.
If true
, an event with MapView is registered to dispose of
MapControls
if MapView itself is disposed.
Three.js camera that this controller affects.
Map's HTML DOM element.
Double click uses the OS delay through the double click event. Tapping is implemented locally
here in MapControls
with this duration setting the maximum delay to define a double tap.
The value is in seconds. 300ms
is picked as the default value as jQuery does.
Set to true
to enable input handling through this map control, false
to disable input
handling. Even when disabling input handling, you can manually use the public functions to
change the view to the current map.
Set to true
to enable an inertia dampening on zooming and panning. false
cancels inertia.
MapView this controller modifies.
Determines the maximum zoom level we can zoom to.
Determines the minimum camera height in meter.
Determines the minimum zoom level we can zoom to.
Duration of the animation to reset the camera to looking north, in seconds. Independent of inertia.
This factor will be applied to the delta of the current mouse pointer position and the last
mouse pointer position: The result then will be used as an offset to orbit the camera.
Default value is 0.1
.
This factor will be applied to the delta of the current touch pointer position and the last
touch pointer position: The result then will be used as an offset to orbit the camera.
Default value is 0.1
.
Set to true
to enable panning through these controls, false
otherwise.
Inertia damping duration for the panning, in seconds.
Set to true
to enable rotation through this map control, false
to disable rotation.
This factor will be applied to the delta of the current mouse pointer position and the last
mouse pointer position: The result then will be used as an offset for the rotation then.
Default value is 0.1
.
Camera tilt to the target when tilting from the toggleTilt
public method.
Set to true
to enable tilting through these controls, false
otherwise.
Duration in seconds of the camera animation when the tilt button is clicked. Independent of inertia.
Set to true
to enable zooming through these controls, false
otherwise.
Inertia damping duration for the zoom, in seconds.
Zoom level delta when using the UI controls.
Zoom level delta to apply when double clicking or double tapping. 0
disables the feature.
Current viewing angles yaw/pitch/roll in degrees.
Get the current camera height.
Set the camera height.
Retrieve the registered event types.
Array of event types.
Get the camera max tilt angle in degrees.
Set camera max tilt angle. The value is clamped between 0 and 89 degrees. In sphere projection, at runtime, the value is also clamped so that the camera does not look above the horizon.
Angle in degrees.
Handy getter to know if the view is in the process of looking down or not.
Determines the zoom level delta for single mouse wheel movement. So after each mouse wheel movement the current zoom level will be added or subtracted by this value.
The default values are:
0.2
when inertiaEnabled
is false
- this means that every 5th mouse wheel movement
you will cross a zoom level.0.8
, otherwise.Set the zoom level delta for a single mouse wheel movement.
Note: To reverse the zoom direction, you can provide a negative value.
Get the zoom level targeted by MapControls
. Useful when inertia is on, to add incremented
values to the target instead of getting the random zoomLevel value during the interpolation.
Add a new event listener to the event type.
The type of event to listen to.
The function that gets called when the event is fired.
Dispatch the event to the registered listeners.
The event to dispatch.
Destroy this MapControls
instance.
Unregisters all global event handlers used. This is method should be called when you stop
using MapControls
.
Checks if listener is added to an event type.
The type of event to listen to.
The function that gets called when the event is fired.
Retrieve the registered listeners to the specified event.
The type of event to listen to.
Array of event listeners.
Reset the camera to looking north, in an orbiting movement around the target point instead of changing the yaw (which would be the camera rotating on itself).
Remove all event listeners for housekeeping.
Remove the listener from the event type.
The type of event to listen to.
The function that gets called when the event is fired. If the value is
undefined
, all listeners will be removed.
Zooms to the desired location by the provided value.
Zoom level.
Zoom target on screen.
Toggles the camera tilt between 0 (looking down) and the value at this.tiltAngle
.
Zooms and moves the map in such a way that the given target position remains at the same position after the zoom.
Target x position in NDC space.
Target y position in NDC space.
Creates MapControls object and attaches it specified MapView.
MapView object to which MapControls should be attached to.
If true
, an event with MapView is registered to dispose of
MapControls
if MapView itself is disposed.
Generated using TypeDoc
This map control provides basic map-related building blocks to interact with the map. It also provides a default way of handling user input. Currently we support basic mouse interaction and touch input interaction.
Mouse interaction:
Touch interaction: