Comparing version 0.0.11 to 0.0.12
@@ -16,3 +16,3 @@ /// <reference types="snapsvg" /> | ||
private attachDrop(); | ||
static makeConnectionPath(x1: any, y1: any, x2: any, y2: any, forceDirection?: boolean): string; | ||
static makeConnectionPath(x1: any, y1: any, x2: any, y2: any, forceDirection?: "right" | "left"): string; | ||
private makePathStringBetween(x1, y1, x2, y2); | ||
@@ -19,0 +19,0 @@ protected getClass(): string; |
@@ -72,9 +72,16 @@ "use strict"; | ||
IOPort.makeConnectionPath = function (x1, y1, x2, y2, forceDirection) { | ||
if (forceDirection === void 0) { forceDirection = true; } | ||
if (forceDirection === void 0) { forceDirection = "right"; } | ||
if (!forceDirection) { | ||
return "M " + x1 + " " + y1 + " C " + (x1 + x2) / 2 + " " + y1 + " " + (x1 + x2) / 2 + " " + y2 + " " + x2 + " " + y2; | ||
} | ||
var outDir = x1 + Math.abs(x1 - x2) / 2; | ||
var inDir = x2 - Math.abs(x1 - x2) / 2; | ||
return "M " + x1 + " " + y1 + " C " + outDir + " " + y1 + " " + inDir + " " + y2 + " " + x2 + " " + y2; | ||
else if (forceDirection === "right") { | ||
var outDir = x1 + Math.abs(x1 - x2) / 2; | ||
var inDir = x2 - Math.abs(x1 - x2) / 2; | ||
return "M " + x1 + " " + y1 + " C " + outDir + " " + y1 + " " + inDir + " " + y2 + " " + x2 + " " + y2; | ||
} | ||
else if (forceDirection === "left") { | ||
var outDir = x1 - Math.abs(x1 - x2) / 2; | ||
var inDir = x2 + Math.abs(x1 - x2) / 2; | ||
return "M " + x1 + " " + y1 + " C " + outDir + " " + y1 + " " + inDir + " " + y2 + " " + x2 + " " + y2; | ||
} | ||
}; | ||
@@ -81,0 +88,0 @@ IOPort.prototype.makePathStringBetween = function (x1, y1, x2, y2) { |
@@ -363,2 +363,3 @@ "use strict"; | ||
var highlightedNode_1; | ||
var edgeDirection_1; | ||
this.domEvents.drag(".port", function (dx, dy, ev, target) { | ||
@@ -369,3 +370,3 @@ var ctm = target.getScreenCTM(); | ||
subEdges_1.forEach(function (el) { | ||
el.setAttribute("d", io_port_1.IOPort.makeConnectionPath(origin.x, origin.y, coords.x, coords.y)); | ||
el.setAttribute("d", io_port_1.IOPort.makeConnectionPath(origin.x, origin.y, coords.x, coords.y, edgeDirection_1)); | ||
}); | ||
@@ -387,2 +388,3 @@ var sorted = connectionPorts_1.map(function (el) { | ||
}, function (ev, target, root) { | ||
edgeDirection_1 = target.classList.contains("input-port") ? "left" : "right"; | ||
edge_2 = edge_1.Edge.spawn(); | ||
@@ -407,4 +409,5 @@ edge_2.classList.add("eventless", "dragged"); | ||
}); | ||
_this.workflow.classList.add("has-selection"); | ||
_this.workflow.classList.add("has-selection", "edge-dragging"); | ||
}, function (ev, target) { | ||
edgeDirection_1 = undefined; | ||
edge_2.remove(); | ||
@@ -421,3 +424,3 @@ edge_2 = undefined; | ||
}); | ||
_this.workflow.classList.remove("has-selection"); | ||
_this.workflow.classList.remove("has-selection", "edge-dragging"); | ||
subEdges_1 = undefined; | ||
@@ -424,0 +427,0 @@ connectionPorts_1 = undefined; |
@@ -10,3 +10,3 @@ { | ||
"description": "A library for generating an interactive SVG visualization of CWL workflows", | ||
"version": "0.0.11", | ||
"version": "0.0.12", | ||
"dependencies": { | ||
@@ -13,0 +13,0 @@ "core-js": "^2.4.1", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
112115
1350