| author | ymh <ymh.work@gmail.com> |
| Fri, 16 May 2014 14:09:57 +0200 | |
| changeset 293 | fba23fde14ba |
| parent 284 | fa8035885814 |
| child 433 | e457ec945e50 |
| 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'; |
| 284 | 4 |
|
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; |
|
16 |
this.startAngle = 0; |
|
17 |
this.endAngle = 90; |
|
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 |
} |
|
40 |
}); |
|
41 |
||
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 |
}); |