cytoscape-edge-bend-editing
Advanced tools
Comparing version 1.0.2 to 1.0.3
{ | ||
"name": "cytoscape-edge-bend-editing", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "A Cytoscape.js extension enables editing edge bend points", | ||
@@ -5,0 +5,0 @@ "main": "cytoscape-edge-bend-editing.js", |
@@ -53,3 +53,5 @@ cytoscape-edge-bend-editing | ||
`ele.getSegmentPoints()` | ||
Returns the coordinates of segment points (Returns undefined is curve style is not segments). | ||
get segment points of an edge in an array A, | ||
A[2 * i] is the x coordinate and A[2 * i + 1] is the y coordinate | ||
of the ith bend point. (Returns undefined if the curve style is not segments) | ||
@@ -56,0 +58,0 @@ ## Default Options |
@@ -19,4 +19,4 @@ var bendPointUtilities = { | ||
if (result.distances.length > 0) { | ||
edge.data('weights', result.weights); | ||
edge.data('distances', result.distances); | ||
edge.scratch('cyedgebendeditingWeights', result.weights); | ||
edge.scratch('cyedgebendeditingDistances', result.distances); | ||
edge.addClass('edgebendediting-hasbendpoints'); | ||
@@ -247,3 +247,3 @@ } | ||
var distances = edge.data('distances'); | ||
var distances = edge.scratch('cyedgebendeditingDistances'); | ||
for (var i = 0; distances && i < distances.length; i++) { | ||
@@ -258,3 +258,3 @@ str = str + " " + distances[i]; | ||
var weights = edge.data('weights'); | ||
var weights = edge.scratch('cyedgebendeditingWeights'); | ||
for (var i = 0; weights && i < weights.length; i++) { | ||
@@ -282,3 +282,3 @@ str = str + " " + weights[i]; | ||
var endWeight = this.convertToRelativeBendPosition(edge, {x: edgeEndX, y: edgeEndY}).weight; | ||
var weightsWithTgtSrc = [startWeight].concat(edge.data('weights')?edge.data('weights'):[]).concat([endWeight]); | ||
var weightsWithTgtSrc = [startWeight].concat(edge.scratch('cyedgebendeditingWeights')?edge.scratch('cyedgebendeditingWeights'):[]).concat([endWeight]); | ||
@@ -349,4 +349,4 @@ // var segPts = this.getSegmentPoints(edge); | ||
var weights = edge.data('weights'); | ||
var distances = edge.data('distances'); | ||
var weights = edge.scratch('cyedgebendeditingWeights'); | ||
var distances = edge.scratch('cyedgebendeditingDistances'); | ||
@@ -367,4 +367,4 @@ weights = weights?weights:[]; | ||
edge.data('weights', weights); | ||
edge.data('distances', distances); | ||
edge.scratch('cyedgebendeditingWeights', weights); | ||
edge.scratch('cyedgebendeditingDistances', distances); | ||
@@ -381,4 +381,4 @@ edge.addClass('edgebendediting-hasbendpoints'); | ||
var distances = edge.data('distances'); | ||
var weights = edge.data('weights'); | ||
var distances = edge.scratch('cyedgebendeditingDistances'); | ||
var weights = edge.scratch('cyedgebendeditingWeights'); | ||
@@ -393,4 +393,4 @@ distances.splice(bendPointIndex, 1); | ||
else { | ||
edge.data('distances', distances); | ||
edge.data('weights', weights); | ||
edge.scratch('cyedgebendeditingDistances', distances); | ||
edge.scratch('cyedgebendeditingWeights', weights); | ||
} | ||
@@ -397,0 +397,0 @@ }, |
@@ -69,3 +69,3 @@ ;(function($$, $){ 'use strict'; | ||
* A[2 * i] is the x coordinate and A[2 * i + 1] is the y coordinate | ||
* of the ith bend point. | ||
* of the ith bend point. (Returns undefined if the curve style is not segments) | ||
*/ | ||
@@ -72,0 +72,0 @@ cytoscape( 'collection', 'getSegmentPoints', function(){ |
@@ -14,4 +14,4 @@ module.exports = function () { | ||
edge: edge, | ||
weights: param.set ? edge.data('weights') : param.weights, | ||
distances: param.set ? edge.data('distances') : param.distances, | ||
weights: param.set ? edge.scratch('cyedgebendeditingWeights') : param.weights, | ||
distances: param.set ? edge.scratch('cyedgebendeditingDistances') : param.distances, | ||
set: true//As the result will not be used for the first function call params should be used to set the data | ||
@@ -22,4 +22,4 @@ }; | ||
if (param.set) { | ||
param.weights ? edge.data('weights', param.weights) : edge.removeData('weights'); | ||
param.distances ? edge.data('distances', param.distances) : edge.removeData('distances'); | ||
param.weights ? edge.scratch('cyedgebendeditingWeights', param.weights) : edge.removeScratch('cyedgebendeditingWeights'); | ||
param.distances ? edge.scratch('cyedgebendeditingDistances', param.distances) : edge.removeScratch('cyedgebendeditingDistances'); | ||
@@ -26,0 +26,0 @@ //refresh the curve style as the number of bend point would be changed by the previous operation |
@@ -49,4 +49,4 @@ var debounce = require('./debounce'); | ||
edge: edge, | ||
weights: edge.data('weights')?[].concat(edge.data('weights')):edge.data('weights'), | ||
distances: edge.data('distances')?[].concat(edge.data('distances')):edge.data('distances') | ||
weights: edge.scratch('cyedgebendeditingWeights')?[].concat(edge.scratch('cyedgebendeditingWeights')):edge.scratch('cyedgebendeditingWeights'), | ||
distances: edge.scratch('cyedgebendeditingDistances')?[].concat(edge.scratch('cyedgebendeditingDistances')):edge.scratch('cyedgebendeditingDistances') | ||
}; | ||
@@ -60,4 +60,3 @@ | ||
clearDraws(); | ||
renderBendShapes(edge); | ||
clearDraws(true); | ||
@@ -75,4 +74,4 @@ }); | ||
edge: edge, | ||
weights: [].concat(edge.data('weights')), | ||
distances: [].concat(edge.data('distances')) | ||
weights: [].concat(edge.scratch('cyedgebendeditingWeights')), | ||
distances: [].concat(edge.scratch('cyedgebendeditingDistances')) | ||
}; | ||
@@ -86,4 +85,3 @@ | ||
clearDraws(); | ||
renderBendShapes(edge); | ||
clearDraws(true); | ||
}); | ||
@@ -193,4 +191,4 @@ | ||
var weights = edge.data('weights'); | ||
var distances = edge.data('distances'); | ||
var weights = edge.scratch('cyedgebendeditingWeights'); | ||
var distances = edge.scratch('cyedgebendeditingDistances'); | ||
@@ -245,3 +243,3 @@ for(var i = 0; segpts && i < segpts.length; i = i + 2){ | ||
function getContainingBendShapeIndex(x, y, edge) { | ||
if(edge.data('weights') == null || edge.data('weights').lenght == 0){ | ||
if(edge.scratch('cyedgebendeditingWeights') == null || edge.scratch('cyedgebendeditingWeights').lenght == 0){ | ||
return -1; | ||
@@ -332,4 +330,4 @@ } | ||
edge: edge, | ||
weights: edge.data('weights') ? [].concat(edge.data('weights')) : edge.data('weights'), | ||
distances: edge.data('distances') ? [].concat(edge.data('distances')) : edge.data('distances') | ||
weights: edge.scratch('cyedgebendeditingWeights') ? [].concat(edge.scratch('cyedgebendeditingWeights')) : edge.scratch('cyedgebendeditingWeights'), | ||
distances: edge.scratch('cyedgebendeditingDistances') ? [].concat(edge.scratch('cyedgebendeditingDistances')) : edge.scratch('cyedgebendeditingDistances') | ||
}; | ||
@@ -355,4 +353,4 @@ | ||
var weights = edge.data('weights'); | ||
var distances = edge.data('distances'); | ||
var weights = edge.scratch('cyedgebendeditingWeights'); | ||
var distances = edge.scratch('cyedgebendeditingDistances'); | ||
@@ -363,7 +361,6 @@ var relativeBendPosition = bendPointUtilities.convertToRelativeBendPosition(edge, event.cyPosition); | ||
edge.data('weights', weights); | ||
edge.data('distances', distances); | ||
edge.scratch('cyedgebendeditingWeights', weights); | ||
edge.scratch('cyedgebendeditingDistances', distances); | ||
clearDraws(); | ||
renderBendShapes(edge); | ||
clearDraws(true); | ||
}); | ||
@@ -374,4 +371,4 @@ | ||
if (edge !== undefined && moveBendParam !== undefined && edge.data('weights') | ||
&& edge.data('weights').toString() != moveBendParam.weights.toString()) { | ||
if (edge !== undefined && moveBendParam !== undefined && edge.scratch('cyedgebendeditingWeights') | ||
&& edge.scratch('cyedgebendeditingWeights').toString() != moveBendParam.weights.toString()) { | ||
@@ -433,4 +430,4 @@ if(options().undoable) { | ||
var edge = this; | ||
clearDraws(); | ||
renderBendShapes(edge); | ||
edge.select(); | ||
clearDraws(true); | ||
}); | ||
@@ -437,0 +434,0 @@ |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
172326
85
2774