fix node resizer change position not parsed correctly
This commit is contained in:
@@ -68,14 +68,11 @@
|
|||||||
},
|
},
|
||||||
onChange: (change: XYResizerChange, childChanges: XYResizerChildChange[]) => {
|
onChange: (change: XYResizerChange, childChanges: XYResizerChildChange[]) => {
|
||||||
// eslint-disable-next-line svelte/prefer-svelte-reactivity
|
// eslint-disable-next-line svelte/prefer-svelte-reactivity
|
||||||
const changes = new Map<string, Partial<Node>>();
|
const changes = new Map<string, XYResizerChange>();
|
||||||
let position = change.x && change.y ? { x: change.x, y: change.y } : undefined;
|
changes.set(id, change);
|
||||||
changes.set(id, { ...change, position });
|
|
||||||
|
|
||||||
for (const childChange of childChanges) {
|
for (const childChange of childChanges) {
|
||||||
changes.set(childChange.id, {
|
changes.set(childChange.id, {x: childChange.position.x, y: childChange.position.y });
|
||||||
position: childChange.position
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
store.nodes = store.nodes.map((node) => {
|
store.nodes = store.nodes.map((node) => {
|
||||||
@@ -84,11 +81,11 @@
|
|||||||
const vertical = !resizeDirection || resizeDirection === 'vertical';
|
const vertical = !resizeDirection || resizeDirection === 'vertical';
|
||||||
|
|
||||||
if (change) {
|
if (change) {
|
||||||
return {
|
return {
|
||||||
...node,
|
...node,
|
||||||
position: {
|
position: {
|
||||||
x: horizontal ? (change.position?.x ?? node.position.x) : node.position.x,
|
x: horizontal ? (change.x ?? node.position.x) : node.position.x,
|
||||||
y: vertical ? (change.position?.y ?? node.position.y) : node.position.y
|
y: vertical ? (change.y ?? node.position.y) : node.position.y
|
||||||
},
|
},
|
||||||
width: horizontal ? (change.width ?? node.width) : node.width,
|
width: horizontal ? (change.width ?? node.width) : node.width,
|
||||||
height: vertical ? (change.height ?? node.height) : node.height
|
height: vertical ? (change.height ?? node.height) : node.height
|
||||||
|
|||||||
Reference in New Issue
Block a user