client/js/paper-renderer.js
changeset 157 cdfc0b1547f3
parent 156 83d7a10e1ad7
child 159 1796e0220bef
--- a/client/js/paper-renderer.js	Tue Apr 16 17:31:00 2013 +0200
+++ b/client/js/paper-renderer.js	Tue Apr 16 18:44:34 2013 +0200
@@ -467,15 +467,6 @@
     	}
     }
 }
-
-Rkns.Renderer.Node.prototype.toggleSelect = function() {
-	if (this.selected) {
-		this.unselect(null);
-	} else {
-		this.renderer.unselectAll();
-		this.select();
-	}
-}
 	
 Rkns.Renderer.Node.prototype.highlight = function() {
     this.circle.fillColor = this.options.highlighted_node_fill_color;
@@ -506,7 +497,8 @@
 
 Rkns.Renderer.Node.prototype.mousedown = function(_event, _isTouch) {
 	if (_isTouch) {
-		this.toggleSelect();
+		this.renderer.unselectAll();
+		this.select();
 	}
 }
 
@@ -670,21 +662,13 @@
     }
 }
 
-Rkns.Renderer.Edge.prototype.toggleSelect = function() {
-	if (this.selected) {
-		this.unselect(null);
-	} else {
+Rkns.Renderer.Edge.prototype.mousedown = function(_event, _isTouch) {
+	if (_isTouch) {
 		this.renderer.unselectAll();
 		this.select();
 	}
 }
 
-Rkns.Renderer.Edge.prototype.mousedown = function(_event, _isTouch) {
-	if (_isTouch) {
-		this.toggleSelect();
-	}
-}
-
 Rkns.Renderer.Edge.prototype.mouseup = function(_event, _isTouch) {
     if (!this.renkan.read_only && this.renderer.is_dragging) {
         this.from_representation.saveCoords();
@@ -1426,20 +1410,22 @@
 	    	_event.preventDefault();
 	    	_originalScale = _this.scale;
 	    	_zooming = false;
-	    	_this.onMouseDown(_event.originalEvent.changedTouches[0], true);
+	    	_this.onMouseDown(_event.originalEvent.touches[0], true);
 	    },
 	    touchmove: function(_event) {
 	    	_event.preventDefault();
-	    	if (typeof _event.originalEvent.scale === "undefined" || _event.originalEvent.scale == 1) {
-	    		// On Android, scale is undefined, so no zooming..
-	    		_this.onMouseMove(_event.originalEvent.changedTouches[0], true);
+	    	if (_event.originalEvent.touches.length == 1) {
+	    		_this.onMouseMove(_event.originalEvent.touches[0], true);
 	    	} else {
 	    		if (!_zooming) {
-	    			_this.onMouseUp(_event, true);
+	    			_this.onMouseUp(_event.originalEvent.touches[0], true);
 			        _this.click_target = null;
 			        _this.is_dragging = false;
 			        _zooming = true;
 	    		}
+	    		if (_event.originalEvent.scale === "undefined") {
+	    			return;
+	    		}
 	    		var _newScale = _event.originalEvent.scale * _originalScale,
 	    			_scaleRatio = _newScale / _this.scale,
 	    			_newOffset = new paper.Point([