mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Remove almost all d3 from palette.js
This commit is contained in:
parent
24ff5262d9
commit
11a6925ae4
@ -299,7 +299,7 @@ RED.palette = (function() {
|
|||||||
RED.view.focus();
|
RED.view.focus();
|
||||||
},
|
},
|
||||||
stop: function() {
|
stop: function() {
|
||||||
d3.select('.red-ui-flow-link-splice').classed('red-ui-flow-link-splice',false);
|
document.querySelectorAll(".red-ui-flow-link-splice").forEach(n => { n.classList.remove("red-ui-flow-link-splice") })
|
||||||
if (hoverGroup) {
|
if (hoverGroup) {
|
||||||
document.getElementById("group_select_"+hoverGroup.id).classList.remove("red-ui-flow-group-hovered");
|
document.getElementById("group_select_"+hoverGroup.id).classList.remove("red-ui-flow-group-hovered");
|
||||||
}
|
}
|
||||||
@ -358,26 +358,26 @@ RED.palette = (function() {
|
|||||||
var mx = mouseX / RED.view.scale();
|
var mx = mouseX / RED.view.scale();
|
||||||
var my = mouseY / RED.view.scale();
|
var my = mouseY / RED.view.scale();
|
||||||
for (var i=0;i<nodes.length;i++) {
|
for (var i=0;i<nodes.length;i++) {
|
||||||
var node = d3.select(nodes[i]);
|
var node = nodes[i];
|
||||||
if (node.classed('red-ui-flow-link-background') && !node.classed('red-ui-flow-link-link')) {
|
if (node.classList.contains('red-ui-flow-link-background') && !node.classList.contains('red-ui-flow-link-link')) {
|
||||||
var length = nodes[i].getTotalLength();
|
var length = node.getTotalLength();
|
||||||
for (var j=0;j<length;j+=10) {
|
for (var j=0;j<length;j+=10) {
|
||||||
var p = nodes[i].getPointAtLength(j);
|
var p = node.getPointAtLength(j);
|
||||||
var d2 = ((p.x-mx)*(p.x-mx))+((p.y-my)*(p.y-my));
|
var d2 = ((p.x-mx)*(p.x-mx))+((p.y-my)*(p.y-my));
|
||||||
if (d2 < 200 && d2 < bestDistance) {
|
if (d2 < 200 && d2 < bestDistance) {
|
||||||
bestDistance = d2;
|
bestDistance = d2;
|
||||||
bestLink = nodes[i];
|
bestLink = node;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (activeSpliceLink && activeSpliceLink !== bestLink) {
|
if (activeSpliceLink && activeSpliceLink !== bestLink) {
|
||||||
d3.select(activeSpliceLink.parentNode).classed('red-ui-flow-link-splice',false);
|
activeSpliceLink.parentNode.classList.remove('red-ui-flow-link-splice');
|
||||||
}
|
}
|
||||||
if (bestLink) {
|
if (bestLink) {
|
||||||
d3.select(bestLink.parentNode).classed('red-ui-flow-link-splice',true)
|
bestLink.parentNode.classList.add('red-ui-flow-link-splice');
|
||||||
} else {
|
} else {
|
||||||
d3.select('.red-ui-flow-link-splice').classed('red-ui-flow-link-splice',false);
|
document.querySelectorAll(".red-ui-flow-link-splice").forEach(n => { n.classList.remove("red-ui-flow-link-splice") })
|
||||||
}
|
}
|
||||||
if (activeSpliceLink !== bestLink) {
|
if (activeSpliceLink !== bestLink) {
|
||||||
if (bestLink) {
|
if (bestLink) {
|
||||||
|
Loading…
Reference in New Issue
Block a user