Skip to content

Instantly share code, notes, and snippets.

@etgryphon
Created October 20, 2009 15:54
Show Gist options
  • Save etgryphon/214366 to your computer and use it in GitHub Desktop.
Save etgryphon/214366 to your computer and use it in GitHub Desktop.
dragUpdated: function(drag, evt) {
var loc = drag.get('location');
var offset = drag.get('ghostOffset');
var ghostView = drag.get('ghostView');
var view = drag.get('view');
var frame;
// if(drag.get('startFrame')){
// frame = drag.get('startFrame');
// }
// else{
var pv = ghostView.get('parentView'), thisFrame = ghostView.get('frame'); // FIXME: [MB] compute these frames only once to optimize
frame = pv ? pv.convertFrameToView(thisFrame, null) : thisFrame; // FIXME: [MB] compute these frames only once to optimize
// }
//console.log('drag loc x: %@ y: %@'.fmt(loc.x, loc.y));
loc.x -= offset.x;
loc.y -= offset.y;
// console.log('ghostView frame x: %@ y: %@'.fmt(frame.x, frame.y));
// console.log('offset x: %@ y: %@'.fmt(offset.x, offset.y));
loc.x += offset.x;
loc.y += offset.y;
drag.set('location', loc);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment