EditionComponent3D
Summary
Component managing the user-guided edition of the 3D scene. Manages all interactions involving modifications of the scene's geometry. Necessary when the scene can be edited by the user.
For instance, in viewer mode, this component is inactive.
This component sends internal events when an object is manipulated, which can be listened to by the widgets for example.
To set/remove a callback for one of these events, use the functions on and off of this component (see Controls for the declaration).
Here is the list of all events you can set callbacks to, and the type of the argument provided to the callback :
- deselectObject (no argument)
- dispose (BABYLON.Mesh)
- refresh (BABYLON.Mesh)
- selectObject (BABYLON.Mesh)
- special (MouseEvent)
Constructor
EditionComponent3D
Syntax
EditionComponent3D
-
core
Summary
Parameters:
-
corewnp.CoreWanaplan Core.
Item Index
Methods
- addDraggable
- addHistory
- addUnremovableDraggable deprecated
- addWidget
- clickSelection
- constrains
- deselect
- disableWidget
- dragLock
- dragSelection
- EnableWidget
- getDragged
- getLastPosition
- getPointerCoordinates
- getReferentParent
- getReferentPlane
- getRoot
- getSelected
- getSelectedObject
- historyDelete
- historyRefresh
- isLocked
- isSelectableObject
- isSelectableOverture
- isSelectableStairway
- lock
- notify
- off
- on
- onAddToProducts
- onBeforeDragStart
- onClick
- onClickDerived
- onCloneObject
- onCloneObject
- onCreateObject
- onDispose
- onDispose
- onDoubleClick
- onDoubleClickDerived
- onDragEnd
- onDragging
- onDragStart
- onIAction
- onKeyDown
- onMouseDown
- onMouseDownDerived
- onMouseMove
- onMouseMoveDerived
- onMouseUpDerived
- onNewPlan
- onOverrideProduct
- onRefreshObject
- onRemoveObject
- onSelectObject
- onSelectObject
- pickMeshUnderCursor
- redoAdd
- redoDelete
- redoRefresh
- refreshObject
- refreshReferentPlane
- removeDraggable
- resetDraggable
- select
- selectObject
- selectTopLevelObject
- setDragged
- setReferentParent
- setRoot
- setScreenSize
- setSelectedObject
- setupHistory
- startListening
- stopListening
- undoAdd
- undoDelete
- undoRefresh
- unlock
Properties
Methods
addDraggable
Syntax
addDraggable
-
object
Summary
Adds an object to the list of handled objects.Parameters:
-
objectBABYLON.MeshThe object.
addHistory
Syntax
addHistory
-
target -
params -
type
Summary
Adds a history action.
addUnremovableDraggable
Syntax
addUnremovableDraggable
-
object
Summary
Adds an object to the list of handled objects, that can't be removed. Do not use thisParameters:
-
objectBABYLON.MeshThe object.
addWidget
Syntax
addWidget
-
widget
Summary
Adds a widget in the object edition component.
Parameters:
-
widgetWidgetThe widget to add.
clickSelection
Syntax
clickSelection
-
event
Summary
Implements the behaviour "click = selection of top-level object"Parameters:
-
eventMouseEventThe JS event
constrains
Syntax
constrains
-
[U] -
[V]
Summary
Sets the constrains for the dragging. 3 cases : * No param is specified, no constraint on the dragging, the object is dragged on a sphere around the camera. * Only the paramU is specified, the object is dragged along an axis, carried by the vector U.
* Both params are specified, the object is dragged along a plane, directed by U and V.
Parameters:
-
[U]BABYLON.Vector3 optionalFirst Vector. -
[V]BABYLON.Vector3 optionalSecond Vector.
deselect
Syntax
deselect
()
Summary
Deselects the object, even if no object has been selected.disableWidget
Syntax
disableWidget
()
Summary
Disables the widgets for an object.
dragLock
Syntax
dragLock
()
Summary
Locks the dragging capabilities.dragSelection
Syntax
dragSelection
-
event
Summary
Implements the behaviour "dragging of top-level object"Parameters:
-
eventMouseEventThe JS event
EnableWidget
Syntax
EnableWidget
()
Summary
Enables the widgets for an object.
getDragged
Syntax
getDragged
()
BABYLON.PickingInfo
Summary
Returns the dragged object as a picking information.Returns:
getLastPosition
Syntax
getLastPosition
()
Summary
Returns the last position of the dragged object.getPointerCoordinates
Syntax
getPointerCoordinates
-
event
Summary
Gets the correct values for the current pointer. Cross device.Parameters:
-
eventEventThe JS event
getReferentParent
Syntax
getReferentParent
()
BABYLON.Mesh
Summary
Returns the current referent parent, used to select or drag objects. SeeControls wiki for more info.
Returns:
getReferentPlane
Syntax
getReferentPlane
()
BABYLON.Plane
Summary
Returns the current referent plane, on which the mouse is projected when dragging.Returns:
getRoot
Syntax
getRoot
()
BABYLON.Mesh
Summary
Returns the current root, that is the top-level parent of all handled objects. NB : All objects that are not descendants of the root can't be handled byControls.
Returns:
getSelected
Syntax
getSelected
()
BABYLON.PickingInfo
Summary
Returns the selected object, as picking information.Returns:
getSelectedObject
Syntax
getSelectedObject
()
BABYLON.Mesh
Summary
Gets the currently selected object.
Returns:
The currently selected object.
historyDelete
Syntax
historyDelete
-
target -
params -
valueField
Summary
The function called when undoing/redoing a deletion.
historyRefresh
Syntax
historyRefresh
-
target -
params -
valueField
Summary
The function called when undoing/redoing a refresh.
isLocked
Syntax
Summary
Returns true if an object or group is locked. A group is locked if one of its children is locked.
Parameters:
-
objectBABYLON.MeshThe mesh to check
Returns:
true if the object is locked
isSelectableObject
Syntax
Summary
Checks if a mesh is selectable.
Parameters:
-
objectBABYLON.MeshThe mesh to check.
Returns:
Is a selectable mesh or not.
isSelectableOverture
Syntax
Summary
Checks if an overture is selectable.
Parameters:
-
objectBABYLON.MeshThe mesh to check.
Returns:
Is a selectable mesh or not.
isSelectableStairway
Syntax
Summary
Checks if a stairway is selectable.
Parameters:
-
objectBABYLON.MeshThe mesh to check.
Returns:
Is a selectable mesh or not.
lock
Syntax
lock
-
key -
[flags]
Summary
Disables some behaviors. Registers a key so that the action can only be re-enabled with the same key. Actions to lock must be passed in parameter as their corresponding flag. Supports multi-lock :
A lock the action ------------------------------------------------------------------- A unlock the action. --------------------- B lock the same action ----------------- B unlock the action -----------------------.
<-------------------------------action is locked -------------------------------------------------------->.
--------time--------->.
notify
Syntax
notify
-
event -
data
Summary
Calls every callback registered for a specific event.Parameters:
-
eventEventThe event. -
dataObjectThe data associated to this event.
off
Syntax
Summary
Removes a callback from a specific event.Parameters:
-
eventEventThe event. -
handlerFunctionThe callback function.
Returns:
onAddToProducts
Syntax
onAddToProducts
-
event
Summary
TODO
Parameters:
-
eventEventThe JS Event.
onBeforeDragStart
Syntax
onBeforeDragStart
()
Summary
Triggered on Controls event before-dragstart.
Tests if the object is locked before starting to drag.
onClick
Syntax
onClick
-
event
Summary
Triggered on eventwnp.engine3D.click.
Parameters:
-
eventEventThe JS event.
onClickDerived
Syntax
onClickDerived
-
pickingInfo
Summary
Triggered on event wnp.engine3D.click.collided.
Behavior : if ctrl is pressed, the object is added to the current group, if the right button is pressed,
the special event is sent to the widgets.
Parameters:
-
pickingInfoBABYLON.PickingInfoThe picking information on what is under the mouse.
onCloneObject
Syntax
onCloneObject
()
Summary
Triggered on event wnp.request.object.clone.
Called when the user clones an object or a group.
onCloneObject
Syntax
onCloneObject
-
object3D -
doNotAddHistory
Summary
Removes an object or a group.
Parameters:
-
object3DBABYLON.MeshThe object.
-
doNotAddHistoryBooleanAdd or not to the history.
onCreateObject
Syntax
onCreateObject
-
event
Summary
Triggered on event wnp.engine3D.object.create.
Called when a mesh is added to the scene.
Parameters:
-
eventEventThe JS event.
onDispose
Syntax
onDispose
-
event
Summary
Triggered on event wnp.engine3D.object.dispose.
Called when an object is removed from the scene.
Parameters:
-
eventEventThe JS event.
onDispose
Syntax
onDispose
-
event
Summary
Triggered on event wnp.engine3D.allFloorsReady.
Called when the floor id changes.
Parameters:
-
eventEventThe JS event.
onDoubleClick
Syntax
onDoubleClick
-
event
Summary
Triggered on eventwnp.engine3D.dblclick.collided.
Parameters:
-
eventEventThe JS event.
onDoubleClickDerived
Syntax
onDoubleClickDerived
-
pickingInfo
Summary
Triggered on event wnp.engine3D.dblclick.collided.
Behavior : triggers the function animate on the underlying mesh.
Parameters:
-
pickingInfoBABYLON.PickingInfoThe picking information on what is under the mouse.
onDragEnd
Syntax
onDragEnd
-
event
Summary
Triggered on eventwnp.engine3D.drag-end.
Parameters:
-
eventEventThe JS event.
onDragging
Syntax
onDragging
-
event
Summary
Triggered on eventwnp.engine3D.dragging.
Parameters:
-
eventEventThe JS event.
onDragStart
Syntax
onDragStart
-
event
Summary
Triggered on eventwnp.engine3D.drag-start.
Parameters:
-
eventEventThe JS event.
onIAction
Syntax
onIAction
()
private
Summary
Sends a different action for the configurator depending on the object's nature (Group or not).
onKeyDown
Syntax
onKeyDown
-
event
Summary
Triggered on event wnp.keyboardManager.keyDown.
Behavior : When the user uses ctrl-d (duplicates the object) and
the delete key (removes the object).
Parameters:
-
eventEventThe JS event.
onMouseDown
Syntax
onMouseDown
-
event
Summary
Triggered on eventwnp.engine3D.mousedown.
Parameters:
-
eventEventThe JS event.
onMouseDownDerived
Syntax
onMouseDownDerived
-
event
Summary
Triggered on Controls event mousedown.
Parameters:
-
eventEventThe Controls event.
onMouseMove
Syntax
onMouseMove
-
event
Summary
Triggered on eventwnp.engine3D.mouse-move.
Parameters:
-
eventEventThe JS event.
onMouseMoveDerived
Syntax
onMouseMoveDerived
-
event
Summary
Triggered on Controls event mousemove.
Parameters:
-
eventEventThe Controls event.
onMouseUpDerived
Syntax
onMouseUpDerived
-
event
Summary
Triggered on Controls event mouseup.
Parameters:
-
eventEventThe Controls event.
onNewPlan
Syntax
onNewPlan
-
event
Summary
Triggered on event wnp.request.newPlanReady.
Called when the user clicks on the new plan button.
Parameters:
-
eventObjectL'objet associé à l'événement.
onOverrideProduct
Syntax
onOverrideProduct
-
event
Summary
TODO
Parameters:
-
eventEventThe JS Event.
onRefreshObject
Syntax
onRefreshObject
-
event
Summary
Triggered on event wnp.engine3D.object.refresh.
Called when an object is refreshed
Parameters:
-
eventEventThe JS event.
onRemoveObject
Syntax
onRemoveObject
-
event
Summary
Triggered on event wnp.request.object.remove.
Removes an object.
Parameters:
-
eventEventThe JS event.
onSelectObject
Syntax
onSelectObject
-
object
Summary
Triggered on Controls event deselect.
Parameters:
-
objectBABYLON.MeshThe selected object.
onSelectObject
Syntax
onSelectObject
-
object
Summary
Triggered on Controls event select.
Parameters:
-
objectBABYLON.MeshThe selected object.
pickMeshUnderCursor
Syntax
pickMeshUnderCursor
-
event -
[ref]
Summary
Picks the mesh under the mouse pointer, and returns the top-level object as a pickingInfoParameters:
-
eventMouseEventThe JS event -
[ref]BABYLON.Mesh optionalOptional parameter to override the referent parent.
redoAdd
Syntax
redoAdd
-
target -
params
Summary
The redo function for the add action.
redoDelete
Syntax
redoDelete
-
target -
params
Summary
The redo function for the delete action.
redoRefresh
Syntax
redoRefresh
-
target -
params
Summary
The redo function for the refresh action.
refreshObject
Syntax
refreshObject
-
object3D -
options
Summary
Refreshes an object. Rebuilds the entire 3D object, given the programmable instance it is linked to.
Parameters:
-
object3DBABYLON.Meshthe mesh to refresh.
-
optionsObjectThe options : noHistory and modifiedProperties
refreshReferentPlane
Syntax
refreshReferentPlane
()
Summary
Refresh the referent dragging plane, taking the constraints into account.removeDraggable
Syntax
removeDraggable
-
object
Summary
Removes an object to the list of handled objects.Parameters:
-
objectBABYLON.MeshThe object.
resetDraggable
Syntax
resetDraggable
()
Summary
Empties the list of handled objects.select
Syntax
select
-
topLevelObjectPI
Summary
Selects an object, as a picking information.Parameters:
-
topLevelObjectPIBABYLON.PickingInfoThe new selected object, as a picking information.
selectObject
Syntax
selectObject
-
object
Summary
Selects an object. NB : A picking info is created, with a null distance and a null pickedPoint. NB 2 : The difference withsetSelectedObject is that a select event is fired.
Parameters:
-
objectBABYLON.MeshThe new selected object.
selectTopLevelObject
Syntax
selectTopLevelObject
-
object
Summary
Selects the top-level object, relative to the referent parent, for the given object. NB : A picking info is created, with a null distance and a null pickedPoint.Parameters:
-
objectBABYLON.MeshThe object from which we have to find the top-level object.
setDragged
Syntax
setDragged
-
dragged
Summary
Forces the dragged object without having to click on it. NB : Warning, the parameter is a picking info !Parameters:
-
draggedBABYLON.PickingInfoThe new dragged object.
setReferentParent
Syntax
setReferentParent
-
parent
Summary
Sets the current referent parent, used to select or drag objects. SeeControls wiki for more info.
Parameters:
-
parentBABYLON.MeshThe new referent parent.
setRoot
Syntax
setRoot
-
root
Summary
Sets the current root, that is the top-level parent of all handled objects. NB : All objects that are not descendants of the root can't be handled byControls.
NB 2 : The referent parent is also set to the new root, for consistency.
Parameters:
-
rootBABYLON.MeshThe new root.
setScreenSize
Syntax
setScreenSize
-
width -
height
Summary
Sets the canvas size.setSelectedObject
Syntax
setSelectedObject
-
object
Summary
Forces the selected object without having to click on it. NB : A picking info is created, with a null distance and a null pickedPoint. NB 2 : The difference withselectObject is that no select event is fired.
Parameters:
-
objectBABYLON.MeshThe new selected object.
setupHistory
Syntax
setupHistory
()
Summary
Setupps the history for the edition actions.
startListening
Syntax
startListening
()
Summary
Starts the listening ofEngine3D events.
stopListening
Syntax
stopListening
()
Summary
Stops the listening ofEngine3D events.
undoAdd
Syntax
undoAdd
-
target -
params
Summary
The undo function for the add action.
undoDelete
Syntax
undoDelete
-
target -
params
Summary
The undo function for the delete action.
undoRefresh
Syntax
undoRefresh
-
target -
params
Summary
The undo function for the refresh action.
Properties
cloneWidget
Syntax
cloneWidget
Widget.Clone
Summary
The clone widget: Allows the user to duplicate an object by clicking on the copy icon.
domElement
Syntax
domElement
HTMLCanvasElement
Summary
The canvas.elevationWidget
Syntax
elevationWidget
Widget.Info
Summary
The elevation widget: Creates a widget panel on the right side of the screen and allows to change the elevation of an object by dragging the cursor of the elevation bar.
groupWidget
Syntax
groupWidget
Widget.Group
Summary
The group widget: Allows the user to group/ungroup objects if several objects/a group are selected.
infoWidget
Syntax
infoWidget
Widget.Info
Summary
The info widget: Allows the user to have all the properties of an object by clicking on the info sprite.
listens
Syntax
listens
Boolean
Summary
Flag that indicates if the Controls are listening to the Engine3D eventslockWidget
Syntax
lockWidget
Widget.Lock
Summary
The lock widget: Allows the user to lock/unlock an object by clicking on the lock icon.
objects
Syntax
objects
BABYLON.Mesh
Summary
3D objects handled by the controls (selectable and draggable).removeWidget
Syntax
removeWidget
Widget.Remove
Summary
The remove widget: Allows the user to remove an object by clicking on the trash icon.
rotatorWidget
Syntax
rotatorWidget
Widget.Rotator
Summary
The rotator widget: Allows the user to turn an object with the green circle.
scene
Syntax
scene
BABYLON.Scene
Summary
The 3D scene.widget
Syntax
widget
Widget
Summary
The table of all widgets.
Events
wnp.editionComponent.removeObject
Syntax
wnp.editionComponent.removeObject
Summary
wnp.engine3D.object.clone
Syntax
wnp.engine3D.object.clone
Summary
Fired to clone an object
wnp.request.configurator.start
Syntax
wnp.request.configurator.start
Summary
Fired when the configurator is needed for an object.
wnp.request.disable-orbit-camera
Syntax
wnp.request.disable-orbit-camera
Summary
Fired to disable the orbit camera.wnp.request.enable-orbit-camera
Syntax
wnp.request.enable-orbit-camera
Summary
Fired to enable the orbit camera.wnp.request.groupConfigurator.start
Syntax
wnp.request.groupConfigurator.start
Summary
Fired when the configurator is needed for a group.
wnp.request.historyAction
Syntax
wnp.request.historyAction
Summary
Fired when the history is needed on an action.
Event Payload:
-
componentBaseComponent3DThe component of the action (here it is EditionComponent3D).
-
objectBABYLON.MeshThe target object.
-
paramsObjectParameters of the history.
-
actionStringThe type of action done.
wnp.request.object.remove
Syntax
wnp.request.object.remove
Summary
Fired when the delete button is pushed while a mesh is selected.
Event Payload:
-
objectBABYLON.MeshThe currently selected object.
-
structureFloorStructureThe current structure.
wnp.request.saveHistory
Syntax
wnp.request.saveHistory
Summary
Fired to request a save of the history.