| author | ymh <ymh.work@gmail.com> |
| Tue, 10 Jan 2017 17:36:30 +0100 | |
| changeset 649 | 2b9c120dba55 |
| parent 505 | a6a3b0e3da57 |
| permissions | -rw-r--r-- |
| 284 | 1 |
|
2 |
define(['jquery', 'underscore', 'requtils', 'renderer/baserepresentation'], function ($, _, requtils, BaseRepresentation) { |
|
|
293
fba23fde14ba
Correct jshint errors and force it on build
ymh <ymh.work@gmail.com>
parents:
284
diff
changeset
|
3 |
'use strict'; |
|
fba23fde14ba
Correct jshint errors and force it on build
ymh <ymh.work@gmail.com>
parents:
284
diff
changeset
|
4 |
|
| 284 | 5 |
var Utils = requtils.getUtils(); |
|
293
fba23fde14ba
Correct jshint errors and force it on build
ymh <ymh.work@gmail.com>
parents:
284
diff
changeset
|
6 |
|
| 284 | 7 |
/* Rkns.Renderer._BaseButton Class */ |
|
293
fba23fde14ba
Correct jshint errors and force it on build
ymh <ymh.work@gmail.com>
parents:
284
diff
changeset
|
8 |
|
| 284 | 9 |
/* BaseButton is extended by contextual buttons that appear when hovering on nodes and edges */ |
|
293
fba23fde14ba
Correct jshint errors and force it on build
ymh <ymh.work@gmail.com>
parents:
284
diff
changeset
|
10 |
|
| 284 | 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() { |
|
|
505
a6a3b0e3da57
'hideButtons' function can be call by view hides the nodes. So we have to check if the button is drawn (i.e. sector is defined) first before hiding it.
rougeronj
parents:
434
diff
changeset
|
21 |
if (this.sector){ |
|
649
2b9c120dba55
first implementation of node title size and color
ymh <ymh.work@gmail.com>
parents:
505
diff
changeset
|
22 |
this.sector.hide(); |
|
505
a6a3b0e3da57
'hideButtons' function can be call by view hides the nodes. So we have to check if the button is drawn (i.e. sector is defined) first before hiding it.
rougeronj
parents:
434
diff
changeset
|
23 |
} |
| 284 | 24 |
}, |
25 |
select: function() { |
|
26 |
this.sector.select(); |
|
27 |
}, |
|
28 |
unselect: function(_newTarget) { |
|
29 |
this.sector.unselect(); |
|
30 |
if (!_newTarget || (_newTarget !== this.source_representation && _newTarget.source_representation !== this.source_representation)) { |
|
31 |
this.source_representation.unselect(); |
|
32 |
} |
|
33 |
}, |
|
34 |
destroy: function() { |
|
35 |
this.sector.destroy(); |
|
36 |
} |
|
| 433 | 37 |
}).value(); |
| 284 | 38 |
|
39 |
return _BaseButton; |
|
40 |
||
41 |
}); |