vis-rails 2.0.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/lib/vis/rails/version.rb +1 -1
 - data/vendor/assets/javascripts/vis.js +26 -26
 - metadata +16 -85
 - data/vendor/assets/vis/DataSet.js +0 -926
 - data/vendor/assets/vis/DataView.js +0 -283
 - data/vendor/assets/vis/graph/Edge.js +0 -957
 - data/vendor/assets/vis/graph/Graph.js +0 -2291
 - data/vendor/assets/vis/graph/Groups.js +0 -80
 - data/vendor/assets/vis/graph/Images.js +0 -41
 - data/vendor/assets/vis/graph/Node.js +0 -966
 - data/vendor/assets/vis/graph/Popup.js +0 -132
 - data/vendor/assets/vis/graph/css/graph-manipulation.css +0 -128
 - data/vendor/assets/vis/graph/css/graph-navigation.css +0 -66
 - data/vendor/assets/vis/graph/dotparser.js +0 -829
 - data/vendor/assets/vis/graph/graphMixins/ClusterMixin.js +0 -1143
 - data/vendor/assets/vis/graph/graphMixins/HierarchicalLayoutMixin.js +0 -311
 - data/vendor/assets/vis/graph/graphMixins/ManipulationMixin.js +0 -576
 - data/vendor/assets/vis/graph/graphMixins/MixinLoader.js +0 -199
 - data/vendor/assets/vis/graph/graphMixins/NavigationMixin.js +0 -205
 - data/vendor/assets/vis/graph/graphMixins/SectorsMixin.js +0 -552
 - data/vendor/assets/vis/graph/graphMixins/SelectionMixin.js +0 -648
 - data/vendor/assets/vis/graph/graphMixins/physics/BarnesHut.js +0 -398
 - data/vendor/assets/vis/graph/graphMixins/physics/HierarchialRepulsion.js +0 -64
 - data/vendor/assets/vis/graph/graphMixins/physics/PhysicsMixin.js +0 -697
 - data/vendor/assets/vis/graph/graphMixins/physics/Repulsion.js +0 -66
 - data/vendor/assets/vis/graph/img/acceptDeleteIcon.png +0 -0
 - data/vendor/assets/vis/graph/img/addNodeIcon.png +0 -0
 - data/vendor/assets/vis/graph/img/backIcon.png +0 -0
 - data/vendor/assets/vis/graph/img/connectIcon.png +0 -0
 - data/vendor/assets/vis/graph/img/cross.png +0 -0
 - data/vendor/assets/vis/graph/img/cross2.png +0 -0
 - data/vendor/assets/vis/graph/img/deleteIcon.png +0 -0
 - data/vendor/assets/vis/graph/img/downArrow.png +0 -0
 - data/vendor/assets/vis/graph/img/editIcon.png +0 -0
 - data/vendor/assets/vis/graph/img/leftArrow.png +0 -0
 - data/vendor/assets/vis/graph/img/minus.png +0 -0
 - data/vendor/assets/vis/graph/img/plus.png +0 -0
 - data/vendor/assets/vis/graph/img/rightArrow.png +0 -0
 - data/vendor/assets/vis/graph/img/upArrow.png +0 -0
 - data/vendor/assets/vis/graph/img/zoomExtends.png +0 -0
 - data/vendor/assets/vis/graph/shapes.js +0 -225
 - data/vendor/assets/vis/graph3d/Graph3d.js +0 -3306
 - data/vendor/assets/vis/module/exports.js +0 -65
 - data/vendor/assets/vis/module/header.js +0 -24
 - data/vendor/assets/vis/module/imports.js +0 -31
 - data/vendor/assets/vis/shim.js +0 -252
 - data/vendor/assets/vis/timeline/Range.js +0 -532
 - data/vendor/assets/vis/timeline/TimeStep.js +0 -466
 - data/vendor/assets/vis/timeline/Timeline.js +0 -851
 - data/vendor/assets/vis/timeline/component/Component.js +0 -52
 - data/vendor/assets/vis/timeline/component/CurrentTime.js +0 -128
 - data/vendor/assets/vis/timeline/component/CustomTime.js +0 -182
 - data/vendor/assets/vis/timeline/component/Group.js +0 -470
 - data/vendor/assets/vis/timeline/component/ItemSet.js +0 -1332
 - data/vendor/assets/vis/timeline/component/TimeAxis.js +0 -389
 - data/vendor/assets/vis/timeline/component/css/animation.css +0 -33
 - data/vendor/assets/vis/timeline/component/css/currenttime.css +0 -5
 - data/vendor/assets/vis/timeline/component/css/customtime.css +0 -6
 - data/vendor/assets/vis/timeline/component/css/item.css +0 -107
 - data/vendor/assets/vis/timeline/component/css/itemset.css +0 -33
 - data/vendor/assets/vis/timeline/component/css/labelset.css +0 -36
 - data/vendor/assets/vis/timeline/component/css/panel.css +0 -71
 - data/vendor/assets/vis/timeline/component/css/timeaxis.css +0 -48
 - data/vendor/assets/vis/timeline/component/css/timeline.css +0 -2
 - data/vendor/assets/vis/timeline/component/item/Item.js +0 -139
 - data/vendor/assets/vis/timeline/component/item/ItemBox.js +0 -230
 - data/vendor/assets/vis/timeline/component/item/ItemPoint.js +0 -190
 - data/vendor/assets/vis/timeline/component/item/ItemRange.js +0 -262
 - data/vendor/assets/vis/timeline/component/item/ItemRangeOverflow.js +0 -57
 - data/vendor/assets/vis/timeline/img/delete.png +0 -0
 - data/vendor/assets/vis/timeline/stack.js +0 -112
 - data/vendor/assets/vis/util.js +0 -990
 
| 
         @@ -1,648 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
             
     | 
