mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-29 09:04:54 +01:00
Remove more custom code in favor of mootols.
This commit is contained in:
parent
d20e5cf6d5
commit
dc50cee16d
@ -105,9 +105,7 @@ mindplot.ControlPoint = new Class({
|
|||||||
this._controlLines[point].setFrom(cords.x, cords.y);
|
this._controlLines[point].setFrom(cords.x, cords.y);
|
||||||
this._controlLines[point].setTo(pos.x - 2, pos.y);
|
this._controlLines[point].setTo(pos.x - 2, pos.y);
|
||||||
this._line.getLine().updateLine(point);
|
this._line.getLine().updateLine(point);
|
||||||
/*event.preventDefault();
|
|
||||||
event.stop();
|
|
||||||
return false;*/
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_mouseUp : function(event, point) {
|
_mouseUp : function(event, point) {
|
||||||
|
@ -115,13 +115,11 @@ mindplot.ScreenManager = new Class({
|
|||||||
|
|
||||||
getWorkspaceMousePosition : function(event) {
|
getWorkspaceMousePosition : function(event) {
|
||||||
// Retrieve current mouse position.
|
// Retrieve current mouse position.
|
||||||
var mousePosition = this._getMousePosition(event);
|
var x = event.client.x;
|
||||||
var x = mousePosition.x;
|
var y = event.client.y;
|
||||||
var y = mousePosition.y;
|
|
||||||
|
|
||||||
// Subtract div position.
|
// Subtract div position.
|
||||||
var containerElem = this.getContainer();
|
var containerPosition = this.getContainer().getPosition();
|
||||||
var containerPosition = this._getDivPosition(containerElem);
|
|
||||||
x = x - containerPosition.x;
|
x = x - containerPosition.x;
|
||||||
y = y - containerPosition.y;
|
y = y - containerPosition.y;
|
||||||
|
|
||||||
@ -137,28 +135,6 @@ mindplot.ScreenManager = new Class({
|
|||||||
return new core.Point(x, y);
|
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() {
|
getContainer : function() {
|
||||||
return this._divContainer;
|
return this._divContainer;
|
||||||
},
|
},
|
||||||
|
@ -1,51 +1,43 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright [2011] [wisemapping]
|
* Copyright [2011] [wisemapping]
|
||||||
*
|
*
|
||||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||||
* "powered by wisemapping" text requirement on every single page;
|
* "powered by wisemapping" text requirement on every single page;
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the license at
|
* You may obtain a copy of the license at
|
||||||
*
|
*
|
||||||
* http://www.wisemapping.org/license
|
* http://www.wisemapping.org/license
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
web2d.EventDispatcher = function(element)
|
web2d.EventDispatcher = function(element) {
|
||||||
{
|
|
||||||
this._listeners = [];
|
this._listeners = [];
|
||||||
var dispatcher = this;
|
var dispatcher = this;
|
||||||
|
|
||||||
this.eventListener = function(event)
|
this.eventListener = function(event) {
|
||||||
{
|
for (var i = 0; i < dispatcher._listeners.length; i++) {
|
||||||
for (var i = 0; i < dispatcher._listeners.length; i++)
|
if (dispatcher._listeners[i] != null) {
|
||||||
{
|
dispatcher._listeners[i].call(element, new Event(event) || new Event(window.event));
|
||||||
if (dispatcher._listeners[i] != null)
|
|
||||||
{
|
|
||||||
dispatcher._listeners[i].call(element, event || window.event);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
web2d.EventDispatcher.prototype.addListener = function(type, listener)
|
web2d.EventDispatcher.prototype.addListener = function(type, listener) {
|
||||||
{
|
if (!$defined(listener)) {
|
||||||
if (!$defined(listener))
|
|
||||||
{
|
|
||||||
throw "Listener can not be null.";
|
throw "Listener can not be null.";
|
||||||
}
|
}
|
||||||
this._listeners.include(listener);
|
this._listeners.include(listener);
|
||||||
};
|
};
|
||||||
|
|
||||||
web2d.EventDispatcher.prototype.removeListener = function(type, listener)
|
web2d.EventDispatcher.prototype.removeListener = function(type, listener) {
|
||||||
{
|
if (!$defined(listener)) {
|
||||||
if (!$defined(listener))
|
|
||||||
{
|
|
||||||
throw "Listener can not be null.";
|
throw "Listener can not be null.";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,28 +48,11 @@ web2d.EventDispatcher.prototype.removeListener = function(type, listener)
|
|||||||
|
|
||||||
var newLength = this._listeners.length;
|
var newLength = this._listeners.length;
|
||||||
|
|
||||||
if (newLength >= length)
|
if (newLength >= length) {
|
||||||
{
|
|
||||||
throw "There is not listener to remove";
|
throw "There is not listener to remove";
|
||||||
}
|
}
|
||||||
/*this._listeners = this._listeners.reject(function(iter)
|
|
||||||
{
|
|
||||||
if (iter == listener)
|
|
||||||
{
|
|
||||||
found = true;
|
|
||||||
}
|
|
||||||
return iter == listener;
|
|
||||||
});
|
|
||||||
|
|
||||||
// Could I remove any listener ?
|
|
||||||
if (!found)
|
|
||||||
{
|
|
||||||
throw "There is not listener to remove";
|
|
||||||
}*/
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
web2d.EventDispatcher.prototype.getListenersCount = function()
|
web2d.EventDispatcher.prototype.getListenersCount = function() {
|
||||||
{
|
|
||||||
return this._listeners.length;
|
return this._listeners.length;
|
||||||
};
|
};
|
||||||
|
@ -20,7 +20,7 @@ web2d.peer.svg.TextPeer = function()
|
|||||||
{
|
{
|
||||||
var svgElement = window.document.createElementNS(this.svgNamespace, 'text');
|
var svgElement = window.document.createElementNS(this.svgNamespace, 'text');
|
||||||
web2d.peer.svg.ElementPeer.call(this, svgElement);
|
web2d.peer.svg.ElementPeer.call(this, svgElement);
|
||||||
this._native.setAttribute("focusable", "true");
|
this._native.setAttribute("focusable", "false");
|
||||||
this._position = {x:0,y:0};
|
this._position = {x:0,y:0};
|
||||||
this._font = new web2d.Font("Arial", this);
|
this._font = new web2d.Font("Arial", this);
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user