CameraZoomOperator

class wv.Operators.Camera.CameraZoomOperator()

Base class for operators that handle mouse and touch input. It provides common functionality for tracking mouse and touch events, as well as button and key modifier mappings. It is a Base class with No-OP hook methods (non virtual interface), meaning that it provides a default implementation for all methods, but can be extended by child classes to override specific behavior.

Methods

wv.Operators.Camera.CameraZoomOperator.addMapping()

inherited

addMapping(button: Button, modifier: KeyModifiers?): void

Adds a button and key modifier mapping for the operator. If no mapping is provided, all combinations are considered valid. All mappings require a mouse button, but a key modifier is optional.

Parameters

button: Button

modifier: KeyModifiers = KeyModifiers.None

Returns: void

wv.Operators.Camera.CameraZoomOperator.checkMapping()

inherited

checkMapping(event: MouseInputEvent): boolean

Checks if the given mouse event matches any of the button and key modifier mappings for the operator. If no mappings are defined, it returns true.

Parameters

event: MouseInputEvent

The mouse event to check against the operator’s mappings.

Returns: boolean

True if the event matches any mapping or if no mappings are defined, false otherwise.
wv.Operators.Camera.CameraZoomOperator.clearMapping()

inherited

clearMapping(): void

Clears any button and key modifier mappings for the operator.

Returns: void

wv.Operators.Camera.CameraZoomOperator.getDollyZoomEnabled()
getDollyZoomEnabled(): boolean

Returns true if dolly zoom is enabled.

Returns: boolean

wv.Operators.Camera.CameraZoomOperator.getMouseMoveZoomDelta()
getMouseMoveZoomDelta(): number

Gets the mouse move zoom delta

Returns: number

number
wv.Operators.Camera.CameraZoomOperator.getMouseMoveZoomInverted()
getMouseMoveZoomInverted(): boolean

Returns: boolean

wv.Operators.Camera.CameraZoomOperator.getMouseWheelAdjustCameraTarget()
getMouseWheelAdjustCameraTarget(): boolean

Returns whether the camera target will be updated to the selection position while zooming. See [[setMouseWheelAdjustCameraTarget]].

Returns: boolean

wv.Operators.Camera.CameraZoomOperator.getMouseWheelZoomDelta()
getMouseWheelZoomDelta(): number

Gets the scrollwheel zoom delta

Returns: number

number
wv.Operators.Camera.CameraZoomOperator.getMouseWheelZoomInverted()
getMouseWheelZoomInverted(): boolean

Returns: boolean

wv.Operators.Camera.CameraZoomOperator.getPreserveViewAngle()
getPreserveViewAngle(): boolean

Gets whether to maintain a constant view angle while zooming. See [[setPreserveViewAngle]].

Returns: boolean

wv.Operators.Camera.CameraZoomOperator.getZoomToMousePosition()
getZoomToMousePosition(): boolean

Returns: boolean

boolean When true, the zoom will be towards the mouse position. When false, the zoom will be towards the center of the screen.
wv.Operators.Camera.CameraZoomOperator.isActive()

inherited

isActive(): boolean

Checks if the operator is currently active, which is determined by whether the button and key modifier mapping is active or a touch event is active, and that a double click has not occurred and the context menu is not open.

Returns: boolean

True if the operator is active, false otherwise.
wv.Operators.Camera.CameraZoomOperator.isDragging()

inherited

isDragging(): boolean

Checks if the operator is currently dragging.

Returns: boolean

True if the operator is dragging, false otherwise.
wv.Operators.Camera.CameraZoomOperator.onDoubleClick()

inherited

onDoubleClick(_event: MouseInputEvent): void

NO-OP method for handling double click events. By default, it does nothing, but child classes can override this method to provide specific behavior for double click events.

Parameters

_event: MouseInputEvent

The double click event to handle.

Returns: void

wv.Operators.Camera.CameraZoomOperator.onMouseDown()

inherited

onMouseDown(event: MouseInputEvent): void

