fixed the minimap bug in read-only mode
authorveltr
Fri, 15 Mar 2013 16:34:56 +0100
changeset 82 ff79f9f4321a
parent 81 555a094e2000
child 85 1e9a22f04c39
fixed the minimap bug in read-only mode
client/js/paper-renderer.js
--- a/client/js/paper-renderer.js	Fri Mar 15 12:54:36 2013 +0100
+++ b/client/js/paper-renderer.js	Fri Mar 15 16:34:56 2013 +0100
@@ -367,8 +367,12 @@
 }
 
 Rkns.Renderer.Node.prototype.paperShift = function(_delta) {
-    this.paper_coords = this.paper_coords.add(_delta);
-    this.redraw();
+	if (!this.renderer.renkan.read_only) {
+		this.paper_coords = this.paper_coords.add(_delta);
+    	this.redraw();
+	} else {
+		this.renderer.paperShift(_delta);
+	}
 }
 
 Rkns.Renderer.Node.prototype.openEditor = function() {
@@ -577,8 +581,12 @@
 }
 
 Rkns.Renderer.Edge.prototype.paperShift = function(_delta) {
-    this.from_representation.paperShift(_delta);
-    this.to_representation.paperShift(_delta);
+	if (!this.renderer.renkan.read_only) {
+	    this.from_representation.paperShift(_delta);
+	    this.to_representation.paperShift(_delta);
+	} else {
+		this.renderer.paperShift(_delta);
+	}
 }
 
 Rkns.Renderer.Edge.prototype.destroy = function() {
@@ -1721,15 +1729,19 @@
     }
 }
 
+Rkns.Renderer.Scene.prototype.paperShift = function(_delta) {
+	this.offset = this.offset.add(_delta);
+    this.resetCoords();
+    this.redraw();
+}
+
 Rkns.Renderer.Scene.prototype.onMouseMove = function(_event) {
     var _hitResult = paper.project.hitTest(_event.point);
     if (this.is_dragging) {
-        if (this.click_target && typeof this.click_target.paperShift === "function" && !this.renkan.read_only) {
+        if (this.click_target && typeof this.click_target.paperShift === "function") {
             this.click_target.paperShift(_event.delta);
         } else {
-            this.offset = this.offset.add(_event.delta);
-            this.resetCoords();
-            this.redraw();
+            this.paperShift(_delta);
         }
     } else {
         this.findTarget(_hitResult);