Skip to content

Commit d3eeffd

Browse files
committed
[5924] Prevent a simple move on its parent from triggering a diagram drop
Bug: #5924 Signed-off-by: Florian ROUËNÉ <florian.rouene@obeosoft.com>
1 parent df23d88 commit d3eeffd

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

CHANGELOG.adoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
= Changelog
22

3-
== 2026.1.0
3+
== 2026.1.0 (work in progress)
44

55
=== Shapes
66

@@ -41,7 +41,7 @@ On the backend, the node and edge's `deleteHandler` can now be `null` if no sema
4141
- https://github.com/eclipse-sirius/sirius-web/issues/5720[#5720] [explorer] Fixed an issue where the initial search for an element with the Omnibox would not reveal the selected element in the _Explorer_
4242
- https://github.com/eclipse-sirius/sirius-web/issues/5896[#5896] Add missing translations for edge appearance menu
4343
- https://github.com/eclipse-sirius/sirius-web/issues/5912[#5912] [diagram] Fix an issue where edge handles could be rendered in the wrong position
44-
44+
- https://github.com/eclipse-sirius/sirius-web/issues/5924[#5924] [diagram] Prevent a simple move on its parent from triggering a diagram drop
4545

4646
=== New Features
4747

@@ -64,7 +64,7 @@ Downstream applications can now implement the following interfaces:
6464
* `IIndexUpdateServiceDelegate` to customize how the content of the indices is updated
6565
Sirius Web provides a default implementation for all these services, which creates an index per editing context, and indexes all the features of the elements in the editing context (this can be customized by implementing `IIndexEntryProviderDelegate`).
6666
- https://github.com/eclipse-sirius/sirius-web/issues/3486[#3486] [diagram] Do not open delete confirmation dialog when a node/edge is not deletable
67-
- https://github.com/eclipse-sirius/sirius-web/issues/5768[#5768] [diagram] Group tools are now using the same palette as others tools
67+
- https://github.com/eclipse-sirius/sirius-web/issues/5768[#5768] [diagram] Group tools are now using the same palette as others tools
6868

6969

7070

packages/diagrams/frontend/sirius-components-diagrams/src/renderer/dropNode/useDropNodes.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ export const useDropNodes = (): UseDropNodesValue => {
152152
return node;
153153
};
154154

155-
const onNodeDragStart: OnNodeDrag<Node<NodeData>> = useCallback(
155+
const onNodesDragStart: OnNodeDrag<Node<NodeData>> = useCallback(
156156
(_event, _node, nodes) => {
157157
if (nodes.length === 0) {
158158
return;
@@ -232,7 +232,7 @@ export const useDropNodes = (): UseDropNodesValue => {
232232
[getNodes]
233233
);
234234

235-
const onNodeDrag: OnNodeDrag<Node<NodeData>> = useCallback(
235+
const onNodesDrag: OnNodeDrag<Node<NodeData>> = useCallback(
236236
(event, _node, nodes) => {
237237
if (nodes.length === 0) {
238238
return;
@@ -293,8 +293,11 @@ export const useDropNodes = (): UseDropNodesValue => {
293293
[droppableOnDiagram, getNodes]
294294
);
295295

296-
const onNodeDragStop: OnNodeDrag<Node<NodeData>> = useCallback(
297-
(_event, draggedNode, draggedNodes) => {
296+
const onNodesDragStop: OnNodeDrag<Node<NodeData>> = useCallback(
297+
(_event, node, _nodes) => {
298+
const draggedNodes: Node<NodeData>[] = getNodes().filter((node) => node.data.isDraggedNode);
299+
const draggedNode: Node<NodeData> | undefined =
300+
draggedNodes.find((draggedNode) => draggedNode.id === node.id) || undefined;
298301
if (draggedNode) {
299302
const dropPosition = evaluateAbsolutePosition(draggedNode, storeApi.getState().nodeLookup);
300303
const targetNode = getNodes().find((node) => node.data.isDropNodeTarget);
@@ -372,8 +375,8 @@ export const useDropNodes = (): UseDropNodesValue => {
372375
);
373376

374377
return {
375-
onNodesDragStart: onNodeDragStart,
376-
onNodesDrag: onNodeDrag,
377-
onNodesDragStop: onNodeDragStop,
378+
onNodesDragStart,
379+
onNodesDrag,
380+
onNodesDragStop,
378381
};
379382
};

0 commit comments

Comments
 (0)