Base method for handling mouse down events. It tracks the time between mouse down events to determine if a double click has occurred, and checks the button and key modifier mapping to determine if the operator should be activated. If the operator is activated, it stores the initial mouse position and sets the dragging state to true.

Parameters

event: MouseInputEvent

The mouse down event to handle.

Returns: void

wv.Operators.Camera.CameraZoomOperator.onMouseUp()

inherited

onMouseUp(_event: MouseInputEvent): void

Base method for handling mouse up events. It stops the interaction if the operator is active, and resets the dragging state and drag count.

Parameters

_event: MouseInputEvent

The mouse up event to handle.

Returns: void

wv.Operators.Camera.CameraZoomOperator.setDollyZoomEnabled()
setDollyZoomEnabled(dollyZoomEnabled: boolean): void

When dolly zoom is enabled, the camera position will move towards the camera target when zooming.

Parameters

dollyZoomEnabled: boolean

Sets the dolly zoom status to enabled.

Returns: void

wv.Operators.Camera.CameraZoomOperator.setHandled()

inherited

setHandled(): boolean

Base method for setting the handled state of events. By default, it returns false, but child classes can override this method to provide specific behavior for determining whether events should be marked as handled.

Returns: boolean

True if the event should be marked as handled, false otherwise.
wv.Operators.Camera.CameraZoomOperator.setMapping()

inherited

setMapping(button: Button, modifier: KeyModifiers?): void

Sets the button and key modifier mapping for the operator.

Parameters

button: Button

modifier: KeyModifiers = KeyModifiers.None

Returns: void

wv.Operators.Camera.CameraZoomOperator.setMouseMoveZoomDelta()
setMouseMoveZoomDelta(delta: number): void

Sets the delta to zoom when moving the mouse

Parameters

delta: number

Returns: void

wv.Operators.Camera.CameraZoomOperator.setMouseMoveZoomInverted()
setMouseMoveZoomInverted(inverted: boolean): void

When true, moving the mouse up will zoom towards the model.

Parameters

inverted: boolean

Returns: void

wv.Operators.Camera.CameraZoomOperator.setMouseWheelAdjustCameraTarget()
setMouseWheelAdjustCameraTarget(value: boolean): void

When enabled, the camera target will be updated to the selection position while zooming. This can provide a better zoom behavior in perspective projection mode, but comes at the cost of performing a selection on the model during each mouse scroll, which may not be ideal for performance on large models.

This setting is disabled by default.

Parameters

value: boolean

Returns: void

wv.Operators.Camera.CameraZoomOperator.setMouseWheelZoomDelta()
setMouseWheelZoomDelta(delta: number): void

Sets the delta to zoom when scrolling

Parameters

delta: number

Returns: void

wv.Operators.Camera.CameraZoomOperator.setMouseWheelZoomInverted()
setMouseWheelZoomInverted(inverted: boolean): void

When true, scrolling up will zoom towards the model.

Parameters

inverted: boolean

Returns: void

wv.Operators.Camera.CameraZoomOperator.setPreserveViewAngle()
setPreserveViewAngle(value: boolean): void

Sets whether to maintain a constant view angle while zooming. If enabled, when zooming causes the camera’s field of view to shrink or grow, the camera’s position will also be moved toward or away from the target, respectively.

This may prevent confusing camera behavior when perspective projection is used or might be used. When using only orthographic projection, it is better to disable this.

If mouse wheel zoom is being using in conjunction with window zoom this setting should be the same in both.

This setting is enabled by default.

Parameters

value: boolean

Returns: void

wv.Operators.Camera.CameraZoomOperator.setZoomToMousePosition()
setZoomToMousePosition(zoom: boolean): void

When set, the zoom will be towards the mouse position. When not set, the zoom will be from the center of the screen.

Parameters

zoom: boolean

Returns: void

wv.Operators.Camera.CameraZoomOperator.stopInteraction()

inherited

Stops an operator from interacting with the scene.

stopInteraction(): void

Stops the current interaction by triggering the “endInteraction” event on the viewer, and resets the dragging state, drag count, and button modifier active state.

Returns: void