Remove more custom code in favor of mootols.

This commit is contained in:
Paulo Veiga
2011-08-28 11:58:43 -03:00
parent d20e5cf6d5
commit dc50cee16d
4 changed files with 32 additions and 83 deletions

View File

@@ -105,9 +105,7 @@ mindplot.ControlPoint = new Class({
this._controlLines[point].setFrom(cords.x, cords.y);
this._controlLines[point].setTo(pos.x - 2, pos.y);
this._line.getLine().updateLine(point);
/*event.preventDefault();
event.stop();
return false;*/
},
_mouseUp : function(event, point) {

View File

@@ -115,13 +115,11 @@ mindplot.ScreenManager = new Class({
getWorkspaceMousePosition : function(event) {
// Retrieve current mouse position.
var mousePosition = this._getMousePosition(event);
var x = mousePosition.x;
var y = mousePosition.y;
var x = event.client.x;
var y = event.client.y;
// Subtract div position.
var containerElem = this.getContainer();
var containerPosition = this._getDivPosition(containerElem);
var containerPosition = this.getContainer().getPosition();
x = x - containerPosition.x;
y = y - containerPosition.y;
@@ -137,28 +135,6 @@ mindplot.ScreenManager = new Class({
return new core.Point(x, y);
},
/**
* Calculate the position of the passed element.
*/
_getDivPosition : function(divElement) {
var curleft = 0;
var curtop = 0;
if ($defined(divElement.offsetParent)) {
curleft = divElement.offsetLeft;
curtop = divElement.offsetTop;
while (divElement = divElement.offsetParent) {
curleft += divElement.offsetLeft;
curtop += divElement.offsetTop;
}
}
return {x:curleft,y:curtop};
},
_getMousePosition : function(event) {
$assert(event, 'event can not be null');
return {x:event.client.x,y:event.client.y};
},
getContainer : function() {
return this._divContainer;
},