add panning for the line
This commit is contained in:
parent
5e2c205f39
commit
09f7142d75
@ -51,12 +51,22 @@ export default function Canvas(props) {
|
|||||||
const dy = e.clientY - panOffset.y;
|
const dy = e.clientY - panOffset.y;
|
||||||
setPanOffset({ x: e.clientX, y: e.clientY });
|
setPanOffset({ x: e.clientX, y: e.clientY });
|
||||||
|
|
||||||
const updatedTables = props.tables.map((t) => ({
|
props.setTables(
|
||||||
...t,
|
props.tables.map((t) => ({
|
||||||
x: t.x + dx,
|
...t,
|
||||||
y: t.y + dy,
|
x: t.x + dx,
|
||||||
}));
|
y: t.y + dy,
|
||||||
props.setTables(updatedTables);
|
}))
|
||||||
|
);
|
||||||
|
|
||||||
|
setRelationships(
|
||||||
|
relationships.map((r) => ({
|
||||||
|
startX: r.startX + dx,
|
||||||
|
startY: r.startY + dy,
|
||||||
|
endX: r.endX + dx,
|
||||||
|
endY: r.endY + dy,
|
||||||
|
}))
|
||||||
|
);
|
||||||
} else if (dragging >= 0) {
|
} else if (dragging >= 0) {
|
||||||
const updatedTables = props.tables.map((t) => {
|
const updatedTables = props.tables.map((t) => {
|
||||||
if (t.id === dragging) {
|
if (t.id === dragging) {
|
||||||
|
Loading…
Reference in New Issue
Block a user