465 if (this.renderer.minimap) { |
465 if (this.renderer.minimap) { |
466 this.minimap_circle.strokeColor = undefined; |
466 this.minimap_circle.strokeColor = undefined; |
467 } |
467 } |
468 } |
468 } |
469 } |
469 } |
470 |
|
471 Rkns.Renderer.Node.prototype.toggleSelect = function() { |
|
472 if (this.selected) { |
|
473 this.unselect(null); |
|
474 } else { |
|
475 this.renderer.unselectAll(); |
|
476 this.select(); |
|
477 } |
|
478 } |
|
479 |
470 |
480 Rkns.Renderer.Node.prototype.highlight = function() { |
471 Rkns.Renderer.Node.prototype.highlight = function() { |
481 this.circle.fillColor = this.options.highlighted_node_fill_color; |
472 this.circle.fillColor = this.options.highlighted_node_fill_color; |
482 if (this.node_image) { |
473 if (this.node_image) { |
483 this.node_image.opacity = .5; |
474 this.node_image.opacity = .5; |
668 } |
660 } |
669 this.line.strokeWidth = this.options.edge_stroke_width; |
661 this.line.strokeWidth = this.options.edge_stroke_width; |
670 } |
662 } |
671 } |
663 } |
672 |
664 |
673 Rkns.Renderer.Edge.prototype.toggleSelect = function() { |
665 Rkns.Renderer.Edge.prototype.mousedown = function(_event, _isTouch) { |
674 if (this.selected) { |
666 if (_isTouch) { |
675 this.unselect(null); |
|
676 } else { |
|
677 this.renderer.unselectAll(); |
667 this.renderer.unselectAll(); |
678 this.select(); |
668 this.select(); |
679 } |
|
680 } |
|
681 |
|
682 Rkns.Renderer.Edge.prototype.mousedown = function(_event, _isTouch) { |
|
683 if (_isTouch) { |
|
684 this.toggleSelect(); |
|
685 } |
669 } |
686 } |
670 } |
687 |
671 |
688 Rkns.Renderer.Edge.prototype.mouseup = function(_event, _isTouch) { |
672 Rkns.Renderer.Edge.prototype.mouseup = function(_event, _isTouch) { |
689 if (!this.renkan.read_only && this.renderer.is_dragging) { |
673 if (!this.renkan.read_only && this.renderer.is_dragging) { |
1424 }, |
1408 }, |
1425 touchstart: function(_event) { |
1409 touchstart: function(_event) { |
1426 _event.preventDefault(); |
1410 _event.preventDefault(); |
1427 _originalScale = _this.scale; |
1411 _originalScale = _this.scale; |
1428 _zooming = false; |
1412 _zooming = false; |
1429 _this.onMouseDown(_event.originalEvent.changedTouches[0], true); |
1413 _this.onMouseDown(_event.originalEvent.touches[0], true); |
1430 }, |
1414 }, |
1431 touchmove: function(_event) { |
1415 touchmove: function(_event) { |
1432 _event.preventDefault(); |
1416 _event.preventDefault(); |
1433 if (typeof _event.originalEvent.scale === "undefined" || _event.originalEvent.scale == 1) { |
1417 if (_event.originalEvent.touches.length == 1) { |
1434 // On Android, scale is undefined, so no zooming.. |
1418 _this.onMouseMove(_event.originalEvent.touches[0], true); |
1435 _this.onMouseMove(_event.originalEvent.changedTouches[0], true); |
|
1436 } else { |
1419 } else { |
1437 if (!_zooming) { |
1420 if (!_zooming) { |
1438 _this.onMouseUp(_event, true); |
1421 _this.onMouseUp(_event.originalEvent.touches[0], true); |
1439 _this.click_target = null; |
1422 _this.click_target = null; |
1440 _this.is_dragging = false; |
1423 _this.is_dragging = false; |
1441 _zooming = true; |
1424 _zooming = true; |
|
1425 } |
|
1426 if (_event.originalEvent.scale === "undefined") { |
|
1427 return; |
1442 } |
1428 } |
1443 var _newScale = _event.originalEvent.scale * _originalScale, |
1429 var _newScale = _event.originalEvent.scale * _originalScale, |
1444 _scaleRatio = _newScale / _this.scale, |
1430 _scaleRatio = _newScale / _this.scale, |
1445 _newOffset = new paper.Point([ |
1431 _newOffset = new paper.Point([ |
1446 _this.canvas_$.width(), |
1432 _this.canvas_$.width(), |