dojox/drawing/manager/Stencil (version 1.10)

Summary

The main class for tracking Stencils that are cretaed, added, selected, or deleted. Also handles selections, multiple selections, adding and removing from selections, and dragging selections. It's this class that triggers the anchors to appear on a Stencil and whther there are anchor on a multiple select or not (currently not)

Usage

var foo = new Stencil(options);
dojox/drawing/manager/Stencil
Parameter Type Description
options undefined

Property Summary

Method Summary

  • deleteItem(stencil) Deletes a stencil.
  • deselect()
  • deselectItem(stencil) Deselect passed stencil
  • exporter() Collects all Stencil data and returns an Array of objects.
  • getRecentStencil() Returns the stencil most recently interacted with whether it's last created or last selected
  • hasSelected() Returns number of selected (generally used as truthy or falsey)
  • isSelected(stencil) Returns if passed stencil is selected or not based on internal collection, not on stencil boolean
  • listStencils()
  • register(stencil) Key method for adding Stencils.
  • removeAll() Deletes all Stencils on the canvas.
  • saveMoveState() Internal.
  • saveThrottledState() Internal.
  • selectAll() Selects all items
  • selectItem(idOrItem) Method used to select a stencil.
  • setConstraint() Internal.
  • setRecentStencil(stencil) Keeps track of the most recent stencil interacted with, whether created or selected.
  • setSelectionGroup() Internal.
  • toSelected(func) Convenience function calls function within all selected stencils
  • unDelete(stencils) Undeletes a stencil.
  • unregister(stencil) Method for removing Stencils from the manager.
  • withSelected(func) Convenience function calls function on all selected stencils
  • withStencils(func) Convenience function calls function on all stencils
  • withUnselected(func) Convenience function calls function on all stencils that are not selected

Event Summary

  • onAnchorUp() Event fire on mouseup off of an anchor point
  • onArrow(evt) Moves selection based on keyboard arrow keys
  • onBeginDrag(obj) Event fired at the beginning of a stencil drag
  • onDelete(noundo) Event fired on deletion of a stencil
  • onDeselect(stencil,keepObject) Event fired on deselection of a stencil
  • onDown(obj) Event fired on mousedown on the canvas
  • onDragEnd(obj) Event fired at the end of a stencil drag
  • onLabelDoubleClick(obj) Event to connect a textbox to for label edits
  • onLabelDown(obj,evt) Event fired on mousedown of a stencil's label Because it's an annotation the id will be the master stencil.
  • onLabelDrag(obj)
  • onLabelUp(obj)
  • onSelect(stencil) Event fired on selection of a stencil
  • onStencilDoubleClick(obj) Event fired on the double-click of a stencil
  • onStencilDown(obj,evt) Event fired on mousedown on a stencil
  • onStencilDrag(obj) Event fired on every mousemove of a stencil drag
  • onStencilOut(obj) This restores the cursor.
  • onStencilOver(obj) This changes the cursor when hovering over a selectable stencil.
  • onStencilUp(obj) Event fired on mouseup off of a stencil

Properties

_dragBegun
_isBusy
_lastmxx
_lastmxy
_secondClick
_throttle
_throttleVrl
_wasDragged
throttleTime

Methods

deleteItem(stencil)

Deletes a stencil. NOTE: supports limited undo.

Parameter Type Description
stencil Object
deselect()
deselectItem(stencil)

Deselect passed stencil

Parameter Type Description
stencil Object
exporter()

Collects all Stencil data and returns an Array of objects.

Returns:Array
getRecentStencil()

Returns the stencil most recently interacted with whether it's last created or last selected

Returns:undefined
hasSelected()

Returns number of selected (generally used as truthy or falsey)

Returns:number
isSelected(stencil)

Returns if passed stencil is selected or not based on internal collection, not on stencil boolean

Parameter Type Description
stencil Object
Returns:boolean
listStencils()
Returns:undefined
register(stencil)

Key method for adding Stencils. Stencils can be added to the canvas without adding them to this, but they won't have selection or drag ability.

Parameter Type Description
stencil Object
Returns:boolean | Object
removeAll()

Deletes all Stencils on the canvas.

saveMoveState()

Internal. Used for the prototype undo stack. Saves selection position.

saveThrottledState()

Internal. Used for the prototype undo stack. Prevents an undo point on every mouse move. Only does a point when the mouse hesitates.

selectAll()

Selects all items

selectItem(idOrItem)

Method used to select a stencil.

Parameter Type Description
idOrItem String | Object
setConstraint()

Internal. Gets all selected stencils' coordinates and determines how far left and up the selection can go without going below zero

setRecentStencil(stencil)

Keeps track of the most recent stencil interacted with, whether created or selected.

Parameter Type Description
stencil undefined
setSelectionGroup()

Internal. Creates a new selection group used to hold selected stencils.

toSelected(func)

Convenience function calls function within all selected stencils

Parameter Type Description
func String
unDelete(stencils)

Undeletes a stencil. Used in undo stack.

Parameter Type Description
stencils Array
unregister(stencil)

Method for removing Stencils from the manager. This doesn't delete them, only removes them from the list.

Parameter Type Description
stencil Object
withSelected(func)

Convenience function calls function on all selected stencils

Parameter Type Description
func Function
withStencils(func)

Convenience function calls function on all stencils

Parameter Type Description
func Function
withUnselected(func)

Convenience function calls function on all stencils that are not selected

Parameter Type Description
func Function

Events

onAnchorUp()

Event fire on mouseup off of an anchor point

onArrow(evt)

Moves selection based on keyboard arrow keys

Parameter Type Description
evt Key Event
onBeginDrag(obj)

Event fired at the beginning of a stencil drag

Parameter Type Description
obj EventObject
onDelete(noundo)

Event fired on deletion of a stencil

Parameter Type Description
noundo Boolean
onDeselect(stencil,keepObject)

Event fired on deselection of a stencil

Parameter Type Description
stencil undefined
keepObject undefined
onDown(obj)

Event fired on mousedown on the canvas

Parameter Type Description
obj EventObject
onDragEnd(obj)

Event fired at the end of a stencil drag

Parameter Type Description
obj EventObject
onLabelDoubleClick(obj)

Event to connect a textbox to for label edits

Parameter Type Description
obj EventObject
onLabelDown(obj,evt)

Event fired on mousedown of a stencil's label Because it's an annotation the id will be the master stencil.

Parameter Type Description
obj EventObject
evt undefined
onLabelDrag(obj)
Parameter Type Description
obj EventObject
onLabelUp(obj)
Parameter Type Description
obj EventObject
onSelect(stencil)

Event fired on selection of a stencil

Parameter Type Description
stencil Object
onStencilDoubleClick(obj)

Event fired on the double-click of a stencil

Parameter Type Description
obj EventObject
onStencilDown(obj,evt)

Event fired on mousedown on a stencil

Parameter Type Description
obj EventObject
evt undefined
onStencilDrag(obj)

Event fired on every mousemove of a stencil drag

Parameter Type Description
obj EventObject
onStencilOut(obj)

This restores the cursor.

Parameter Type Description
obj undefined
onStencilOver(obj)

This changes the cursor when hovering over a selectable stencil.

Parameter Type Description
obj undefined
onStencilUp(obj)

Event fired on mouseup off of a stencil

Parameter Type Description
obj EventObject
Error in the documentation? Can’t find what you are looking for? Let us know!