dojox/drawing/manager/Mouse (version 1.10)

Summary

Master object (instance) that tracks mouse events. A new instance is created for each Drawing object.

You could connect to any method or event in this class, but it is designed to have the object 'registered'. All objects with the current event will be called directly.

Custom events are used often. In addition to standard events onDown, onUp, onDrag, etc, if a certain object is clicked upon (or dragged, etc), that object's drawingType will create the custom event, such as onAnchorDown, or onStencilDown.

Usage

var foo = new Mouse(options);
dojox/drawing/manager/Mouse
Parameter Type Description
options Object

Property Summary

Method Summary

  • _broadcastEvent(strEvt,obj) Fire events to all registered objects.
  • _getId(evt,squelchErrors) Internal.
  • _getXY(evt) Internal.
  • create(evt,squelchErrors) Internal.
  • down(evt) Internal.
  • drag(evt) Internal.
  • eventName(name) Internal.
  • EventObject() The custom event object that is sent to registered objects and their respective methods.
  • init(node) Internal.
  • move(evt) Internal.
  • out(obj) Internal.
  • over(obj) Internal.
  • overName(obj,evt)
  • register(scope) All objects (Stencils) should register here if they use mouse events.
  • resize(width,height)
  • scrollOffset() Gets scroll offset of canvas
  • setCanvas() Internal.
  • setCursor(cursor,node) Sets the cursor for a given node.
  • setEventMode(mode) Sets the mouse mode s that custom events can be called.
  • setZoom(zoom) Internal.
  • unregister(handle) Disconnects object.
  • up(evt) Internal.

Event Summary

  • onDown(obj) Create on[xx]Down event and send to broadcaster.
  • onDrag(obj) Create on[xx]Drag event and send to broadcaster.
  • onMove(obj) Create onMove event and send to broadcaster.
  • onOut(obj)
  • onOver(obj)
  • onUp(obj) Create on[xx]Up event and send to broadcaster.

Properties

__reg
_downOnCanvas
_lastx
_lasty
CustomEventMethod

The custom event methods that an Object that has registered with manager.Mouse can receive. Can contain any or all of the following methods and they will be called on mouse events. All events will be sent a EventObject event object.

NOTE: Events happen anywhere in the document unless otherwise noted.

doublClickSpeed

Milliseconds between clicks to register as for onDoubleClick

zoom

Methods

_broadcastEvent(strEvt,obj)

Fire events to all registered objects.

Parameter Type Description
strEvt undefined
obj undefined
_getId(evt,squelchErrors)

Internal. Gets ID of focused node.

Parameter Type Description
evt undefined
squelchErrors undefined
Returns:undefined
_getXY(evt)

Internal. Gets mouse coords to page.

Parameter Type Description
evt undefined
Returns:object
create(evt,squelchErrors)

Internal. Create EventObject

Parameter Type Description
evt undefined
squelchErrors undefined
Returns:object
down(evt)

Internal. Create onDown event

Parameter Type Description
evt undefined
drag(evt)

Internal. Create onDrag event

Parameter Type Description
evt undefined
eventName(name)

Internal. Determine the event name

Parameter Type Description
name undefined
Returns:string | number
EventObject()

The custom event object that is sent to registered objects and their respective methods.

NOTE: Most event objects are the same with the exception of the onDown events, which have fewer.

init(node)

Internal. Initializes mouse.

Parameter Type Description
node HTMLNode
move(evt)

Internal.

Parameter Type Description
evt undefined
out(obj)

Internal.

Parameter Type Description
obj undefined
over(obj)

Internal.

Parameter Type Description
obj undefined
overName(obj,evt)
Parameter Type Description
obj undefined
evt undefined
Returns:string
register(scope)

All objects (Stencils) should register here if they use mouse events. When registering, the object will be called if it has that method. See: CustomEventMethod and EventObject

Parameter Type Description
scope CustomEventMethod

The object to be called

Returns:handle | string

Keep the handle to be used for disconnection.

resize(width,height)
Parameter Type Description
width undefined
height undefined
scrollOffset()

Gets scroll offset of canvas

Returns:object
setCanvas()

Internal. Sets canvas position

setCursor(cursor,node)

Sets the cursor for a given node. If no node is specified the containing node is used.

Parameter Type Description
cursor undefined
node HTMLNode
setEventMode(mode)

Sets the mouse mode s that custom events can be called. Also can 'disable' events by using a bogus mode:

mouse.setEventMode("DISABLED")

(unless any object subscribes to this event,

it is effectively disabled)

Parameter Type Description
mode undefined
setZoom(zoom)

Internal. Sets the mouse zoom percentage to that of the canvas

Parameter Type Description
zoom undefined
unregister(handle)

Disconnects object. Mouse events are no longer called for it.

Parameter Type Description
handle undefined
up(evt)

Internal. Create onUp event

Parameter Type Description
evt undefined

Events

onDown(obj)

Create on[xx]Down event and send to broadcaster. Could be connected to.

Parameter Type Description
obj undefined
onDrag(obj)

Create on[xx]Drag event and send to broadcaster. Could be connected to.

Parameter Type Description
obj undefined
onMove(obj)

Create onMove event and send to broadcaster. Could be connected to. Note: onMove never uses a custom event Note: onMove is currently not enabled in the app.

Parameter Type Description
obj undefined
onOut(obj)
Parameter Type Description
obj undefined
onOver(obj)
Parameter Type Description
obj undefined
onUp(obj)

Create on[xx]Up event and send to broadcaster. Could be connected to.

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