|
284
|
1 |
"use strict"; |
|
|
2 |
|
|
|
3 |
define(['jquery', 'underscore', 'requtils', 'renderer/nodebutton'], function ($, _, requtils, NodeButton) { |
|
|
4 |
|
|
|
5 |
var Utils = requtils.getUtils(); |
|
|
6 |
|
|
|
7 |
/* NodeLinkButton Begin */ |
|
|
8 |
|
|
|
9 |
//var NodeLinkButton = Renderer.NodeLinkButton = Utils.inherit(Renderer._NodeButton); |
|
|
10 |
var NodeLinkButton = Utils.inherit(NodeButton); |
|
|
11 |
|
|
|
12 |
_(NodeLinkButton.prototype).extend({ |
|
|
13 |
_init: function() { |
|
|
14 |
this.type = "Node-link-button"; |
|
|
15 |
this.lastSectorInner = 0; |
|
|
16 |
this.startAngle = 90; |
|
|
17 |
this.endAngle = 180; |
|
|
18 |
this.imageName = "link"; |
|
|
19 |
this.text = "Link to another node"; |
|
|
20 |
}, |
|
|
21 |
mousedown: function(_event, _isTouch) { |
|
|
22 |
if (this.renderer.isEditable()) { |
|
|
23 |
var _off = this.renderer.canvas_$.offset(), |
|
|
24 |
_point = new paper.Point([ |
|
|
25 |
_event.pageX - _off.left, |
|
|
26 |
_event.pageY - _off.top |
|
|
27 |
]); |
|
|
28 |
this.renderer.click_target = null; |
|
|
29 |
this.renderer.removeRepresentationsOfType("editor"); |
|
|
30 |
this.renderer.addTempEdge(this.source_representation, _point); |
|
|
31 |
} |
|
|
32 |
} |
|
|
33 |
}); |
|
|
34 |
|
|
|
35 |
/* NodeLinkButton End */ |
|
|
36 |
|
|
|
37 |
return NodeLinkButton; |
|
|
38 |
|
|
|
39 |
}); |