mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Fix palette node link splicing on Firefox
This commit is contained in:
parent
9bca2a91c9
commit
4c6771669b
@ -233,17 +233,25 @@ RED.palette = (function() {
|
||||
|
||||
if (!spliceTimer) {
|
||||
spliceTimer = setTimeout(function() {
|
||||
|
||||
var nodes = [];
|
||||
var bestDistance = Infinity;
|
||||
var bestLink = null;
|
||||
if (chartSVG.getIntersectionList) {
|
||||
var svgRect = chartSVG.createSVGRect();
|
||||
svgRect.x = mouseX;
|
||||
svgRect.y = mouseY;
|
||||
svgRect.width = 1;
|
||||
svgRect.height = 1;
|
||||
var bestDistance = Infinity;
|
||||
var bestLink = null;
|
||||
var nodes = chartSVG.getIntersectionList(svgRect,chartSVG);
|
||||
nodes = chartSVG.getIntersectionList(svgRect,chartSVG);
|
||||
mouseX /= RED.view.scale();
|
||||
mouseY /= RED.view.scale();
|
||||
} else {
|
||||
// Firefox doesn't do getIntersectionList and that
|
||||
// makes us sad
|
||||
mouseX /= RED.view.scale();
|
||||
mouseY /= RED.view.scale();
|
||||
nodes = RED.view.getLinksAtPoint(mouseX,mouseY);
|
||||
}
|
||||
for (var i=0;i<nodes.length;i++) {
|
||||
if (d3.select(nodes[i]).classed('link_background')) {
|
||||
var length = nodes[i].getTotalLength();
|
||||
|
@ -1971,6 +1971,17 @@ RED.view = (function() {
|
||||
},
|
||||
scale: function() {
|
||||
return scaleFactor;
|
||||
},
|
||||
getLinksAtPoint: function(x,y) {
|
||||
var result = [];
|
||||
var links = outer.selectAll(".link_background")[0];
|
||||
for (var i=0;i<links.length;i++) {
|
||||
var bb = links[i].getBBox();
|
||||
if (x >= bb.x && y >= bb.y && x <= bb.x+bb.width && y <= bb.y+bb.height) {
|
||||
result.push(links[i])
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
Loading…
Reference in New Issue
Block a user