introduce RED.view.dimensions for workspace dimensions

This commit is contained in:
Hiroyasu Nishiyama 2022-07-05 09:02:21 +09:00
parent 02308f9e2f
commit 6c1f63bfbb
2 changed files with 10 additions and 4 deletions

View File

@ -105,8 +105,9 @@ RED.view.tools = (function() {
$(document).one('keyup',endKeyboardMove);
endMoveSet = true;
}
var space_width = 5000;
var space_height = 5000;
var dim = RED.view.dimensions();
var space_width = dim.width;
var space_height = dim.height;
var minX = 0;
var minY = 0;
var node;
@ -138,7 +139,6 @@ RED.view.tools = (function() {
minY = Math.min(node.n.y-node.n.h/2-5,minY);
}
}
console.log("; mS:", dx, dy, minX, minY);
if (minX !== 0 || minY !== 0) {
for (var n = 0; n<moving_set.length; n++) {
node = moving_set[n];

View File

@ -6236,6 +6236,12 @@ RED.view = (function() {
showQuickAddDialog:showQuickAddDialog,
calculateNodeDimensions: calculateNodeDimensions,
getElementPosition:getElementPosition,
showTooltip:showTooltip
showTooltip:showTooltip,
dimensions: function() {
return {
width: space_width,
height: space_height
};
}
};
})();