mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-25 02:56:00 +00:00
SYNC: fixed selecting in diagrams with zoom
This commit is contained in:
committed by
Diflow
parent
fde257c722
commit
7a5e17a345
@@ -632,9 +632,15 @@
|
|||||||
const domTable = domTables[x.designerId] as any;
|
const domTable = domTables[x.designerId] as any;
|
||||||
if (domTable) {
|
if (domTable) {
|
||||||
const rect = domTable.getRect();
|
const rect = domTable.getRect();
|
||||||
|
const rectZoomed = {
|
||||||
|
left: rect.left / zoomKoef,
|
||||||
|
right: rect.right / zoomKoef,
|
||||||
|
top: rect.top / zoomKoef,
|
||||||
|
bottom: rect.bottom / zoomKoef,
|
||||||
|
};
|
||||||
return {
|
return {
|
||||||
...x,
|
...x,
|
||||||
isSelectedTable: rectanglesHaveIntersection(rect, bounds),
|
isSelectedTable: rectanglesHaveIntersection(rectZoomed, bounds),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -11,11 +11,16 @@ export default function moveDrag(node, dragEvents) {
|
|||||||
const handleMoveDown = e => {
|
const handleMoveDown = e => {
|
||||||
if (e.button != 0) return;
|
if (e.button != 0) return;
|
||||||
|
|
||||||
const zoomKoef = window.getComputedStyle(node)['zoom'];
|
// const zoomKoef = window.getComputedStyle(node)['zoom'];
|
||||||
|
|
||||||
const clientRect = node.getBoundingClientRect();
|
const clientRect = node.getBoundingClientRect();
|
||||||
clientX = clientRect.left * zoomKoef;
|
clientX = clientRect.left;
|
||||||
clientY = clientRect.top * zoomKoef;
|
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;
|
startX = e.clientX;
|
||||||
startY = e.clientY;
|
startY = e.clientY;
|
||||||
@@ -25,7 +30,7 @@ export default function moveDrag(node, dragEvents) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleMoveMove = e => {
|
const handleMoveMove = e => {
|
||||||
const zoomKoef = window.getComputedStyle(node)['zoom'];
|
// const zoomKoef = window.getComputedStyle(node)['zoom'];
|
||||||
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
const diffX = e.clientX - startX;
|
const diffX = e.clientX - startX;
|
||||||
@@ -36,7 +41,7 @@ export default function moveDrag(node, dragEvents) {
|
|||||||
onMove(diffX, diffY, e.clientX - clientX, e.clientY - clientY);
|
onMove(diffX, diffY, e.clientX - clientX, e.clientY - clientY);
|
||||||
};
|
};
|
||||||
const handleMoveEnd = e => {
|
const handleMoveEnd = e => {
|
||||||
const zoomKoef = window.getComputedStyle(node)['zoom'];
|
// const zoomKoef = window.getComputedStyle(node)['zoom'];
|
||||||
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
startX = null;
|
startX = null;
|
||||||
|
|||||||
Reference in New Issue
Block a user