Created
August 27, 2009 21:44
-
-
Save b00gizm/176584 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mouseDragged: function(evt) { | |
var info = this._mouseDownInfo; | |
var layout = this.get('layout'); | |
var parentLayout = this.get('parentView').get('layout'); | |
var loc; | |
// handle X direction | |
loc = info.left + (evt.pageX - info.pageX); | |
if (loc < 0) { | |
loc = 0; | |
} | |
else if (loc >= (parentLayout.width - layout.width)) { | |
loc = (parentLayout.width - layout.width); | |
} | |
this.adjust('left', loc); | |
// handle Y direction | |
loc = info.top + (evt.pageY - info.pageY); | |
if (loc < 0) { | |
loc = 0; | |
} | |
else if (loc >= (parentLayout.height - layout.height)) { | |
loc = (parentLayout.height - layout.height); | |
} | |
this.adjust('top', loc); | |
return YES; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment