client/js/renderer/basebutton.js
changeset 284 fa8035885814
child 293 fba23fde14ba
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/client/js/renderer/basebutton.js	Mon May 05 17:43:37 2014 +0200
@@ -0,0 +1,40 @@
+"use strict";
+
+define(['jquery', 'underscore', 'requtils', 'renderer/baserepresentation'], function ($, _, requtils, BaseRepresentation) {
+    
+    var Utils = requtils.getUtils();
+    
+    /* Rkns.Renderer._BaseButton Class */
+    
+    /* BaseButton is extended by contextual buttons that appear when hovering on nodes and edges */
+    
+    var _BaseButton = Utils.inherit(BaseRepresentation);
+
+    _(_BaseButton.prototype).extend({
+        moveTo: function(_pos) {
+            this.sector.moveTo(_pos);
+        },
+        show: function() {
+            this.sector.show();
+        },
+        hide: function() {
+            this.sector.hide();
+        },
+        select: function() {
+            this.sector.select();
+        },
+        unselect: function(_newTarget) {
+            this.sector.unselect();
+            if (!_newTarget || (_newTarget !== this.source_representation && _newTarget.source_representation !== this.source_representation)) {
+                this.source_representation.unselect();
+            }
+        },
+        destroy: function() {
+            this.sector.destroy();
+        }
+    });
+
+    return _BaseButton;
+
+});
+