fix(editor): Fix node position not getting set when dragging selection on new canvas (#11871)
Some checks are pending
Test Master / install-and-build (push) Waiting to run
Test Master / Unit tests (18.x) (push) Blocked by required conditions
Test Master / Unit tests (20.x) (push) Blocked by required conditions
Test Master / Unit tests (22.4) (push) Blocked by required conditions
Test Master / Lint (push) Blocked by required conditions
Test Master / Notify Slack on failure (push) Blocked by required conditions

This commit is contained in:
Alex Grozav 2024-11-25 15:29:08 +02:00 committed by GitHub
parent 91d1bd8d33
commit 595de81c03
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 4 deletions

View file

@ -87,8 +87,6 @@ describe('Canvas', () => {
});
it('should handle `update:nodes:position` event', async () => {
vi.useFakeTimers();
const nodes = [createCanvasNodeElement()];
const { container, emitted } = renderComponent({
props: {
@ -112,8 +110,6 @@ describe('Canvas', () => {
});
await fireEvent.mouseUp(node, { view: window });
vi.advanceTimersByTime(250); // Event debounce time
expect(emitted()['update:nodes:position']).toEqual([
[
[

View file

@ -271,6 +271,10 @@ function onNodeDragStop(event: NodeDragEvent) {
onUpdateNodesPosition(event.nodes.map(({ id, position }) => ({ id, position })));
}
function onSelectionDragStop(event: NodeDragEvent) {
onUpdateNodesPosition(event.nodes.map(({ id, position }) => ({ id, position })));
}
function onSetNodeActive(id: string) {
props.eventBus.emit('nodes:action', { ids: [id], action: 'update:node:active' });
emit('update:node:active', id);
@ -644,6 +648,7 @@ provide(CanvasKey, {
@move-start="onPaneMoveStart"
@move-end="onPaneMoveEnd"
@node-drag-stop="onNodeDragStop"
@selection-drag-stop="onSelectionDragStop"
>
<template #node-canvas-node="nodeProps">
<Node