| 
       2 
     | 
    
         
            -
            var SelectionMixin = {
         
     | 
| 
       3 
     | 
    
         
            -
             
     | 
| 
       4 
     | 
    
         
            -
              /**
         
     | 
| 
       5 
     | 
    
         
            -
               * This function can be called from the _doInAllSectors function
         
     | 
| 
       6 
     | 
    
         
            -
               *
         
     | 
| 
       7 
     | 
    
         
            -
               * @param object
         
     | 
| 
       8 
     | 
    
         
            -
               * @param overlappingNodes
         
     | 
| 
       9 
     | 
    
         
            -
               * @private
         
     | 
| 
       10 
     | 
    
         
            -
               */
         
     | 
| 
       11 
     | 
    
         
            -
              _getNodesOverlappingWith : function(object, overlappingNodes) {
         
     | 
| 
       12 
     | 
    
         
            -
                var nodes = this.nodes;
         
     | 
| 
       13 
     | 
    
         
            -
                for (var nodeId in nodes) {
         
     | 
| 
       14 
     | 
    
         
            -
                  if (nodes.hasOwnProperty(nodeId)) {
         
     | 
| 
       15 
     | 
    
         
            -
                    if (nodes[nodeId].isOverlappingWith(object)) {
         
     | 
| 
       16 
     | 
    
         
            -
                      overlappingNodes.push(nodeId);
         
     | 
| 
       17 
     | 
    
         
            -
                    }
         
     | 
| 
       18 
     | 
    
         
            -
                  }
         
     | 
| 
       19 
     | 
    
         
            -
                }
         
     | 
| 
       20 
     | 
    
         
            -
              },
         
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
              /**
         
     | 
| 
       23 
     | 
    
         
            -
               * retrieve all nodes overlapping with given object
         
     | 
| 
       24 
     | 
    
         
            -
               * @param {Object} object  An object with parameters left, top, right, bottom
         
     | 
| 
       25 
     | 
    
         
            -
               * @return {Number[]}   An array with id's of the overlapping nodes
         
     | 
| 
       26 
     | 
    
         
            -
               * @private
         
     | 
| 
       27 
     | 
    
         
            -
               */
         
     | 
| 
       28 
     | 
    
         
            -
              _getAllNodesOverlappingWith : function (object) {
         
     | 
| 
       29 
     | 
    
         
            -
                var overlappingNodes = [];
         
     | 
| 
       30 
     | 
    
         
            -
                this._doInAllActiveSectors("_getNodesOverlappingWith",object,overlappingNodes);
         
     | 
| 
       31 
     | 
    
         
            -
                return overlappingNodes;
         
     | 
| 
       32 
     | 
    
         
            -
              },
         
     | 
| 
       33 
     | 
    
         
            -
             
     | 
| 
       34 
     | 
    
         
            -
             
     | 
| 
       35 
     | 
    
         
            -
              /**
         
     | 
| 
       36 
     | 
    
         
            -
               * Return a position object in canvasspace from a single point in screenspace
         
     | 
| 
       37 
     | 
    
         
            -
               *
         
     | 
| 
       38 
     | 
    
         
            -
               * @param pointer
         
     | 
| 
       39 
     | 
    
         
            -
               * @returns {{left: number, top: number, right: number, bottom: number}}
         
     | 
| 
       40 
     | 
    
         
            -
               * @private
         
     | 
| 
       41 
     | 
    
         
            -
               */
         
     | 
| 
       42 
     | 
    
         
            -
              _pointerToPositionObject : function(pointer) {
         
     | 
| 
       43 
     | 
    
         
            -
                var x = this._XconvertDOMtoCanvas(pointer.x);
         
     | 
| 
       44 
     | 
    
         
            -
                var y = this._YconvertDOMtoCanvas(pointer.y);
         
     | 
| 
       45 
     | 
    
         
            -
             
     | 
| 
       46 
     | 
    
         
            -
                return {left:   x,
         
     | 
| 
       47 
     | 
    
         
            -
                        top:    y,
         
     | 
| 
       48 
     | 
    
         
            -
                        right:  x,
         
     | 
| 
       49 
     | 
    
         
            -
                        bottom: y};
         
     | 
| 
       50 
     | 
    
         
            -
              },
         
     | 
| 
       51 
     | 
    
         
            -
             
     | 
| 
       52 
     | 
    
         
            -
             
     | 
| 
       53 
     | 
    
         
            -
              /**
         
     | 
| 
       54 
     | 
    
         
            -
               * Get the top node at the a specific point (like a click)
         
     | 
| 
       55 
     | 
    
         
            -
               *
         
     | 
| 
       56 
     | 
    
         
            -
               * @param {{x: Number, y: Number}} pointer
         
     | 
| 
       57 
     | 
    
         
            -
               * @return {Node | null} node
         
     | 
| 
       58 
     | 
    
         
            -
               * @private
         
     | 
| 
       59 
     | 
    
         
            -
               */
         
     | 
| 
       60 
     | 
    
         
            -
              _getNodeAt : function (pointer) {
         
     | 
| 
       61 
     | 
    
         
            -
                // we first check if this is an navigation controls element
         
     | 
| 
       62 
     | 
    
         
            -
                var positionObject = this._pointerToPositionObject(pointer);
         
     | 
| 
       63 
     | 
    
         
            -
                var overlappingNodes = this._getAllNodesOverlappingWith(positionObject);
         
     | 
| 
       64 
     | 
    
         
            -
             
     | 
| 
       65 
     | 
    
         
            -
                // if there are overlapping nodes, select the last one, this is the
         
     | 
| 
       66 
     | 
    
         
            -
                // one which is drawn on top of the others
         
     | 
| 
       67 
     | 
    
         
            -
                if (overlappingNodes.length > 0) {
         
     | 
| 
       68 
     | 
    
         
            -
                   return this.nodes[overlappingNodes[overlappingNodes.length - 1]];
         
     | 
| 
       69 
     | 
    
         
            -
                }
         
     | 
| 
       70 
     | 
    
         
            -
                else {
         
     | 
| 
       71 
     | 
    
         
            -
                  return null;
         
     | 
| 
       72 
     | 
    
         
            -
                }
         
     | 
| 
       73 
     | 
    
         
            -
              },
         
     | 
| 
       74 
     | 
    
         
            -
             
     | 
| 
       75 
     | 
    
         
            -
             
     | 
| 
       76 
     | 
    
         
            -
              /**
         
     | 
| 
       77 
     | 
    
         
            -
               * retrieve all edges overlapping with given object, selector is around center
         
     | 
| 
       78 
     | 
    
         
            -
               * @param {Object} object  An object with parameters left, top, right, bottom
         
     | 
| 
       79 
     | 
    
         
            -
               * @return {Number[]}   An array with id's of the overlapping nodes
         
     | 
| 
       80 
     | 
    
         
            -
               * @private
         
     | 
| 
       81 
     | 
    
         
            -
               */
         
     | 
| 
       82 
     | 
    
         
            -
              _getEdgesOverlappingWith : function (object, overlappingEdges) {
         
     | 
| 
       83 
     | 
    
         
            -
                var edges = this.edges;
         
     | 
| 
       84 
     | 
    
         
            -
                for (var edgeId in edges) {
         
     | 
| 
       85 
     | 
    
         
            -
                  if (edges.hasOwnProperty(edgeId)) {
         
     | 
| 
       86 
     | 
    
         
            -
                    if (edges[edgeId].isOverlappingWith(object)) {
         
     | 
| 
       87 
     | 
    
         
            -
                      overlappingEdges.push(edgeId);
         
     | 
| 
       88 
     | 
    
         
            -
                    }
         
     | 
| 
       89 
     | 
    
         
            -
                  }
         
     | 
| 
       90 
     | 
    
         
            -
                }
         
     | 
| 
       91 
     | 
    
         
            -
              },
         
     | 
| 
       92 
     | 
    
         
            -
             
     | 
| 
       93 
     | 
    
         
            -
             
     | 
| 
       94 
     | 
    
         
            -
              /**
         
     | 
| 
       95 
     | 
    
         
            -
               * retrieve all nodes overlapping with given object
         
     | 
| 
       96 
     | 
    
         
            -
               * @param {Object} object  An object with parameters left, top, right, bottom
         
     | 
| 
       97 
     | 
    
         
            -
               * @return {Number[]}   An array with id's of the overlapping nodes
         
     | 
| 
       98 
     | 
    
         
            -
               * @private
         
     | 
| 
       99 
     | 
    
         
            -
               */
         
     | 
| 
       100 
     | 
    
         
            -
              _getAllEdgesOverlappingWith : function (object) {
         
     | 
| 
       101 
     | 
    
         
            -
                var overlappingEdges = [];
         
     | 
| 
       102 
     | 
    
         
            -
                this._doInAllActiveSectors("_getEdgesOverlappingWith",object,overlappingEdges);
         
     | 
| 
       103 
     | 
    
         
            -
                return overlappingEdges;
         
     | 
| 
       104 
     | 
    
         
            -
              },
         
     | 
| 
       105 
     | 
    
         
            -
             
     | 
| 
       106 
     | 
    
         
            -
              /**
         
     | 
| 
       107 
     | 
    
         
            -
               * Place holder. To implement change the _getNodeAt to a _getObjectAt. Have the _getObjectAt call
         
     | 
| 
       108 
     | 
    
         
            -
               * _getNodeAt and _getEdgesAt, then priortize the selection to user preferences.
         
     | 
| 
       109 
     | 
    
         
            -
               *
         
     | 
| 
       110 
     | 
    
         
            -
               * @param pointer
         
     | 
| 
       111 
     | 
    
         
            -
               * @returns {null}
         
     | 
| 
       112 
     | 
    
         
            -
               * @private
         
     | 
| 
       113 
     | 
    
         
            -
               */
         
     | 
| 
       114 
     | 
    
         
            -
              _getEdgeAt : function(pointer) {
         
     | 
| 
       115 
     | 
    
         
            -
                var positionObject = this._pointerToPositionObject(pointer);
         
     | 
| 
       116 
     | 
    
         
            -
                var overlappingEdges = this._getAllEdgesOverlappingWith(positionObject);
         
     | 
| 
       117 
     | 
    
         
            -
             
     | 
| 
       118 
     | 
    
         
            -
                if (overlappingEdges.length > 0) {
         
     | 
| 
       119 
     | 
    
         
            -
                  return this.edges[overlappingEdges[overlappingEdges.length - 1]];
         
     | 
| 
       120 
     | 
    
         
            -
                }
         
     | 
| 
       121 
     | 
    
         
            -
                else {
         
     | 
| 
       122 
     | 
    
         
            -
                  return null;
         
     | 
| 
       123 
     | 
    
         
            -
                }
         
     | 
| 
       124 
     | 
    
         
            -
              },
         
     | 
| 
       125 
     | 
    
         
            -
             
     | 
| 
       126 
     | 
    
         
            -
             
     | 
| 
       127 
     | 
    
         
            -
              /**
         
     | 
| 
       128 
     | 
    
         
            -
               * Add object to the selection array.
         
     | 
| 
       129 
     | 
    
         
            -
               *
         
     | 
| 
       130 
     | 
    
         
            -
               * @param obj
         
     | 
| 
       131 
     | 
    
         
            -
               * @private
         
     | 
| 
       132 
     | 
    
         
            -
               */
         
     | 
| 
       133 
     | 
    
         
            -
              _addToSelection : function(obj) {
         
     | 
| 
       134 
     | 
    
         
            -
                if (obj instanceof Node) {
         
     | 
| 
       135 
     | 
    
         
            -
                  this.selectionObj.nodes[obj.id] = obj;
         
     | 
| 
       136 
     | 
    
         
            -
                }
         
     | 
| 
       137 
     | 
    
         
            -
                else {
         
     | 
| 
       138 
     | 
    
         
            -
                  this.selectionObj.edges[obj.id] = obj;
         
     | 
| 
       139 
     | 
    
         
            -
                }
         
     | 
| 
       140 
     | 
    
         
            -
              },
         
     | 
| 
       141 
     | 
    
         
            -
             
     | 
| 
       142 
     | 
    
         
            -
              /**
         
     | 
| 
       143 
     | 
    
         
            -
               * Add object to the selection array.
         
     | 
| 
       144 
     | 
    
         
            -
               *
         
     | 
| 
       145 
     | 
    
         
            -
               * @param obj
         
     | 
| 
       146 
     | 
    
         
            -
               * @private
         
     | 
| 
       147 
     | 
    
         
            -
               */
         
     | 
| 
       148 
     | 
    
         
            -
              _addToHover : function(obj) {
         
     | 
| 
       149 
     | 
    
         
            -
                if (obj instanceof Node) {
         
     | 
| 
       150 
     | 
    
         
            -
                  this.hoverObj.nodes[obj.id] = obj;
         
     | 
| 
       151 
     | 
    
         
            -
                }
         
     | 
| 
       152 
     | 
    
         
            -
                else {
         
     | 
| 
       153 
     | 
    
         
            -
                  this.hoverObj.edges[obj.id] = obj;
         
     | 
| 
       154 
     | 
    
         
            -
                }
         
     | 
| 
       155 
     | 
    
         
            -
              },
         
     | 
| 
       156 
     | 
    
         
            -
             
     | 
| 
       157 
     | 
    
         
            -
             
     | 
| 
       158 
     | 
    
         
            -
              /**
         
     | 
| 
       159 
     | 
    
         
            -
               * Remove a single option from selection.
         
     | 
| 
       160 
     | 
    
         
            -
               *
         
     | 
| 
       161 
     | 
    
         
            -
               * @param {Object} obj
         
     | 
| 
       162 
     | 
    
         
            -
               * @private
         
     | 
| 
       163 
     | 
    
         
            -
               */
         
     | 
| 
       164 
     | 
    
         
            -
              _removeFromSelection : function(obj) {
         
     | 
| 
       165 
     | 
    
         
            -
                if (obj instanceof Node) {
         
     | 
| 
       166 
     | 
    
         
            -
                  delete this.selectionObj.nodes[obj.id];
         
     | 
| 
       167 
     | 
    
         
            -
                }
         
     | 
| 
       168 
     | 
    
         
            -
                else {
         
     | 
| 
       169 
     | 
    
         
            -
                  delete this.selectionObj.edges[obj.id];
         
     | 
| 
       170 
     | 
    
         
            -
                }
         
     | 
| 
       171 
     | 
    
         
            -
              },
         
     | 
| 
       172 
     | 
    
         
            -
             
     | 
| 
       173 
     | 
    
         
            -
              /**
         
     | 
| 
       174 
     | 
    
         
            -
               * Unselect all. The selectionObj is useful for this.
         
     | 
| 
       175 
     | 
    
         
            -
               *
         
     | 
| 
       176 
     | 
    
         
            -
               * @param {Boolean} [doNotTrigger] | ignore trigger
         
     | 
| 
       177 
     | 
    
         
            -
               * @private
         
     | 
| 
       178 
     | 
    
         
            -
               */
         
     | 
| 
       179 
     | 
    
         
            -
              _unselectAll : function(doNotTrigger) {
         
     | 
| 
       180 
     | 
    
         
            -
                if (doNotTrigger === undefined) {
         
     | 
| 
       181 
     | 
    
         
            -
                  doNotTrigger = false;
         
     | 
| 
       182 
     | 
    
         
            -
                }
         
     | 
| 
       183 
     | 
    
         
            -
                for(var nodeId in this.selectionObj.nodes) {
         
     | 
| 
       184 
     | 
    
         
            -
                  if(this.selectionObj.nodes.hasOwnProperty(nodeId)) {
         
     | 
| 
       185 
     | 
    
         
            -
                    this.selectionObj.nodes[nodeId].unselect();
         
     | 
| 
       186 
     | 
    
         
            -
                  }
         
     | 
| 
       187 
     | 
    
         
            -
                }
         
     | 
| 
       188 
     | 
    
         
            -
                for(var edgeId in this.selectionObj.edges) {
         
     | 
| 
       189 
     | 
    
         
            -
                  if(this.selectionObj.edges.hasOwnProperty(edgeId)) {
         
     | 
| 
       190 
     | 
    
         
            -
                    this.selectionObj.edges[edgeId].unselect();
         
     | 
| 
       191 
     | 
    
         
            -
                  }
         
     | 
| 
       192 
     | 
    
         
            -
                }
         
     | 
| 
       193 
     | 
    
         
            -
             
     | 
| 
       194 
     | 
    
         
            -
                this.selectionObj = {nodes:{},edges:{}};
         
     | 
| 
       195 
     | 
    
         
            -
             
     | 
| 
       196 
     | 
    
         
            -
                if (doNotTrigger == false) {
         
     | 
| 
       197 
     | 
    
         
            -
                  this.emit('select', this.getSelection());
         
     | 
| 
       198 
     | 
    
         
            -
                }
         
     | 
| 
       199 
     | 
    
         
            -
              },
         
     | 
| 
       200 
     | 
    
         
            -
             
     | 
| 
       201 
     | 
    
         
            -
              /**
         
     | 
| 
       202 
     | 
    
         
            -
               * Unselect all clusters. The selectionObj is useful for this.
         
     | 
| 
       203 
     | 
    
         
            -
               *
         
     | 
| 
       204 
     | 
    
         
            -
               * @param {Boolean} [doNotTrigger] | ignore trigger
         
     | 
| 
       205 
     | 
    
         
            -
               * @private
         
     | 
| 
       206 
     | 
    
         
            -
               */
         
     | 
| 
       207 
     | 
    
         
            -
              _unselectClusters : function(doNotTrigger) {
         
     | 
| 
       208 
     | 
    
         
            -
                if (doNotTrigger === undefined) {
         
     | 
| 
       209 
     | 
    
         
            -
                  doNotTrigger = false;
         
     | 
| 
       210 
     | 
    
         
            -
                }
         
     | 
| 
       211 
     | 
    
         
            -
             
     | 
| 
       212 
     | 
    
         
            -
                for (var nodeId in this.selectionObj.nodes) {
         
     | 
| 
       213 
     | 
    
         
            -
                  if (this.selectionObj.nodes.hasOwnProperty(nodeId)) {
         
     | 
| 
       214 
     | 
    
         
            -
                    if (this.selectionObj.nodes[nodeId].clusterSize > 1) {
         
     | 
| 
       215 
     | 
    
         
            -
                      this.selectionObj.nodes[nodeId].unselect();
         
     | 
| 
       216 
     | 
    
         
            -
                      this._removeFromSelection(this.selectionObj.nodes[nodeId]);
         
     | 
| 
       217 
     | 
    
         
            -
                    }
         
     | 
| 
       218 
     | 
    
         
            -
                  }
         
     | 
| 
       219 
     | 
    
         
            -
                }
         
     | 
| 
       220 
     | 
    
         
            -
             
     | 
| 
       221 
     | 
    
         
            -
                if (doNotTrigger == false) {
         
     | 
| 
       222 
     | 
    
         
            -
                  this.emit('select', this.getSelection());
         
     | 
| 
       223 
     | 
    
         
            -
                }
         
     | 
| 
       224 
     | 
    
         
            -
              },
         
     | 
| 
       225 
     | 
    
         
            -
             
     | 
| 
       226 
     | 
    
         
            -
             
     | 
| 
       227 
     | 
    
         
            -
              /**
         
     | 
| 
       228 
     | 
    
         
            -
               * return the number of selected nodes
         
     | 
| 
       229 
     | 
    
         
            -
               *
         
     | 
| 
       230 
     | 
    
         
            -
               * @returns {number}
         
     | 
| 
       231 
     | 
    
         
            -
               * @private
         
     | 
| 
       232 
     | 
    
         
            -
               */
         
     | 
| 
       233 
     | 
    
         
            -
              _getSelectedNodeCount : function() {
         
     | 
| 
       234 
     | 
    
         
            -
                var count = 0;
         
     | 
| 
       235 
     | 
    
         
            -
                for (var nodeId in this.selectionObj.nodes) {
         
     | 
| 
       236 
     | 
    
         
            -
                  if (this.selectionObj.nodes.hasOwnProperty(nodeId)) {
         
     | 
| 
       237 
     | 
    
         
            -
                    count += 1;
         
     | 
| 
       238 
     | 
    
         
            -
                  }
         
     | 
| 
       239 
     | 
    
         
            -
                }
         
     | 
| 
       240 
     | 
    
         
            -
                return count;
         
     | 
| 
       241 
     | 
    
         
            -
              },
         
     | 
| 
       242 
     | 
    
         
            -
             
     | 
| 
       243 
     | 
    
         
            -
              /**
         
     | 
| 
       244 
     | 
    
         
            -
               * return the selected node
         
     | 
| 
       245 
     | 
    
         
            -
               *
         
     | 
| 
       246 
     | 
    
         
            -
               * @returns {number}
         
     | 
| 
       247 
     | 
    
         
            -
               * @private
         
     | 
| 
       248 
     | 
    
         
            -
               */
         
     | 
| 
       249 
     | 
    
         
            -
              _getSelectedNode : function() {
         
     | 
| 
       250 
     | 
    
         
            -
                for (var nodeId in this.selectionObj.nodes) {
         
     | 
| 
       251 
     | 
    
         
            -
                  if (this.selectionObj.nodes.hasOwnProperty(nodeId)) {
         
     | 
| 
       252 
     | 
    
         
            -
                    return this.selectionObj.nodes[nodeId];
         
     | 
| 
       253 
     | 
    
         
            -
                  }
         
     | 
| 
       254 
     | 
    
         
            -
                }
         
     | 
| 
       255 
     | 
    
         
            -
                return null;
         
     | 
| 
       256 
     | 
    
         
            -
              },
         
     | 
| 
       257 
     | 
    
         
            -
             
     | 
| 
       258 
     | 
    
         
            -
              /**
         
     | 
| 
       259 
     | 
    
         
            -
               * return the selected edge
         
     | 
| 
       260 
     | 
    
         
            -
               *
         
     | 
| 
       261 
     | 
    
         
            -
               * @returns {number}
         
     | 
| 
       262 
     | 
    
         
            -
               * @private
         
     | 
| 
       263 
     | 
    
         
            -
               */
         
     | 
| 
       264 
     | 
    
         
            -
              _getSelectedEdge : function() {
         
     | 
| 
       265 
     | 
    
         
            -
                for (var edgeId in this.selectionObj.edges) {
         
     | 
| 
       266 
     | 
    
         
            -
                  if (this.selectionObj.edges.hasOwnProperty(edgeId)) {
         
     | 
| 
       267 
     | 
    
         
            -
                    return this.selectionObj.edges[edgeId];
         
     | 
| 
       268 
     | 
    
         
            -
                  }
         
     | 
| 
       269 
     | 
    
         
            -
                }
         
     | 
| 
       270 
     | 
    
         
            -
                return null;
         
     | 
| 
       271 
     | 
    
         
            -
              },
         
     | 
| 
       272 
     | 
    
         
            -
             
     | 
| 
       273 
     | 
    
         
            -
             
     | 
| 
       274 
     | 
    
         
            -
              /**
         
     | 
| 
       275 
     | 
    
         
            -
               * return the number of selected edges
         
     | 
| 
       276 
     | 
    
         
            -
               *
         
     | 
| 
       277 
     | 
    
         
            -
               * @returns {number}
         
     | 
| 
       278 
     | 
    
         
            -
               * @private
         
     | 
| 
       279 
     | 
    
         
            -
               */
         
     | 
| 
       280 
     | 
    
         
            -
              _getSelectedEdgeCount : function() {
         
     | 
| 
       281 
     | 
    
         
            -
                var count = 0;
         
     | 
| 
       282 
     | 
    
         
            -
                for (var edgeId in this.selectionObj.edges) {
         
     | 
| 
       283 
     | 
    
         
            -
                  if (this.selectionObj.edges.hasOwnProperty(edgeId)) {
         
     | 
| 
       284 
     | 
    
         
            -
                    count += 1;
         
     | 
| 
       285 
     | 
    
         
            -
                  }
         
     | 
| 
       286 
     | 
    
         
            -
                }
         
     | 
| 
       287 
     | 
    
         
            -
                return count;
         
     | 
| 
       288 
     | 
    
         
            -
              },
         
     | 
| 
       289 
     | 
    
         
            -
             
     | 
| 
       290 
     | 
    
         
            -
             
     | 
| 
       291 
     | 
    
         
            -
              /**
         
     | 
| 
       292 
     | 
    
         
            -
               * return the number of selected objects.
         
     | 
| 
       293 
     | 
    
         
            -
               *
         
     | 
| 
       294 
     | 
    
         
            -
               * @returns {number}
         
     | 
| 
       295 
     | 
    
         
            -
               * @private
         
     | 
| 
       296 
     | 
    
         
            -
               */
         
     | 
| 
       297 
     | 
    
         
            -
              _getSelectedObjectCount : function() {
         
     | 
| 
       298 
     | 
    
         
            -
                var count = 0;
         
     | 
| 
       299 
     | 
    
         
            -
                for(var nodeId in this.selectionObj.nodes) {
         
     | 
| 
       300 
     | 
    
         
            -
                  if(this.selectionObj.nodes.hasOwnProperty(nodeId)) {
         
     | 
| 
       301 
     | 
    
         
            -
                    count += 1;
         
     | 
| 
       302 
     | 
    
         
            -
                  }
         
     | 
| 
       303 
     | 
    
         
            -
                }
         
     | 
| 
       304 
     | 
    
         
            -
                for(var edgeId in this.selectionObj.edges) {
         
     | 
| 
       305 
     | 
    
         
            -
                  if(this.selectionObj.edges.hasOwnProperty(edgeId)) {
         
     | 
| 
       306 
     | 
    
         
            -
                    count += 1;
         
     | 
| 
       307 
     | 
    
         
            -
                  }
         
     | 
| 
       308 
     | 
    
         
            -
                }
         
     | 
| 
       309 
     | 
    
         
            -
                return count;
         
     | 
| 
       310 
     | 
    
         
            -
              },
         
     | 
| 
       311 
     | 
    
         
            -
             
     | 
| 
       312 
     | 
    
         
            -
              /**
         
     | 
| 
       313 
     | 
    
         
            -
               * Check if anything is selected
         
     | 
| 
       314 
     | 
    
         
            -
               *
         
     | 
| 
       315 
     | 
    
         
            -
               * @returns {boolean}
         
     | 
| 
       316 
     | 
    
         
            -
               * @private
         
     | 
| 
       317 
     | 
    
         
            -
               */
         
     | 
| 
       318 
     | 
    
         
            -
              _selectionIsEmpty : function() {
         
     | 
| 
       319 
     | 
    
         
            -
                for(var nodeId in this.selectionObj.nodes) {
         
     | 
| 
       320 
     | 
    
         
            -
                  if(this.selectionObj.nodes.hasOwnProperty(nodeId)) {
         
     | 
| 
       321 
     | 
    
         
            -
                    return false;
         
     | 
| 
       322 
     | 
    
         
            -
                  }
         
     | 
| 
       323 
     | 
    
         
            -
                }
         
     | 
| 
       324 
     | 
    
         
            -
                for(var edgeId in this.selectionObj.edges) {
         
     | 
| 
       325 
     | 
    
         
            -
                  if(this.selectionObj.edges.hasOwnProperty(edgeId)) {
         
     | 
| 
       326 
     | 
    
         
            -
                    return false;
         
     | 
| 
       327 
     | 
    
         
            -
                  }
         
     | 
| 
       328 
     | 
    
         
            -
                }
         
     | 
| 
       329 
     | 
    
         
            -
                return true;
         
     | 
| 
       330 
     | 
    
         
            -
              },
         
     | 
| 
       331 
     | 
    
         
            -
             
     | 
| 
       332 
     | 
    
         
            -
             
     | 
| 
       333 
     | 
    
         
            -
              /**
         
     | 
| 
       334 
     | 
    
         
            -
               * check if one of the selected nodes is a cluster.
         
     | 
| 
       335 
     | 
    
         
            -
               *
         
     | 
| 
       336 
     | 
    
         
            -
               * @returns {boolean}
         
     | 
| 
       337 
     | 
    
         
            -
               * @private
         
     | 
| 
       338 
     | 
    
         
            -
               */
         
     | 
| 
       339 
     | 
    
         
            -
              _clusterInSelection : function() {
         
     | 
| 
       340 
     | 
    
         
            -
                for(var nodeId in this.selectionObj.nodes) {
         
     | 
| 
       341 
     | 
    
         
            -
                  if(this.selectionObj.nodes.hasOwnProperty(nodeId)) {
         
     | 
| 
       342 
     | 
    
         
            -
                    if (this.selectionObj.nodes[nodeId].clusterSize > 1) {
         
     | 
| 
       343 
     | 
    
         
            -
                      return true;
         
     | 
| 
       344 
     | 
    
         
            -
                    }
         
     | 
| 
       345 
     | 
    
         
            -
                  }
         
     | 
| 
       346 
     | 
    
         
            -
                }
         
     | 
| 
       347 
     | 
    
         
            -
                return false;
         
     | 
| 
       348 
     | 
    
         
            -
              },
         
     | 
| 
       349 
     | 
    
         
            -
             
     | 
| 
       350 
     | 
    
         
            -
              /**
         
     | 
| 
       351 
     | 
    
         
            -
               * select the edges connected to the node that is being selected
         
     | 
| 
       352 
     | 
    
         
            -
               *
         
     | 
| 
       353 
     | 
    
         
            -
               * @param {Node} node
         
     | 
| 
       354 
     | 
    
         
            -
               * @private
         
     | 
| 
       355 
     | 
    
         
            -
               */
         
     | 
| 
       356 
     | 
    
         
            -
              _selectConnectedEdges : function(node) {
         
     | 
| 
       357 
     | 
    
         
            -
                for (var i = 0; i < node.dynamicEdges.length; i++) {
         
     | 
| 
       358 
     | 
    
         
            -
                  var edge = node.dynamicEdges[i];
         
     | 
| 
       359 
     | 
    
         
            -
                  edge.select();
         
     | 
| 
       360 
     | 
    
         
            -
                  this._addToSelection(edge);
         
     | 
| 
       361 
     | 
    
         
            -
                }
         
     | 
| 
       362 
     | 
    
         
            -
              },
         
     | 
| 
       363 
     | 
    
         
            -
             
     | 
| 
       364 
     | 
    
         
            -
              /**
         
     | 
| 
       365 
     | 
    
         
            -
               * select the edges connected to the node that is being selected
         
     | 
| 
       366 
     | 
    
         
            -
               *
         
     | 
| 
       367 
     | 
    
         
            -
               * @param {Node} node
         
     | 
| 
       368 
     | 
    
         
            -
               * @private
         
     | 
| 
       369 
     | 
    
         
            -
               */
         
     | 
| 
       370 
     | 
    
         
            -
              _hoverConnectedEdges : function(node) {
         
     | 
| 
       371 
     | 
    
         
            -
                for (var i = 0; i < node.dynamicEdges.length; i++) {
         
     | 
| 
       372 
     | 
    
         
            -
                  var edge = node.dynamicEdges[i];
         
     | 
| 
       373 
     | 
    
         
            -
                  edge.hover = true;
         
     | 
| 
       374 
     | 
    
         
            -
                  this._addToHover(edge);
         
     | 
| 
       375 
     | 
    
         
            -
                }
         
     | 
| 
       376 
     | 
    
         
            -
              },
         
     | 
| 
       377 
     | 
    
         
            -
             
     | 
| 
       378 
     | 
    
         
            -
             
     | 
| 
       379 
     | 
    
         
            -
              /**
         
     | 
| 
       380 
     | 
    
         
            -
               * unselect the edges connected to the node that is being selected
         
     | 
| 
       381 
     | 
    
         
            -
               *
         
     | 
| 
       382 
     | 
    
         
            -
               * @param {Node} node
         
     | 
| 
       383 
     | 
    
         
            -
               * @private
         
     | 
| 
       384 
     | 
    
         
            -
               */
         
     | 
| 
       385 
     | 
    
         
            -
              _unselectConnectedEdges : function(node) {
         
     | 
| 
       386 
     | 
    
         
            -
                for (var i = 0; i < node.dynamicEdges.length; i++) {
         
     | 
| 
       387 
     | 
    
         
            -
                  var edge = node.dynamicEdges[i];
         
     | 
| 
       388 
     | 
    
         
            -
                  edge.unselect();
         
     | 
| 
       389 
     | 
    
         
            -
                  this._removeFromSelection(edge);
         
     | 
| 
       390 
     | 
    
         
            -
                }
         
     | 
| 
       391 
     | 
    
         
            -
              },
         
     | 
| 
       392 
     | 
    
         
            -
             
     | 
| 
       393 
     | 
    
         
            -
             
     | 
| 
       394 
     | 
    
         
            -
             
     | 
| 
       395 
     | 
    
         
            -
             
     | 
| 
       396 
     | 
    
         
            -
              /**
         
     | 
| 
       397 
     | 
    
         
            -
               * This is called when someone clicks on a node. either select or deselect it.
         
     | 
| 
       398 
     | 
    
         
            -
               * If there is an existing selection and we don't want to append to it, clear the existing selection
         
     | 
| 
       399 
     | 
    
         
            -
               *
         
     | 
| 
       400 
     | 
    
         
            -
               * @param {Node || Edge} object
         
     | 
| 
       401 
     | 
    
         
            -
               * @param {Boolean} append
         
     | 
| 
       402 
     | 
    
         
            -
               * @param {Boolean} [doNotTrigger] | ignore trigger
         
     | 
| 
       403 
     | 
    
         
            -
               * @private
         
     | 
| 
       404 
     | 
    
         
            -
               */
         
     | 
| 
       405 
     | 
    
         
            -
              _selectObject : function(object, append, doNotTrigger) {
         
     | 
| 
       406 
     | 
    
         
            -
                if (doNotTrigger === undefined) {
         
     | 
| 
       407 
     | 
    
         
            -
                  doNotTrigger = false;
         
     | 
| 
       408 
     | 
    
         
            -
                }
         
     | 
| 
       409 
     | 
    
         
            -
             
     | 
| 
       410 
     | 
    
         
            -
                if (this._selectionIsEmpty() == false && append == false && this.forceAppendSelection == false) {
         
     | 
| 
       411 
     | 
    
         
            -
                  this._unselectAll(true);
         
     | 
| 
       412 
     | 
    
         
            -
                }
         
     | 
| 
       413 
     | 
    
         
            -
             
     | 
| 
       414 
     | 
    
         
            -
                if (object.selected == false) {
         
     | 
| 
       415 
     | 
    
         
            -
                  object.select();
         
     | 
| 
       416 
     | 
    
         
            -
                  this._addToSelection(object);
         
     | 
| 
       417 
     | 
    
         
            -
                  if (object instanceof Node && this.blockConnectingEdgeSelection == false) {
         
     | 
| 
       418 
     | 
    
         
            -
                    this._selectConnectedEdges(object);
         
     | 
| 
       419 
     | 
    
         
            -
                  }
         
     | 
| 
       420 
     | 
    
         
            -
                }
         
     | 
| 
       421 
     | 
    
         
            -
                else {
         
     | 
| 
       422 
     | 
    
         
            -
                  object.unselect();
         
     | 
| 
       423 
     | 
    
         
            -
                  this._removeFromSelection(object);
         
     | 
| 
       424 
     | 
    
         
            -
                }
         
     | 
| 
       425 
     | 
    
         
            -
             
     | 
| 
       426 
     | 
    
         
            -
                if (doNotTrigger == false) {
         
     | 
| 
       427 
     | 
    
         
            -
                  this.emit('select', this.getSelection());
         
     | 
| 
       428 
     | 
    
         
            -
                }
         
     | 
| 
       429 
     | 
    
         
            -
              },
         
     | 
| 
       430 
     | 
    
         
            -
             
     | 
| 
       431 
     | 
    
         
            -
             
     | 
| 
       432 
     | 
    
         
            -
              /**
         
     | 
| 
       433 
     | 
    
         
            -
               * This is called when someone clicks on a node. either select or deselect it.
         
     | 
| 
       434 
     | 
    
         
            -
               * If there is an existing selection and we don't want to append to it, clear the existing selection
         
     | 
| 
       435 
     | 
    
         
            -
               *
         
     | 
| 
       436 
     | 
    
         
            -
               * @param {Node || Edge} object
         
     | 
| 
       437 
     | 
    
         
            -
               * @private
         
     | 
| 
       438 
     | 
    
         
            -
               */
         
     | 
| 
       439 
     | 
    
         
            -
              _blurObject : function(object) {
         
     | 
| 
       440 
     | 
    
         
            -
                if (object.hover == true) {
         
     | 
| 
       441 
     | 
    
         
            -
                  object.hover = false;
         
     | 
| 
       442 
     | 
    
         
            -
                  this.emit("blurNode",{node:object.id});
         
     | 
| 
       443 
     | 
    
         
            -
                }
         
     | 
| 
       444 
     | 
    
         
            -
              },
         
     | 
| 
       445 
     | 
    
         
            -
             
     | 
| 
       446 
     | 
    
         
            -
              /**
         
     | 
| 
       447 
     | 
    
         
            -
               * This is called when someone clicks on a node. either select or deselect it.
         
     | 
| 
       448 
     | 
    
         
            -
               * If there is an existing selection and we don't want to append to it, clear the existing selection
         
     | 
| 
       449 
     | 
    
         
            -
               *
         
     | 
| 
       450 
     | 
    
         
            -
               * @param {Node || Edge} object
         
     | 
| 
       451 
     | 
    
         
            -
               * @private
         
     | 
| 
       452 
     | 
    
         
            -
               */
         
     | 
| 
       453 
     | 
    
         
            -
              _hoverObject : function(object) {
         
     | 
| 
       454 
     | 
    
         
            -
                if (object.hover == false) {
         
     | 
| 
       455 
     | 
    
         
            -
                  object.hover = true;
         
     | 
| 
       456 
     | 
    
         
            -
                  this._addToHover(object);
         
     | 
| 
       457 
     | 
    
         
            -
                  if (object instanceof Node) {
         
     | 
| 
       458 
     | 
    
         
            -
                    this.emit("hoverNode",{node:object.id});
         
     | 
| 
       459 
     | 
    
         
            -
                  }
         
     | 
| 
       460 
     | 
    
         
            -
                }
         
     | 
| 
       461 
     | 
    
         
            -
                if (object instanceof Node) {
         
     | 
| 
       462 
     | 
    
         
            -
                  this._hoverConnectedEdges(object);
         
     | 
| 
       463 
     | 
    
         
            -
                }
         
     | 
| 
       464 
     | 
    
         
            -
              },
         
     | 
| 
       465 
     | 
    
         
            -
             
     | 
| 
       466 
     | 
    
         
            -
             
     | 
| 
       467 
     | 
    
         
            -
              /**
         
     | 
| 
       468 
     | 
    
         
            -
               * handles the selection part of the touch, only for navigation controls elements;
         
     | 
| 
       469 
     | 
    
         
            -
               * Touch is triggered before tap, also before hold. Hold triggers after a while.
         
     | 
| 
       470 
     | 
    
         
            -
               * This is the most responsive solution
         
     | 
| 
       471 
     | 
    
         
            -
               *
         
     | 
| 
       472 
     | 
    
         
            -
               * @param {Object} pointer
         
     | 
| 
       473 
     | 
    
         
            -
               * @private
         
     | 
| 
       474 
     | 
    
         
            -
               */
         
     | 
| 
       475 
     | 
    
         
            -
              _handleTouch : function(pointer) {
         
     | 
| 
       476 
     | 
    
         
            -
              },
         
     | 
| 
       477 
     | 
    
         
            -
             
     | 
| 
       478 
     | 
    
         
            -
             
     | 
| 
       479 
     | 
    
         
            -
              /**
         
     | 
| 
       480 
     | 
    
         
            -
               * handles the selection part of the tap;
         
     | 
| 
       481 
     | 
    
         
            -
               *
         
     | 
| 
       482 
     | 
    
         
            -
               * @param {Object} pointer
         
     | 
| 
       483 
     | 
    
         
            -
               * @private
         
     | 
| 
       484 
     | 
    
         
            -
               */
         
     | 
| 
       485 
     | 
    
         
            -
              _handleTap : function(pointer) {
         
     | 
| 
       486 
     | 
    
         
            -
                var node = this._getNodeAt(pointer);
         
     | 
| 
       487 
     | 
    
         
            -
                if (node != null) {
         
     | 
| 
       488 
     | 
    
         
            -
                  this._selectObject(node,false);
         
     | 
| 
       489 
     | 
    
         
            -
                }
         
     | 
| 
       490 
     | 
    
         
            -
                else {
         
     | 
| 
       491 
     | 
    
         
            -
                  var edge = this._getEdgeAt(pointer);
         
     | 
| 
       492 
     | 
    
         
            -
                  if (edge != null) {
         
     | 
| 
       493 
     | 
    
         
            -
                    this._selectObject(edge,false);
         
     | 
| 
       494 
     | 
    
         
            -
                  }
         
     | 
| 
       495 
     | 
    
         
            -
                  else {
         
     | 
| 
       496 
     | 
    
         
            -
                    this._unselectAll();
         
     | 
| 
       497 
     | 
    
         
            -
                  }
         
     | 
| 
       498 
     | 
    
         
            -
                }
         
     | 
| 
       499 
     | 
    
         
            -
                this.emit("click", this.getSelection());
         
     | 
| 
       500 
     | 
    
         
            -
                this._redraw();
         
     | 
| 
       501 
     | 
    
         
            -
              },
         
     | 
| 
       502 
     | 
    
         
            -
             
     | 
| 
       503 
     | 
    
         
            -
             
     | 
| 
       504 
     | 
    
         
            -
              /**
         
     | 
| 
       505 
     | 
    
         
            -
               * handles the selection part of the double tap and opens a cluster if needed
         
     | 
| 
       506 
     | 
    
         
            -
               *
         
     | 
| 
       507 
     | 
    
         
            -
               * @param {Object} pointer
         
     | 
| 
       508 
     | 
    
         
            -
               * @private
         
     | 
| 
       509 
     | 
    
         
            -
               */
         
     | 
| 
       510 
     | 
    
         
            -
              _handleDoubleTap : function(pointer) {
         
     | 
| 
       511 
     | 
    
         
            -
                var node = this._getNodeAt(pointer);
         
     | 
| 
       512 
     | 
    
         
            -
                if (node != null && node !== undefined) {
         
     | 
| 
       513 
     | 
    
         
            -
                  // we reset the areaCenter here so the opening of the node will occur
         
     | 
| 
       514 
     | 
    
         
            -
                  this.areaCenter =  {"x" : this._XconvertDOMtoCanvas(pointer.x),
         
     | 
| 
       515 
     | 
    
         
            -
                                      "y" : this._YconvertDOMtoCanvas(pointer.y)};
         
     | 
| 
       516 
     | 
    
         
            -
                  this.openCluster(node);
         
     | 
| 
       517 
     | 
    
         
            -
                }
         
     | 
| 
       518 
     | 
    
         
            -
                this.emit("doubleClick", this.getSelection());
         
     | 
| 
       519 
     | 
    
         
            -
              },
         
     | 
| 
       520 
     | 
    
         
            -
             
     | 
| 
       521 
     | 
    
         
            -
             
     | 
| 
       522 
     | 
    
         
            -
              /**
         
     | 
| 
       523 
     | 
    
         
            -
               * Handle the onHold selection part
         
     | 
| 
       524 
     | 
    
         
            -
               *
         
     | 
| 
       525 
     | 
    
         
            -
               * @param pointer
         
     | 
| 
       526 
     | 
    
         
            -
               * @private
         
     | 
| 
       527 
     | 
    
         
            -
               */
         
     | 
| 
       528 
     | 
    
         
            -
              _handleOnHold : function(pointer) {
         
     | 
| 
       529 
     | 
    
         
            -
                var node = this._getNodeAt(pointer);
         
     | 
| 
       530 
     | 
    
         
            -
                if (node != null) {
         
     | 
| 
       531 
     | 
    
         
            -
                  this._selectObject(node,true);
         
     | 
| 
       532 
     | 
    
         
            -
                }
         
     | 
| 
       533 
     | 
    
         
            -
                else {
         
     | 
| 
       534 
     | 
    
         
            -
                  var edge = this._getEdgeAt(pointer);
         
     | 
| 
       535 
     | 
    
         
            -
                  if (edge != null) {
         
     | 
| 
       536 
     | 
    
         
            -
                    this._selectObject(edge,true);
         
     | 
| 
       537 
     | 
    
         
            -
                  }
         
     | 
| 
       538 
     | 
    
         
            -
                }
         
     | 
| 
       539 
     | 
    
         
            -
                this._redraw();
         
     | 
| 
       540 
     | 
    
         
            -
              },
         
     | 
| 
       541 
     | 
    
         
            -
             
     | 
| 
       542 
     | 
    
         
            -
             
     | 
| 
       543 
     | 
    
         
            -
              /**
         
     | 
| 
       544 
     | 
    
         
            -
               * handle the onRelease event. These functions are here for the navigation controls module.
         
     | 
| 
       545 
     | 
    
         
            -
               *
         
     | 
| 
       546 
     | 
    
         
            -
                * @private
         
     | 
| 
       547 
     | 
    
         
            -
               */
         
     | 
| 
       548 
     | 
    
         
            -
              _handleOnRelease : function(pointer) {
         
     | 
| 
       549 
     | 
    
         
            -
             
     | 
| 
       550 
     | 
    
         
            -
              },
         
     | 
| 
       551 
     | 
    
         
            -
             
     | 
| 
       552 
     | 
    
         
            -
             
     | 
| 
       553 
     | 
    
         
            -
             
     | 
| 
       554 
     | 
    
         
            -
              /**
         
     | 
| 
       555 
     | 
    
         
            -
               *
         
     | 
| 
       556 
     | 
    
         
            -
               * retrieve the currently selected objects
         
     | 
| 
       557 
     | 
    
         
            -
               * @return {Number[] | String[]} selection    An array with the ids of the
         
     | 
| 
       558 
     | 
    
         
            -
               *                                            selected nodes.
         
     | 
| 
       559 
     | 
    
         
            -
               */
         
     | 
| 
       560 
     | 
    
         
            -
              getSelection : function() {
         
     | 
| 
       561 
     | 
    
         
            -
                var nodeIds = this.getSelectedNodes();
         
     | 
| 
       562 
     | 
    
         
            -
                var edgeIds = this.getSelectedEdges();
         
     | 
| 
       563 
     | 
    
         
            -
                return {nodes:nodeIds, edges:edgeIds};
         
     | 
| 
       564 
     | 
    
         
            -
              },
         
     | 
| 
       565 
     | 
    
         
            -
             
     | 
| 
       566 
     | 
    
         
            -
              /**
         
     | 
| 
       567 
     | 
    
         
            -
               *
         
     | 
| 
       568 
     | 
    
         
            -
               * retrieve the currently selected nodes
         
     | 
| 
       569 
     | 
    
         
            -
               * @return {String} selection    An array with the ids of the
         
     | 
| 
       570 
     | 
    
         
            -
               *                                            selected nodes.
         
     | 
| 
       571 
     | 
    
         
            -
               */
         
     | 
| 
       572 
     | 
    
         
            -
              getSelectedNodes : function() {
         
     | 
| 
       573 
     | 
    
         
            -
                var idArray = [];
         
     | 
| 
       574 
     | 
    
         
            -
                for(var nodeId in this.selectionObj.nodes) {
         
     | 
| 
       575 
     | 
    
         
            -
                  if(this.selectionObj.nodes.hasOwnProperty(nodeId)) {
         
     | 
| 
       576 
     | 
    
         
            -
                    idArray.push(nodeId);
         
     | 
| 
       577 
     | 
    
         
            -
                  }
         
     | 
| 
       578 
     | 
    
         
            -
                }
         
     | 
| 
       579 
     | 
    
         
            -
                return idArray
         
     | 
| 
       580 
     | 
    
         
            -
              },
         
     | 
| 
       581 
     | 
    
         
            -
             
     | 
| 
       582 
     | 
    
         
            -
              /**
         
     | 
| 
       583 
     | 
    
         
            -
               *
         
     | 
| 
       584 
     | 
    
         
            -
               * retrieve the currently selected edges
         
     | 
| 
       585 
     | 
    
         
            -
               * @return {Array} selection    An array with the ids of the
         
     | 
| 
       586 
     | 
    
         
            -
               *                                            selected nodes.
         
     | 
| 
       587 
     | 
    
         
            -
               */
         
     | 
| 
       588 
     | 
    
         
            -
              getSelectedEdges : function() {
         
     | 
| 
       589 
     | 
    
         
            -
                var idArray = [];
         
     | 
| 
       590 
     | 
    
         
            -
                for(var edgeId in this.selectionObj.edges) {
         
     | 
| 
       591 
     | 
    
         
            -
                  if(this.selectionObj.edges.hasOwnProperty(edgeId)) {
         
     | 
| 
       592 
     | 
    
         
            -
                    idArray.push(edgeId);
         
     | 
| 
       593 
     | 
    
         
            -
                  }
         
     | 
| 
       594 
     | 
    
         
            -
                }
         
     | 
| 
       595 
     | 
    
         
            -
                return idArray;
         
     | 
| 
       596 
     | 
    
         
            -
              },
         
     | 
| 
       597 
     | 
    
         
            -
             
     | 
| 
       598 
     | 
    
         
            -
             
     | 
| 
       599 
     | 
    
         
            -
              /**
         
     | 
| 
       600 
     | 
    
         
            -
               * select zero or more nodes
         
     | 
| 
       601 
     | 
    
         
            -
               * @param {Number[] | String[]} selection     An array with the ids of the
         
     | 
| 
       602 
     | 
    
         
            -
               *                                            selected nodes.
         
     | 
| 
       603 
     | 
    
         
            -
               */
         
     | 
| 
       604 
     | 
    
         
            -
              setSelection : function(selection) {
         
     | 
| 
       605 
     | 
    
         
            -
                var i, iMax, id;
         
     | 
| 
       606 
     | 
    
         
            -
             
     | 
| 
       607 
     | 
    
         
            -
                if (!selection || (selection.length == undefined))
         
     | 
| 
       608 
     | 
    
         
            -
                  throw 'Selection must be an array with ids';
         
     | 
| 
       609 
     | 
    
         
            -
             
     | 
| 
       610 
     | 
    
         
            -
                // first unselect any selected node
         
     | 
| 
       611 
     | 
    
         
            -
                this._unselectAll(true);
         
     | 
| 
       612 
     | 
    
         
            -
             
     | 
| 
       613 
     | 
    
         
            -
                for (i = 0, iMax = selection.length; i < iMax; i++) {
         
     | 
| 
       614 
     | 
    
         
            -
                  id = selection[i];
         
     | 
| 
       615 
     | 
    
         
            -
             
     | 
| 
       616 
     | 
    
         
            -
                  var node = this.nodes[id];
         
     | 
| 
       617 
     | 
    
         
            -
                  if (!node) {
         
     | 
| 
       618 
     | 
    
         
            -
                    throw new RangeError('Node with id "' + id + '" not found');
         
     | 
| 
       619 
     | 
    
         
            -
                  }
         
     | 
| 
       620 
     | 
    
         
            -
                  this._selectObject(node,true,true);
         
     | 
| 
       621 
     | 
    
         
            -
                }
         
     | 
| 
       622 
     | 
    
         
            -
                this.redraw();
         
     | 
| 
       623 
     | 
    
         
            -
              },
         
     | 
| 
       624 
     | 
    
         
            -
             
     | 
| 
       625 
     | 
    
         
            -
             
     | 
| 
       626 
     | 
    
         
            -
              /**
         
     | 
| 
       627 
     | 
    
         
            -
               * Validate the selection: remove ids of nodes which no longer exist
         
     | 
| 
       628 
     | 
    
         
            -
               * @private
         
     | 
| 
       629 
     | 
    
         
            -
               */
         
     | 
| 
       630 
     | 
    
         
            -
              _updateSelection : function () {
         
     | 
| 
       631 
     | 
    
         
            -
                for(var nodeId in this.selectionObj.nodes) {
         
     | 
| 
       632 
     | 
    
         
            -
                  if(this.selectionObj.nodes.hasOwnProperty(nodeId)) {
         
     | 
| 
       633 
     | 
    
         
            -
                    if (!this.nodes.hasOwnProperty(nodeId)) {
         
     | 
| 
       634 
     | 
    
         
            -
                      delete this.selectionObj.nodes[nodeId];
         
     | 
| 
       635 
     | 
    
         
            -
                    }
         
     | 
| 
       636 
     | 
    
         
            -
                  }
         
     | 
| 
       637 
     | 
    
         
            -
                }
         
     | 
| 
       638 
     | 
    
         
            -
                for(var edgeId in this.selectionObj.edges) {
         
     | 
| 
       639 
     | 
    
         
            -
                  if(this.selectionObj.edges.hasOwnProperty(edgeId)) {
         
     | 
| 
       640 
     | 
    
         
            -
                    if (!this.edges.hasOwnProperty(edgeId)) {
         
     | 
| 
       641 
     | 
    
         
            -
                      delete this.selectionObj.edges[edgeId];
         
     | 
| 
       642 
     | 
    
         
            -
                    }
         
     | 
| 
       643 
     | 
    
         
            -
                  }
         
     | 
| 
       644 
     | 
    
         
            -
                }
         
     | 
| 
       645 
     | 
    
         
            -
              }
         
     | 
| 
       646 
     | 
    
         
            -
            };
         
     | 
| 
       647 
     | 
    
         
            -
             
     | 
| 
       648 
     | 
    
         
            -
             
     |