cytoscape-edgehandles
Advanced tools
Comparing version 3.1.2 to 3.2.0
@@ -182,5 +182,3 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
if (node.same(_this.handleNode)) { | ||
_this.hide(); | ||
} else { | ||
if (!node.same(_this.handleNode)) { | ||
_this.show(node); | ||
@@ -232,2 +230,9 @@ } | ||
// hide handle if source node is removed | ||
this.addListener(cy, 'remove', function (e) { | ||
if (e.target.same(_this.sourceNode)) { | ||
_this.hide(); | ||
} | ||
}); | ||
return this; | ||
@@ -250,3 +255,5 @@ } | ||
handleNodes: 'node', // selector/filter function for whether edges can be made from a given node | ||
handlePosition: 'middle top', // sets the position of the handle in the format of "X-AXIS Y-AXIS" such as "left top", "middle top" | ||
handlePosition: function handlePosition(node) { | ||
return 'middle top'; // sets the position of the handle in the format of "X-AXIS Y-AXIS" such as "left top", "middle top" | ||
}, | ||
handleInDrawMode: false, // whether to show the handle in draw mode | ||
@@ -365,2 +372,4 @@ edgeType: function edgeType(sourceNode, targetNode) { | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
var assign = __webpack_require__(0); | ||
@@ -512,2 +521,6 @@ | ||
var handlePosition = _typeof(options.handlePosition) === _typeof('') ? function () { | ||
return options.handlePosition; | ||
} : options.handlePosition; | ||
var p = node.position(); | ||
@@ -521,4 +534,4 @@ var h = node.outerHeight(); | ||
// grab axis's | ||
var axes = options.handlePosition.toLowerCase().split(' '); | ||
// grab axes | ||
var axes = handlePosition(node).toLowerCase().split(/\s+/); | ||
var axisX = axes[0]; | ||
@@ -843,3 +856,2 @@ var axisY = axes[1]; | ||
targetNode = this.targetNode, | ||
handleNode = this.handleNode, | ||
ghostEles = this.ghostEles, | ||
@@ -859,3 +871,4 @@ presumptiveTargets = this.presumptiveTargets; | ||
handleNode.remove(); | ||
this.removeHandle(); | ||
ghostEles.remove(); | ||
@@ -862,0 +875,0 @@ |
{ | ||
"name": "cytoscape-edgehandles", | ||
"version": "3.1.2", | ||
"version": "3.2.0", | ||
"description": "Edge creation UI extension for Cytoscape", | ||
@@ -5,0 +5,0 @@ "main": "cytoscape-edgehandles.js", |
@@ -74,3 +74,5 @@ cytoscape-edgehandles | ||
handleNodes: 'node', // selector/filter function for whether edges can be made from a given node | ||
handlePosition: 'middle top', // sets the position of the handle in the format of "X-AXIS Y-AXIS" such as "left top", "middle top" | ||
handlePosition: function( node ){ | ||
return 'middle top'; // sets the position of the handle in the format of "X-AXIS Y-AXIS" such as "left top", "middle top" | ||
}, | ||
handleInDrawMode: false, // whether to show the handle in draw mode | ||
@@ -145,3 +147,3 @@ edgeType: function( sourceNode, targetNode ){ | ||
* `start()` : manually start the gesture (as if the handle were already held) | ||
* `start( sourceNode )` : manually start the gesture (as if the handle were already held) | ||
* `stop()` : manually completes or cancels the gesture | ||
@@ -148,0 +150,0 @@ * `hide()` : remove the handle node from the graph |
@@ -17,5 +17,3 @@ function addCytoscapeListeners(){ | ||
if( node.same( this.handleNode ) ){ | ||
this.hide(); | ||
} else { | ||
if( !node.same( this.handleNode ) ){ | ||
this.show( node ); | ||
@@ -67,2 +65,9 @@ } | ||
// hide handle if source node is removed | ||
this.addListener( cy, 'remove', e => { | ||
if( e.target.same( this.sourceNode ) ){ | ||
this.hide(); | ||
} | ||
} ); | ||
return this; | ||
@@ -69,0 +74,0 @@ } |
@@ -6,3 +6,5 @@ /* eslint-disable no-unused-vars */ | ||
handleNodes: 'node', // selector/filter function for whether edges can be made from a given node | ||
handlePosition: 'middle top', // sets the position of the handle in the format of "X-AXIS Y-AXIS" such as "left top", "middle top" | ||
handlePosition: function( node ){ | ||
return 'middle top'; // sets the position of the handle in the format of "X-AXIS Y-AXIS" such as "left top", "middle top" | ||
}, | ||
handleInDrawMode: false, // whether to show the handle in draw mode | ||
@@ -9,0 +11,0 @@ edgeType: function( sourceNode, targetNode ){ |
@@ -155,2 +155,4 @@ const assign = require('../assign'); | ||
let handlePosition = typeof options.handlePosition === typeof '' ? () => options.handlePosition : options.handlePosition; | ||
let p = node.position(); | ||
@@ -164,4 +166,4 @@ let h = node.outerHeight(); | ||
// grab axis's | ||
let axes = options.handlePosition.toLowerCase().split(' '); | ||
// grab axes | ||
let axes = handlePosition( node ).toLowerCase().split(/\s+/); | ||
let axisX = axes[0]; | ||
@@ -168,0 +170,0 @@ let axisY = axes[1]; |
@@ -140,3 +140,3 @@ function canStartOn( node ){ | ||
let { sourceNode, targetNode, handleNode, ghostEles, presumptiveTargets } = this; | ||
let { sourceNode, targetNode, ghostEles, presumptiveTargets } = this; | ||
@@ -153,3 +153,4 @@ clearTimeout( this.previewTimeout ); | ||
handleNode.remove(); | ||
this.removeHandle(); | ||
ghostEles.remove(); | ||
@@ -156,0 +157,0 @@ |
121159
1559
240