HandleOperator
-
class
wv.Operators.HandleOperator() Handles are added scene elements that can update the position of your parts through user interaction. Find more information here.
Index
Constructors
Methods
addAxisRotationHandleaddAxisTranslationHandleaddHandlesaddMappingaddPlaneTranslationHandleaddTrackedPointaddViewPlaneTranslationHandlecheckMappingclearMappingclearTrackedPointsgenerateGroupIdgetNodeIdsgetPositiongetTrackedPointsgetTranslationisActiveisDraggingisEnabledonDeactivateonDoubleClickonTouchEndonTouchMoveonTouchStartremoveHandlessetAxisMeshDatasetHandleSizesetMappingsetNodeIdssetPlaneMeshDatasetRotateMeshDatasetViewPlaneMeshDatashowHandlesstopInteractionupdatePosition
Constructors
-
wv.Operators.HandleOperator.constructor() Parameters
viewer:
IWebViewerview:
IViewReturns:
HandleOperator
Methods
-
wv.Operators.HandleOperator.addAxisRotationHandle() Adds a handle that rotates around an axis
Parameters
position:
Point3center of the handle.axis:
Point3axis to rotate aroundcolor:
Colorcolor of the handle geometrypositionNormal: (None |
Point3) = nulloptional vector to control the orientation of the handle geometry.groupId: (None | number) = null
optional parameter to associate this handle with a group of NodeIdsReturns: Promise
-
wv.Operators.HandleOperator.addAxisTranslationHandle() Adds a handle that moves along an axis.
Parameters
position:
Point3center of the handle.axis:
Point3axis to move alongcolor:
Colorcolor of the handle geometrypositionNormal: (None |
Point3) = nulloptional vector to control the orientation of the handle geometry.groupId: (None | number) = null
optional parameter to associate this handle with a group of NodeIdsReturns: Promise
-
wv.Operators.HandleOperator.addHandles() - addHandles(nodeIds: number[], position: (None |
Point3)?, groupId: (None | number)?): PromiseAdds all handles into the scene, oriented along the primary axes
Parameters
nodeIds: number[]
corresponding to the parts that will move with the handlesposition: (None |
Point3) = nullworld space coordinates the the handle positiongroupId: (None | number) = null
Returns: Promise
-
wv.Operators.HandleOperator.addMapping() inherited
addMapping(button:Button, modifier:KeyModifiers?): voidAdds 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:
Buttonmodifier:
KeyModifiers= KeyModifiers.NoneReturns: void
-
wv.Operators.HandleOperator.addPlaneTranslationHandle() Adds a handle that restricts movement to a plane.
Parameters
position:
Point3center of the handle.normal:
Point3normal of the planefaceColor:
Colorface color of the handle geometrylineColor:
Coloroutline color of the handle geometrypositionNormal: (None |
Point3) = nulloptional vector to control the orientation of the handle geometry.groupId: (None | number) = null
optional parameter to associate this handle with a group of NodeIdsReturns: Promise
-
wv.Operators.HandleOperator.addTrackedPoint() - addTrackedPoint(point:
Point3): numberAdd a point to the tracked points list. When the handle moves, these points will update in world space.
Parameters
point:Point3Returns: number
point index
-
wv.Operators.HandleOperator.addViewPlaneTranslationHandle() -
Adds a handle that restricts movement to the viewplane.
Parameters
Returns: Promise
-
wv.Operators.HandleOperator.checkMapping() inherited
checkMapping(event:MouseInputEvent): booleanChecks 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:
MouseInputEventThe 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.HandleOperator.clearMapping() inherited
clearMapping(): voidClears any button and key modifier mappings for the operator.
Returns: void
-
wv.Operators.HandleOperator.clearTrackedPoints() - clearTrackedPoints(): void
Clear the list of tracked points.
Returns: void
-
wv.Operators.HandleOperator.generateGroupId() - generateGroupId(): number
This will generate a unique id to associate a group of handles with a group of NodeIds.
Returns: number
-
wv.Operators.HandleOperator.getNodeIds() - getNodeIds(groupId: (None | number)?): number[]
Gets the NodeIds that the handles in the scene will move.
Parameters
groupId: (None | number) = null
optional parameter that specifies if the NodeIds to retrieve are part of a group.Returns: number[]
-
wv.Operators.HandleOperator.getPosition() - getPosition(): (None |
Point3)Returns: (None |
Point3)the current handle position or null if not currently active.
-
wv.Operators.HandleOperator.getTrackedPoints() - getTrackedPoints():
Point3[]Gets the tracked point list.
Returns:
Point3[]
-
wv.Operators.HandleOperator.getTranslation() - getTranslation():
Point3Returns:
Point3the total translation applied to the handles.
-
wv.Operators.HandleOperator.isActive() inherited
isActive(): booleanChecks 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.HandleOperator.isDragging() inherited
isDragging(): booleanChecks if the operator is currently dragging.
Returns: boolean
True if the operator is dragging, false otherwise.
-
wv.Operators.HandleOperator.isEnabled() - isEnabled(): boolean
Returns a boolean value indicating if handles are available to be added to the scene If there is an active explode, active measure, or the model is a 2d drawing. this will be false.
Returns: boolean
-
wv.Operators.HandleOperator.onDeactivate() inherited
onDeactivate(): (void | Promise)Called when the operator is deactivated. This method stops any ongoing interactions and resets the primary touch ID. It can be overridden by child classes to provide additional cleanup behavior when the operator is deactivated.
Returns: (void | Promise)
A promise that resolves when the deactivation process is complete, or void if no asynchronous operations are performed.
-
wv.Operators.HandleOperator.onDoubleClick() inherited
onDoubleClick(_event:MouseInputEvent): voidNO-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:
MouseInputEventThe double click event to handle.Returns: void
-
wv.Operators.HandleOperator.onTouchEnd() inherited
onTouchEnd(event:TouchInputEvent): voidBase method for handling touch end events. If the touch event corresponds to the primary touch point, it emulates a mouse up event using the touch position and resets the primary touch ID. It also sets the event as handled based on the operator’s setHandled method.
Parameters
event:
TouchInputEventThe touch end event to handle.Returns: void
-
wv.Operators.HandleOperator.onTouchMove() inherited
onTouchMove(event:TouchInputEvent): PromiseBase method for handling touch move events. If the touch event corresponds to the primary touch point, it emulates a mouse move event using the touch position. It awaits the onMouseMove method to allow for asynchronous behavior in child classes.
Parameters
event:
TouchInputEventThe touch move event to handle.Returns: Promise
-
wv.Operators.HandleOperator.onTouchStart() inherited
onTouchStart(event:TouchInputEvent): voidBase method for handling touch start events. It tracks the primary touch point and emulates a mouse down event using the touch position. If there is already an active touch, it ignores additional touch start events.
Parameters
event:
TouchInputEventThe touch start event to handle.Returns: void
-
wv.Operators.HandleOperator.removeHandles() - removeHandles(): Promise
Removes all handles from the scene.
Returns: Promise
-
wv.Operators.HandleOperator.setAxisMeshData() - setAxisMeshData(meshData:
MeshData): PromiseSets the mesh data for axis handles.
Parameters
meshData:MeshDataReturns: Promise
-
wv.Operators.HandleOperator.setHandleSize() - setHandleSize(size: number): void
Takes a scale value to change the handle size with 1 representing the default size
Parameters
size: numberReturns: void
-
wv.Operators.HandleOperator.setMapping() inherited
setMapping(button:Button, modifier:KeyModifiers?): voidSets the button and key modifier mapping for the operator.
Parameters
button:
Buttonmodifier:
KeyModifiers= KeyModifiers.NoneReturns: void
-
wv.Operators.HandleOperator.setNodeIds() - setNodeIds(nodeIds: number[], groupId: (None | number)?): void
Sets the NodeIds that any handles in the scene will move.
Parameters
nodeIds: number[]
groupId: (None | number) = null
optional parameter that associates a group of NodeIds with a group of handles.Returns: void
-
wv.Operators.HandleOperator.setPlaneMeshData() - setPlaneMeshData(meshData:
MeshData): PromiseSets the mesh data for plane handles.
Parameters
meshData:MeshDataReturns: Promise
-
wv.Operators.HandleOperator.setRotateMeshData() - setRotateMeshData(meshData:
MeshData): PromiseSets the mesh data for rotation handles.
Parameters
meshData:MeshDataReturns: Promise
-
wv.Operators.HandleOperator.setViewPlaneMeshData() - setViewPlaneMeshData(meshData:
MeshData): PromiseSets the mesh data for view plane handles.
Parameters
meshData:MeshDataReturns: Promise
-
wv.Operators.HandleOperator.showHandles() - showHandles(): void
Shows any handles that have been added to the scene.
Returns: void
-
wv.Operators.HandleOperator.stopInteraction() inherited
Stops an operator from interacting with the scene.
stopInteraction(): voidStops 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
-
wv.Operators.HandleOperator.updatePosition() Updates the current handle position.
Parameters
Returns: Promise