Fixed node multi-select with CTRL+drag

This commit is contained in:
frikky
2022-01-16 18:06:12 +01:00
parent 581f97be80
commit bcae2fc004
2 changed files with 14 additions and 9 deletions
+14 -7
View File
@@ -1665,6 +1665,10 @@ const AngularWorkflow = (defaultprops) => {
} }
*/ */
cy.removeListener("select");
cy.on("select", "node", (e) => onNodeSelect(e, appAuthentication));
cy.on("select", "edge", (e) => onEdgeSelect(e));
// FIXME - check if they have value before overriding like this for no reason. // FIXME - check if they have value before overriding like this for no reason.
// Would save a lot of time (400~ ms -> 30ms) // Would save a lot of time (400~ ms -> 30ms)
//console.log("ACTION: ", selectedAction) //console.log("ACTION: ", selectedAction)
@@ -1800,7 +1804,7 @@ const AngularWorkflow = (defaultprops) => {
continue continue
} }
const edgeCurve = calculateEdgeCurve(sourcenode.data(), destinationnode.data()) const edgeCurve = calculateEdgeCurve(sourcenode.position(), destinationnode.position())
const currentedge = cy.getElementById(edge.data.id) const currentedge = cy.getElementById(edge.data.id)
if (currentedge !== undefined && currentedge !== null) { if (currentedge !== undefined && currentedge !== null) {
currentedge.style('control-point-distance', edgeCurve.distance) currentedge.style('control-point-distance', edgeCurve.distance)
@@ -3485,8 +3489,11 @@ const AngularWorkflow = (defaultprops) => {
}); });
cy.on("boxend", (e) => { cy.on("boxend", (e) => {
console.log("END"); console.log("END: ", cy)
cy.removeListener("select"); var cydata = cy.$(":selected").jsons();
if (cydata !== undefined && cydata !== null && cydata.length > 0) {
alert.success(`Selected ${cydata.length} element(s). CTRL+C to copy them.`);
}
}); });
cy.on("select", "node", (e) => { cy.on("select", "node", (e) => {
@@ -3842,9 +3849,9 @@ const AngularWorkflow = (defaultprops) => {
// Thanks :) // Thanks :)
// https://codepen.io/guillaumethomas/pen/xxbbBKO // https://codepen.io/guillaumethomas/pen/xxbbBKO
const calculateEdgeCurve = (sourcenode, destinationnode) => { const calculateEdgeCurve = (sourcenodePosition, destinationnodePosition) => {
const xParsed = destinationnode.position.x - sourcenode.position.x const xParsed = destinationnodePosition.x - sourcenodePosition.x
const yParsed = destinationnode.position.y - sourcenode.position.y const yParsed = destinationnodePosition.y - sourcenodePosition.y
const z = Math.sqrt(xParsed * xParsed + yParsed * yParsed); const z = Math.sqrt(xParsed * xParsed + yParsed * yParsed);
const costheta = xParsed / z; const costheta = xParsed / z;
@@ -4029,7 +4036,7 @@ const AngularWorkflow = (defaultprops) => {
//console.log("SOURCE: ", sourcenode.position) //console.log("SOURCE: ", sourcenode.position)
//console.log("DESTINATIONNODE: ", destinationnode.position) //console.log("DESTINATIONNODE: ", destinationnode.position)
const edgeCurve = calculateEdgeCurve(sourcenode, destinationnode) const edgeCurve = calculateEdgeCurve(sourcenode.position, destinationnode.position)
edge.style = { edge.style = {
'control-point-distance': edgeCurve.distance, 'control-point-distance': edgeCurve.distance,
'control-point-weight': edgeCurve.weight, 'control-point-weight': edgeCurve.weight,
-2
View File
@@ -1712,8 +1712,6 @@ const AppCreator = (defaultprops) => {
) { ) {
if (item["example_response"] === "shuffle_file_download") { if (item["example_response"] === "shuffle_file_download") {
console.log("Download as file: ", item)
data.paths[item.url][item.method.toLowerCase()].responses["default"]["content"]["text/plain"].schema.type = "string" data.paths[item.url][item.method.toLowerCase()].responses["default"]["content"]["text/plain"].schema.type = "string"
data.paths[item.url][item.method.toLowerCase()].responses["default"]["content"]["text/plain"].schema.format = "binary" data.paths[item.url][item.method.toLowerCase()].responses["default"]["content"]["text/plain"].schema.format = "binary"