1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

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

View File

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