|
284
|
1 |
"use strict"; |
|
|
2 |
|
|
|
3 |
define(['jquery', 'underscore', 'requtils', 'renderer/baserepresentation'], function ($, _, requtils, BaseRepresentation) { |
|
|
4 |
|
|
|
5 |
var Utils = requtils.getUtils(); |
|
|
6 |
|
|
|
7 |
/* Rkns.Renderer._BaseButton Class */ |
|
|
8 |
|
|
|
9 |
/* BaseButton is extended by contextual buttons that appear when hovering on nodes and edges */ |
|
|
10 |
|
|
|
11 |
var _BaseButton = Utils.inherit(BaseRepresentation); |
|
|
12 |
|
|
|
13 |
_(_BaseButton.prototype).extend({ |
|
|
14 |
moveTo: function(_pos) { |
|
|
15 |
this.sector.moveTo(_pos); |
|
|
16 |
}, |
|
|
17 |
show: function() { |
|
|
18 |
this.sector.show(); |
|
|
19 |
}, |
|
|
20 |
hide: function() { |
|
|
21 |
this.sector.hide(); |
|
|
22 |
}, |
|
|
23 |
select: function() { |
|
|
24 |
this.sector.select(); |
|
|
25 |
}, |
|
|
26 |
unselect: function(_newTarget) { |
|
|
27 |
this.sector.unselect(); |
|
|
28 |
if (!_newTarget || (_newTarget !== this.source_representation && _newTarget.source_representation !== this.source_representation)) { |
|
|
29 |
this.source_representation.unselect(); |
|
|
30 |
} |
|
|
31 |
}, |
|
|
32 |
destroy: function() { |
|
|
33 |
this.sector.destroy(); |
|
|
34 |
} |
|
|
35 |
}); |
|
|
36 |
|
|
|
37 |
return _BaseButton; |
|
|
38 |
|
|
|
39 |
}); |
|
|
40 |
|