| author | ymh <ymh.work@gmail.com> |
| Tue, 10 Jan 2017 17:36:30 +0100 | |
| changeset 649 | 2b9c120dba55 |
| parent 487 | 48be7ebb3187 |
| permissions | -rw-r--r-- |
| 284 | 1 |
|
2 |
define(['jquery', 'underscore', 'requtils', 'renderer/nodebutton'], function ($, _, requtils, NodeButton) { |
|
|
293
fba23fde14ba
Correct jshint errors and force it on build
ymh <ymh.work@gmail.com>
parents:
284
diff
changeset
|
3 |
'use strict'; |
| 433 | 4 |
|
| 284 | 5 |
var Utils = requtils.getUtils(); |
6 |
||
7 |
/* NodeRemoveButton Begin */ |
|
8 |
||
9 |
//var NodeRemoveButton = Renderer.NodeRemoveButton = Utils.inherit(Renderer._NodeButton); |
|
10 |
var NodeRemoveButton = Utils.inherit(NodeButton); |
|
11 |
||
12 |
_(NodeRemoveButton.prototype).extend({ |
|
13 |
_init: function() { |
|
14 |
this.type = "Node-remove-button"; |
|
15 |
this.lastSectorInner = 0; |
|
|
487
48be7ebb3187
add hide_nodes option to allow or node the hiding behavior on nodes
rougeronj
parents:
453
diff
changeset
|
16 |
this.startAngle = this.options.hide_nodes ? -10 : 0; |
|
48be7ebb3187
add hide_nodes option to allow or node the hiding behavior on nodes
rougeronj
parents:
453
diff
changeset
|
17 |
this.endAngle = this.options.hide_nodes ? 45 : 90; |
| 284 | 18 |
this.imageName = "remove"; |
19 |
this.text = "Remove"; |
|
20 |
}, |
|
21 |
mouseup: function() { |
|
22 |
this.renderer.click_target = null; |
|
23 |
this.renderer.is_dragging = false; |
|
24 |
this.renderer.removeRepresentationsOfType("editor"); |
|
25 |
if (this.renderer.isEditable()) { |
|
26 |
if (this.options.element_delete_delay) { |
|
27 |
var delid = Utils.getUID("delete"); |
|
28 |
this.renderer.delete_list.push({ |
|
29 |
id: delid, |
|
30 |
time: new Date().valueOf() + this.options.element_delete_delay |
|
31 |
}); |
|
32 |
this.source_representation.model.set("delete_scheduled", delid); |
|
33 |
} else { |
|
34 |
if (confirm(this.renkan.translate('Do you really wish to remove node ') + '"' + this.source_representation.model.get("title") + '"?')) { |
|
35 |
this.project.removeNode(this.source_representation.model); |
|
36 |
} |
|
37 |
} |
|
38 |
} |
|
39 |
} |
|
| 433 | 40 |
}).value(); |
|
434
0d5998b32a7c
clean, and finalize lodash migration
ymh <ymh.work@gmail.com>
parents:
433
diff
changeset
|
41 |
|
| 284 | 42 |
/* NodeRemoveButton End */ |
|
293
fba23fde14ba
Correct jshint errors and force it on build
ymh <ymh.work@gmail.com>
parents:
284
diff
changeset
|
43 |
|
| 284 | 44 |
return NodeRemoveButton; |
45 |
||
|
293
fba23fde14ba
Correct jshint errors and force it on build
ymh <ymh.work@gmail.com>
parents:
284
diff
changeset
|
46 |
}); |