SYNC: fixed selecting in diagrams with zoom

This commit is contained in:
SPRINX0\prochazka
2025-03-31 13:29:25 +02:00
committed by Diflow
parent fde257c722
commit 7a5e17a345
2 changed files with 17 additions and 6 deletions

View File

@@ -632,9 +632,15 @@
const domTable = domTables[x.designerId] as any;
if (domTable) {
const rect = domTable.getRect();
const rectZoomed = {
left: rect.left / zoomKoef,
right: rect.right / zoomKoef,
top: rect.top / zoomKoef,
bottom: rect.bottom / zoomKoef,
};
return {
...x,
isSelectedTable: rectanglesHaveIntersection(rect, bounds),
isSelectedTable: rectanglesHaveIntersection(rectZoomed, bounds),
};
}
}),

View File

@@ -11,11 +11,16 @@ export default function moveDrag(node, dragEvents) {
const handleMoveDown = e => {
if (e.button != 0) return;
const zoomKoef = window.getComputedStyle(node)['zoom'];
// const zoomKoef = window.getComputedStyle(node)['zoom'];
const clientRect = node.getBoundingClientRect();
clientX = clientRect.left * zoomKoef;
clientY = clientRect.top * zoomKoef;
clientX = clientRect.left;
clientY = clientRect.top;
// console.log('ZOOM', zoomKoef);
// console.log('CLIENT RECT', clientRect);
// console.log('e.clientX', e.clientX);
// console.log('e.clientY', e.clientY);
startX = e.clientX;
startY = e.clientY;
@@ -25,7 +30,7 @@ export default function moveDrag(node, dragEvents) {
};
const handleMoveMove = e => {
const zoomKoef = window.getComputedStyle(node)['zoom'];
// const zoomKoef = window.getComputedStyle(node)['zoom'];
e.preventDefault();
const diffX = e.clientX - startX;
@@ -36,7 +41,7 @@ export default function moveDrag(node, dragEvents) {
onMove(diffX, diffY, e.clientX - clientX, e.clientY - clientY);
};
const handleMoveEnd = e => {
const zoomKoef = window.getComputedStyle(node)['zoom'];
// const zoomKoef = window.getComputedStyle(node)['zoom'];
e.preventDefault();
startX = null;