Opened 12 years ago

Closed 11 years ago

#11775 closed defect (fixed)

dojo.dnd.move.constrainedMoveable.onMove doesn't call onMoving, onMoved as it should

Reported by: J Cameron Cooper Owned by: Eugene Lazutkin
Priority: high Milestone: 1.6
Component: DnD Version: 1.5
Keywords: Cc:
Blocked By: Blocking:


The behavior of 'dojo.dnd.Moveable.onMove' is to call a couple of other blank local event (hook) methods: 'onMoved' and 'onMoving', which promise to be called at specific points in 'onMove'.

The child class 'dojo.dnd.move.constrainedMoveable' overrides 'onMove' but doesn't do the "hook" calls like its parent, so 'onMoved' and 'onMoving' in this case never get called, breaking their contract.

The other classes in the file that descend from 'constrainedMoveable' would also have this problem: 'boxConstrainedMoveable', 'parentConstrainedMoveable'.

The 'TimedMoveable?' class also overrides 'onMove', but does call the parent version, so the hook event methods probably do get called.

Change History (3)

comment:1 Changed 12 years ago by J Cameron Cooper

It's also important, I think, that leftTop get the constrained values, so the method would look like this when patched:

    this.onMoving(mover, leftTop);
    var c = this.constraintBox, s =;
    leftTop.l = (leftTop.l < c.l ? c.l : c.r < leftTop.l ? c.r : leftTop.l);
    leftTop.t = (leftTop.t < c.t ? c.t : c.b < leftTop.t ? c.b : leftTop.t)
    s.left = leftTop.l + "px";  = leftTop.t + "px";
    this.onMoved(mover, leftTop);

comment:2 Changed 12 years ago by Eugene Lazutkin

Milestone: tbd1.6
Priority: highnormal
severity: majornormal

comment:3 Changed 11 years ago by Eugene Lazutkin

Resolution: fixed
Status: newclosed

(In [23878]) dnd: minor bug in constrained moveables, removed deprecated functions, thx jccooper!, !strict, fixes #11775.

Note: See TracTickets for help on using tickets.