new Move()
Creates a new move selection mode handler.
Extends
Members
-
:boolean
actionApplied
-
Whether or not the action was applied to the selection.
Type
- boolean
-
:number
id
-
A unique id generated each time a new drag is initiated.
Type
- number
-
:boolean
isUserModeHandler <readonly>
-
A flag identifying this object as an edit mode handler.
Type
- boolean
- Inherited From:
- Overrides:
-
:Array.<THREE.Vector3>
refPoints
-
Stores the reference positions required for the action.
For a simple move, this is just the start point [0] and the drag point [1]. For a rotation, it is the center point [0], the reference direction [1] and the drag direction [2]. You can add any extra points your action needs within the subclass constructor.
Type
- Array.<THREE.Vector3>
-
:number
setupStages
-
The progress stage at which setup finishes and dragging begins.
Setup stages display a detached cursor and are used to set the reference positions prior to actual dragging. During these stages, the user can click anywhere in the canvas and the cursor will move to that spot, and snapping should include the selected element. After the setup stages, when the user is dragging the selected element around, it should be excluded from snap detection.
Type
- number
-
:boolean
stageMessages
-
Stores the messages for each progress stage.
The number of messages in this array also determines the maximum progress stage it wil get to.
Type
- boolean
-
:THREE.Vector3
vector
-
Stores a movement vector.
Type
- THREE.Vector3
Methods
-
applyActionOnDrag(host, cursor, event)
-
Apply the action to the selection set during cursor drag.
Parameters:
Name Type Description hostPD.SelectionManager The selection manager.
cursorPD.Cursor The cursor that moved.
eventobject The DOM event that triggered this move.
Returns:
Returns true if the action was applied, otherwise false.
- Type
- boolean
-
applyActionOnRelease(host, cursor, event)
-
Apply the action to the selection set during cursor drag.
Parameters:
Name Type Description hostPD.SelectionManager The selection manager.
cursorPD.Cursor The cursor that moved.
eventobject The DOM event that triggered this move.
Returns:
Returns true if the action was applied.
- Type
- boolean
-
cancel(host)
-
Cancels this edit mode.
This method is an opportunity for the action handler to back out and clean up when cancelled. The host will automatically remove any residual dimensions or snap indicators and will redraw the model, so you don't need to do anything like that here. You should also have already added and updated an undo entry during the drag action, so should be able to rely on that to undo any model changes.
Thus, use this method only to clean up anything extra that you may have added or modified during your custom action, and then reset to
PD.MODE.EDITmode and call undo.Parameters:
Name Type Description hostPD.SelectionManager The selection manager.
- Inherited From:
- Overrides:
-
checkToSnapValue(host, newPos, cursor, event)
-
Snaps the movement vector to grid values.
Parameters:
Name Type Description hostPD.SelectionManager The selection manager.
newPosTHREE.Vector3 The proposed new position of the cursor.
cursorPD.Cursor The cursor that moved.
eventobject The DOM event that triggered this move.
-
complete(host)
-
Completes any pending model action(s) and returns to model edit mode.
Most of the default edit modes update the selection and the model in real time during interaction, so all that is required here is to reset to the
PD.MODE.EDITmode.However, if your custom action only simulates an action using the hosts selection meshes, then this is your time to actually apply that action.
Parameters:
Name Type Description hostPD.SelectionManager The selection manager.
- Inherited From:
- Overrides:
Returns:
Returns true if the pending action was completed.
- Type
- boolean
-
displayDimensions(host, mesh)
-
Regenerates dimension lines for the current mode, if any.
Parameters:
Name Type Description hostPD.SelectionManager The selection manager.
meshPD.PolyMesh The mesh to add the dimension(s) to.
- Inherited From:
- Overrides:
Returns:
Returns true if something in the model was dimensioned and the mesh should be visible, otherwise false.
- Type
- boolean
-
handleClickSelect(host, raycaster, event)
-
Handles selection on pointer release events.
This method is called when the user has clicked/tapped and released the pointer within the canvas without dragging, but away from the 3D cursor. If this action is still in its setup stages, it progresses to the next stage, the cursor is moved to the clicked/tapped position, and the method returns true. If setup stages are over, the action is completed and the method returns false.
Parameters:
Name Type Description hostPD.SelectionManager The selection manager.
raycasterTHREE.Raycaster The ray cast into the current scene.
eventobject The DOM event that triggered this selection.
- Inherited From:
- Overrides:
Returns:
Returns true if something in the model was selected and geometry was added to the mesh, otherwise false.
- Type
- boolean
-
handleDragEnd(host, cursor, event)
-
Completes the action after a drag has finished.
This method is called when the user releases the pointer after having dragged the 3D cursor with the pointer down.
Parameters:
Name Type Description hostPD.SelectionManager The selection manager.
cursorPD.Cursor The cursor that just finished moving.
eventobject The DOM event that triggered the end of the move.
- Inherited From:
- Overrides:
Returns:
Returns true if the move was finalised.
- Type
- boolean
-
handleDragMove(host, newPos, cursor, event)
-
Moves the current reference point as the cursor is dragged.
This method is called multiple times as the user is dragging the cursor with the pointer down.
Parameters:
Name Type Description hostPD.SelectionManager The selection manager.
newPosTHREE.Vector3 The proposed new position of the cursor.
cursorPD.Cursor The cursor that moved.
eventobject The DOM event that triggered this move.
- Inherited From:
- Overrides:
Returns:
Returns true if the move was applied.
- Type
- boolean
-
handleDragStart(host, cursor, event)
-
Prepare the selection and model just prior to a drag event.
This method is called when the user has clicked/tapped the pointer on one of the active cursor manipulators and just begun to drag with the pointer down.
Parameters:
Name Type Description hostPD.SelectionManager The selection manager.
cursorPD.Cursor The cursor that is about to move.
eventobject The DOM event that triggered this move.
- Inherited From:
- Overrides:
Returns:
Returns true if the move is allowed.
- Type
- boolean
-
handlePreSelect(host, raycaster, event)
-
Handles pointer down events.
At this stage, the system doesn't yet know whether the user is selecting something or simply trying to rotate the view.
If the current progress is still within the setup stages, the cursor will be positioned to where the pointer was pressed on the cursor plane. After setup stages, it allows the user to rotate.
Parameters:
Name Type Description hostPD.SelectionManager The selection manager.
raycasterTHREE.Raycaster The ray cast into the current scene.
eventobject The DOM event that triggered this callback.
- Inherited From:
- Overrides:
Returns:
Returns true if something in the model was pre-selected and geometry was added to the mesh, otherwise false.
- Type
- boolean
-
initialise(host)
-
Called each time this edit mode is entered.
Parameters:
Name Type Description hostPD.SelectionManager The selection manager.
- Inherited From:
- Overrides:
-
progressToNextStage(host [, stage])
-
Increments through the stages of the interactive measurement process.
Parameters:
Name Type Argument Description hostPD.SelectionManager The selection manager.
stagenumber <optional>
An optional new stage in the progress, defaults to
host.userActionStage + 1.- Inherited From:
- Overrides:
-
setCursorPosition(host, pos, cursor [, event])
-
Manually sets the cursor position during a measure action.
This method is called when the user manually edits the cursor position using the keyboard or other numeric input within the UI, as opposed to dragging the cursor. It is not called when the cursor is moved interactively using the manipulators and a pointer.
Parameters:
Name Type Argument Description hostPD.SelectionManager The selection manager.
posObject | Array The new position to move the cursor to.
cursorPD.Cursor The cursor that is being moved.
eventEvent <optional>
The DOM event that invoked this method.
- Overrides: