mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-20 03:12:15 +00:00
fix(editor): Fix node position not getting set when dragging selection on new canvas (#11871)
This commit is contained in:
@@ -87,8 +87,6 @@ describe('Canvas', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should handle `update:nodes:position` event', async () => {
|
it('should handle `update:nodes:position` event', async () => {
|
||||||
vi.useFakeTimers();
|
|
||||||
|
|
||||||
const nodes = [createCanvasNodeElement()];
|
const nodes = [createCanvasNodeElement()];
|
||||||
const { container, emitted } = renderComponent({
|
const { container, emitted } = renderComponent({
|
||||||
props: {
|
props: {
|
||||||
@@ -112,8 +110,6 @@ describe('Canvas', () => {
|
|||||||
});
|
});
|
||||||
await fireEvent.mouseUp(node, { view: window });
|
await fireEvent.mouseUp(node, { view: window });
|
||||||
|
|
||||||
vi.advanceTimersByTime(250); // Event debounce time
|
|
||||||
|
|
||||||
expect(emitted()['update:nodes:position']).toEqual([
|
expect(emitted()['update:nodes:position']).toEqual([
|
||||||
[
|
[
|
||||||
[
|
[
|
||||||
|
|||||||
@@ -271,6 +271,10 @@ function onNodeDragStop(event: NodeDragEvent) {
|
|||||||
onUpdateNodesPosition(event.nodes.map(({ id, position }) => ({ id, position })));
|
onUpdateNodesPosition(event.nodes.map(({ id, position }) => ({ id, position })));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onSelectionDragStop(event: NodeDragEvent) {
|
||||||
|
onUpdateNodesPosition(event.nodes.map(({ id, position }) => ({ id, position })));
|
||||||
|
}
|
||||||
|
|
||||||
function onSetNodeActive(id: string) {
|
function onSetNodeActive(id: string) {
|
||||||
props.eventBus.emit('nodes:action', { ids: [id], action: 'update:node:active' });
|
props.eventBus.emit('nodes:action', { ids: [id], action: 'update:node:active' });
|
||||||
emit('update:node:active', id);
|
emit('update:node:active', id);
|
||||||
@@ -644,6 +648,7 @@ provide(CanvasKey, {
|
|||||||
@move-start="onPaneMoveStart"
|
@move-start="onPaneMoveStart"
|
||||||
@move-end="onPaneMoveEnd"
|
@move-end="onPaneMoveEnd"
|
||||||
@node-drag-stop="onNodeDragStop"
|
@node-drag-stop="onNodeDragStop"
|
||||||
|
@selection-drag-stop="onSelectionDragStop"
|
||||||
>
|
>
|
||||||
<template #node-canvas-node="nodeProps">
|
<template #node-canvas-node="nodeProps">
|
||||||
<Node
|
<Node
|
||||||
|
|||||||
Reference in New Issue
Block a user