dojox/gfx/Mover.js

  • Provides:

    • dojox.gfx.Mover
  • dojox.gfx.Mover

    • type
      Function
    • parameters:
      • shape: (typeof dojox.gfx.Shape)
        a shape object to be moved
      • e: (typeof Event)
        a mouse event, which started the move;
        only clientX and clientY properties are used
      • host: (typeof Object)
        object which implements the functionality of the move,
        and defines proper events (onMoveStart and onMoveStop)
    • source: [view]
        this.shape = shape;
        this.lastX = e.clientX
        this.lastY = e.clientY;
        var h = this.host = host, d = document,
         firstEvent = dojo.connect(d, "onmousemove", this, "onFirstMove");
        this.events = [
         dojo.connect(d, "onmousemove", this, "onMouseMove"),
         dojo.connect(d, "onmouseup", this, "destroy"),
         // cancel text selection and text dragging
         dojo.connect(d, "ondragstart", dojo, "stopEvent"),
         dojo.connect(d, "onselectstart", dojo, "stopEvent"),
         firstEvent
        ];
        // notify that the move has started
        if(h && h.onMoveStart){
         h.onMoveStart(this);
        }
    • summary
      an object, which makes a shape follow the mouse,
      used as a default mover, and as a base class for custom movers
  • dojox.gfx.Mover.onMouseMove

    • type
      Function
    • parameters:
      • e: (typeof Event)
        mouse event
    • source: [view]
        var x = e.clientX;
        var y = e.clientY;
        this.host.onMove(this, {dx: x - this.lastX, dy: y - this.lastY});
        this.lastX = x;
        this.lastY = y;
        dojo.stopEvent(e);
    • summary
      event processor for onmousemove
  • dojox.gfx.Mover.onFirstMove

    • type
      Function
    • source: [view]
        this.host.onFirstMove(this);
        dojo.disconnect(this.events.pop());
    • summary
      it is meant to be called only once
  • dojox.gfx.Mover.destroy

    • type
      Function
    • source: [view]
        dojo.forEach(this.events, dojo.disconnect);
        // undo global settings
        var h = this.host;
        if(h && h.onMoveStop){
         h.onMoveStop(this);
        }
        // destroy objects
        this.events = this.shape = null;
    • summary
      stops the move, deletes all references, so the object can be garbage-collected
  • dojox.gfx.Mover.lastX

    • summary
  • dojox.gfx.Mover.lastY

    • summary
  • dojox.gfx.Mover.events

    • summary
  • dojox.gfx.Mover.shape

    • type
      dojox.gfx.Shape
    • summary
      a shape object to be moved
  • dojox.gfx.Mover.host

    • type
      Object?
    • summary
      object which implements the functionality of the move,
      and defines proper events (onMoveStart and onMoveStop)
  • dojox.gfx

    • type
      Object
    • summary
  • dojox

    • type
      Object
    • summary