new Add()
Creates a new edit mode handler.
Extends
Members
-
:boolean
isUserModeHandler <readonly>
-
A flag identifying this object as an edit mode handler.
Type
- boolean
- Inherited From:
- Overrides:
Methods
-
appendNewJunction(host, cursor [, displace])
-
Appends a new vertex to the current path contour.
If the optional
displaceparameter is true, or if automatic progression is disabled, the new junction will be displaced relative to the outgoing vector of the previous junction to highlight the addition of the new junction and allow the user to drag it to a new position.Parameters:
Name Type Argument Default Description hostPD.SelectionManager The selection manager.
cursorPD.Cursor The cursor that was dragged.
displaceboolean <optional>
false Whether or not to displace next junction, defaults to false.
-
cancel(host)
-
Cancels this edit mode.
Parameters:
Name Type Description hostPD.SelectionManager The selection manager.
- Inherited From:
- Overrides:
-
checkToCloseElement(element, contour)
-
Check whether the user joined the last point to the first.
If the user drags the last junction to be exactly coincident with the first, this is taken as an indication that they wish to close an open path. This method checks whether this is okay for the element being created and, if so, closes it.
Parameters:
Name Type Description elementBIM.Element The element being edited.
contourArray The contour being edited.
Returns:
Returns true if the ending vertex is coincident with the first.
- Type
- boolean
-
complete(host)
-
Completes any pending modal action(s) in this edit mode.
This method checks that there are sufficient junctions to form a valid path for the new element and, if so, creates it.
Parameters:
Name Type Description hostPD.SelectionManager The selection manager.
- Inherited From:
- Overrides:
Returns:
Returns true is a pending action was completed.
- Type
- boolean
-
cursorUpdateInfo(host, count)
-
Updates the cursor information string.
Parameters:
Name Type Description hostPD.SelectionManager The selection manager.
countnumber The vertex count to show.
-
displayDimensions(host, mesh)
-
Regenerates dimension lines for the current element being added.
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)
-
Called when the user clicks/taps in the canvas away from the 3D cursor.
The calling of this method signifies that the user has completed the interactive input of path segments and wishes the new element to be added to the model.
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 the new element was added to the model and a redraw is required, otherwise false.
- Type
- boolean
-
handleDragEnd(host, cursor, event)
-
Completes the move after a drag has finished.
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 newly inserted point as the cursor is dragged.
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 just prior to a drag event.
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 interactive pre-selection events.
This allows the user to click anywhere in the model to position and drag the very first junction in the path. After that, clicking away from the 3D model cursor completes the add element action.
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
-
hasEnoughJunctionsInPath(host, element)
-
Determines if there are enough junctions to create the element.
Parameters:
Name Type Description hostPD.SelectionManager The selection manager.
elementBIM.Element The element path top check.
Returns:
Returns true if there are enough junctions to create element.
- 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 the staged process of adding an element.
This method adds a new junction at the cursor position and checks to ensure that they are not coincident with previous junctions.
Parameters:
Name Type Argument Description hostPD.SelectionManager The selection manager.
stagenumber <optional>
An optional stage in the progress.
- Inherited From:
- Overrides:
-
setCursorPosition(host, pos [, event])
-
Manually sets the cursor position during an 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.
This method should undertake whatever action dragging the cursor would have at the current progress stage.
Parameters:
Name Type Argument Description hostPD.SelectionManager The selection manager.
posObject | Array The new position to move the cursor to.
eventEvent <optional>
The event that invoked this method.
- Inherited From:
- Overrides:
-
setDrawingSurface(element, junction, cursor)
-
Initialises surface drawing.
Parameters:
Name Type Description elementBIM.Element The element that owns the drawing surface.
junctionBIM.Junction The junction that defines the drawing surface.
cursorPD.Cursor The cursor to follow the drawing surface.
Returns:
Returns true drawing is restricted to element/junction surface.
- Type
- boolean
-
updateAfterUndoRedo(host)
-
Selects the last junction in the element path.
Parameters:
Name Type Description hostPD.SelectionManager The selection manager.