]> source.dussan.org Git - svg.js.git/commitdiff
Removed redundant code
authorwout <wout@impinc.co.uk>
Mon, 17 Dec 2012 11:19:37 +0000 (12:19 +0100)
committerwout <wout@impinc.co.uk>
Mon, 17 Dec 2012 11:19:37 +0000 (12:19 +0100)
src/dispatcher.js [deleted file]
src/draggable.js [deleted file]
src/image.js
src/nested.js [deleted file]
src/shape.js

diff --git a/src/dispatcher.js b/src/dispatcher.js
deleted file mode 100644 (file)
index 2765652..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-SVG.Dispatcher = {
-  
-  on: function(events, listener) {
-    events = events.split(' ');
-    
-    for (var i = 0, l = events.length; i < l; i++)
-      this.svgElement.addEventListener(events[i], listener)
-  },
-  
-  off: function(events, listener) {
-    events = events.split(' ');
-    
-    for (var i = 0, l = events.length; i < l; i++)
-      this.svgElement.removeEventListener(events[i], listener)
-  }
-  
-};
\ No newline at end of file
diff --git a/src/draggable.js b/src/draggable.js
deleted file mode 100644 (file)
index b0deac7..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-
-var bind = function(fn, me) {
-  return function() { return fn.apply(me, arguments); };
-};
-
-SVG.Draggable = function Draggable(e) {
-  this._windowMouseUp = bind(this._windowMouseUp, this);
-  this._windowMouseMove = bind(this._windowMouseMove, this);
-  this.draggable = bind(this.draggable, this);
-  this.element = e;
-  this.element.draggable = this.draggable;
-};
-
-SVG.Draggable.prototype.draggable = function() {
-  var self = this;
-  this.element.on('mousedown', function(e) {
-    self.startDragEvent = e;
-    self.startDragPosition = {
-      x: self.element.attributes.x || 0,
-      y: self.element.attributes.y || 0
-    };
-    window.addEventListener('mousemove', self._windowMouseMove);
-    window.addEventListener('mouseup', self._windowMouseUp);
-    return typeof self.element.dragstart === 'function' ? self.element.dragstart(e) : void 0;
-  });
-  return this.element;
-};
-
-SVG.Draggable.prototype._windowMouseMove = function(e) {
-  if (this.startDragEvent != null) {
-    var d = {
-      x: e.pageX - this.startDragEvent.pageX,
-      y: e.pageY - this.startDragEvent.pageY
-    };
-    this.element.move(this.startDragPosition.x + d.x, this.startDragPosition.y + d.y);
-    return typeof this.element.dragmove === 'function' ? this.element.dragmove(d, e) : void 0;
-  }
-};
-
-SVG.Draggable.prototype._windowMouseUp = function(e) {
-  this.startDragEvent = null;
-  this.startDragPosition = null;
-  window.removeEventListener('mousemove', this._windowMouseMove);
-  window.removeEventListener('mouseup', this._windowMouseUp);
-  return typeof this.element.dragend === 'function' ? this.element.dragend(e) : void 0;
-};
\ No newline at end of file
index ff70aeedd33d21210efe7b0e912b128b1c922f54..3c60f2ae81e30a75ae13f7b2d60b6ba41ce57dce 100644 (file)
@@ -1,6 +1,5 @@
 
 SVG.Image = function Image() {
-  this.drag = new SVG.Draggable(this);
   this.constructor.call(this, SVG.createElement('image'));
 };
 
diff --git a/src/nested.js b/src/nested.js
deleted file mode 100644 (file)
index 6245ca6..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-
-SVG.Nested = function Nested() {
-  this.drag = new SVG.Draggable(this);
-  this.constructor.call(this, SVG.createElement('svg'));
-  this.setAttribute('overflow', 'visible');
-};
-
-// inherit from SVG.Element
-SVG.Nested.prototype = new SVG.Element();
-
-// include the container object
-SVG.Nested.include(SVG.Container);
\ No newline at end of file
index 8295f1c482d7bee125d04be624bfcbc352b011b1..236b33e69ef79851b671c008e40b72c0076e2da2 100644 (file)
@@ -1,6 +1,5 @@
 
 SVG.Shape = function Shape(element) {
-  this.drag = new SVG.Draggable(this);
   this.constructor.call(this, element);
 };