155 } |
155 } |
156 }, |
156 }, |
157 touchend: function(_event) { |
157 touchend: function(_event) { |
158 _event.preventDefault(); |
158 _event.preventDefault(); |
159 _this.onMouseUp(_event.originalEvent.changedTouches[0], true); |
159 _this.onMouseUp(_event.originalEvent.changedTouches[0], true); |
|
160 }, |
|
161 click: function(_event) { |
|
162 _event.preventDefault(); |
|
163 _this.onClick(_event); |
160 }, |
164 }, |
161 dblclick: function(_event) { |
165 dblclick: function(_event) { |
162 _event.preventDefault(); |
166 _event.preventDefault(); |
163 if (_renkan.options.allow_double_click) { |
167 if (_renkan.options.allow_double_click) { |
164 _this.onDoubleClick(_event); |
168 _this.onDoubleClick(_event); |
998 this.view.setScale( this.view.scale * Math.SQRT1_2, this.view.offset.add(_delta.divide(Math.SQRT2))); |
1002 this.view.setScale( this.view.scale * Math.SQRT1_2, this.view.offset.add(_delta.divide(Math.SQRT2))); |
999 } |
1003 } |
1000 this.totalScroll = 0; |
1004 this.totalScroll = 0; |
1001 } |
1005 } |
1002 }, |
1006 }, |
|
1007 onClick: function(_event) { |
|
1008 if (!this.isEditable()) { |
|
1009 var _off = this.canvas_$.offset(), |
|
1010 _point = new paper.Point([ |
|
1011 _event.pageX - _off.left, |
|
1012 _event.pageY - _off.top |
|
1013 ]); |
|
1014 var _hitResult = paper.project.hitTest(_point); |
|
1015 if(!this._open_uri_cb && |
|
1016 this.renkan.options.simple_click_open_url && |
|
1017 _hitResult && |
|
1018 typeof _hitResult.item.__representation !== "undefined" && |
|
1019 _hitResult.item.__representation.model.get('uri') && |
|
1020 !this._node_click_open_url |
|
1021 ) { |
|
1022 this._node_click_open_url = setTimeout(function() { |
|
1023 window.open(_hitResult.item.__representation.model.get('uri'), '_blank'); |
|
1024 this._node_click_open_url = null; |
|
1025 }.bind(this), 200); |
|
1026 } |
|
1027 } |
|
1028 }, |
1003 onDoubleClick: function(_event) { |
1029 onDoubleClick: function(_event) { |
1004 var _off = this.canvas_$.offset(), |
1030 var _off = this.canvas_$.offset(), |
1005 _point = new paper.Point([ |
1031 _point = new paper.Point([ |
1006 _event.pageX - _off.left, |
1032 _event.pageX - _off.left, |
1007 _event.pageY - _off.top |
1033 _event.pageY - _off.top |
1008 ]); |
1034 ]); |
1009 var _hitResult = paper.project.hitTest(_point); |
1035 var _hitResult = paper.project.hitTest(_point); |
1010 |
1036 |
1011 if (!this.isEditable()) { |
1037 if (!this.isEditable()) { |
1012 if (_hitResult && typeof _hitResult.item.__representation !== "undefined") { |
1038 if (this.renkan.options.double_click_open_url && |
1013 if (_hitResult.item.__representation.model.get('uri')){ |
1039 _hitResult && |
1014 window.open(_hitResult.item.__representation.model.get('uri'), '_blank'); |
1040 typeof _hitResult.item.__representation !== "undefined" && |
1015 } |
1041 _hitResult.item.__representation.model.get('uri') && |
|
1042 !this._node_click_open_url |
|
1043 ) { |
|
1044 window.open(_hitResult.item.__representation.model.get('uri'), '_blank'); |
1016 } |
1045 } |
1017 return; |
1046 return; |
1018 } |
1047 } |
1019 if (this.isEditable() && (!_hitResult || typeof _hitResult.item.__representation === "undefined")) { |
1048 if (this.isEditable() && (!_hitResult || typeof _hitResult.item.__representation === "undefined")) { |
1020 var _coords = this.toModelCoords(_point), |
1049 var _coords = this.toModelCoords(_point), |