This is an automated email from the ASF dual-hosted git repository.

hansva pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/hop.git


The following commit(s) were added to refs/heads/main by this push:
     new 7c42838f26 revert metrics to all transforms if none are selected and 
some hardening, fixes #6991 (#6992)
7c42838f26 is described below

commit 7c42838f264304dc337d7d8c2f12b2316ddb13c0
Author: Hans Van Akelyen <[email protected]>
AuthorDate: Mon Apr 13 18:15:51 2026 +0200

    revert metrics to all transforms if none are selected and some hardening, 
fixes #6991 (#6992)
---
 .../hopgui/file/pipeline/HopGuiPipelineGraph.java  | 58 +++++++++++++++-------
 .../hopgui/file/workflow/HopGuiWorkflowGraph.java  | 50 ++++++++++++-------
 2 files changed, 72 insertions(+), 36 deletions(-)

diff --git 
a/ui/src/main/java/org/apache/hop/ui/hopgui/file/pipeline/HopGuiPipelineGraph.java
 
b/ui/src/main/java/org/apache/hop/ui/hopgui/file/pipeline/HopGuiPipelineGraph.java
index f440e244fe..968c585935 100644
--- 
a/ui/src/main/java/org/apache/hop/ui/hopgui/file/pipeline/HopGuiPipelineGraph.java
+++ 
b/ui/src/main/java/org/apache/hop/ui/hopgui/file/pipeline/HopGuiPipelineGraph.java
@@ -286,7 +286,7 @@ public class HopGuiPipelineGraph extends HopGuiAbstractGraph
   private static final int HOP_SEL_MARGIN = 9;
 
   /** Minimum pointer movement (px) before an icon mousedown is treated as 
drag instead of click. */
-  private static final int ICON_DRAG_THRESHOLD_PX = 5;
+  private static final int ICON_DRAG_THRESHOLD_PX = 3;
 
   @Getter private PipelineMeta pipelineMeta;
   @Getter public IPipelineEngine<PipelineMeta> pipeline;
@@ -404,6 +404,12 @@ public class HopGuiPipelineGraph extends 
HopGuiAbstractGraph
   @Setter private HopPipelineFileType<PipelineMeta> fileType;
   private boolean doubleClick;
 
+  /**
+   * Runnable queued for deferred context dialog (double-click mode); 
cancelled on the next
+   * mousedown.
+   */
+  private Runnable pendingShowActionDialogRunnable;
+
   private PipelineHopMeta clickedPipelineHop;
 
   @Getter @Setter protected Map<String, RowBuffer> outputRowsMap;
@@ -673,6 +679,10 @@ public class HopGuiPipelineGraph extends 
HopGuiAbstractGraph
       mouseHover(event);
     }
     doubleClick = false;
+    if (pendingShowActionDialogRunnable != null) {
+      hopGui.getDisplay().timerExec(-1, pendingShowActionDialogRunnable);
+      pendingShowActionDialogRunnable = null;
+    }
     resize = null;
 
     boolean alt = (event.stateMask & SWT.ALT) != 0;
@@ -1027,6 +1037,12 @@ public class HopGuiPipelineGraph extends 
HopGuiAbstractGraph
       if (selectionRegion.isEmpty()) {
         singleClick = true;
         singleClickType = SingleClickType.Pipeline;
+        // End lasso immediately: otherwise mouseMove keeps resizing the 
rectangle after mouseup
+        // until the deferred context dialog runs.
+        selectionRegion = null;
+        canvas.setData("mode", "null");
+        setCursor(null);
+        redraw();
       } else {
         pipelineMeta.unselectAll();
         selectInRect(pipelineMeta, selectionRegion);
@@ -1280,19 +1296,20 @@ public class HopGuiPipelineGraph extends 
HopGuiAbstractGraph
     final PipelineHopMeta fSingleClickHop = singleClickHop;
 
     if (PropsUi.getInstance().useDoubleClick()) {
-      hopGui
-          .getDisplay()
-          .timerExec(
-              hopGui.getDisplay().getDoubleClickTime(),
-              () ->
-                  showActionDialog(
-                      e,
-                      real,
-                      fSingleClick,
-                      fSingleClickType,
-                      fSingleClickTransform,
-                      fSingleClickNote,
-                      fSingleClickHop));
+      Display display = hopGui.getDisplay();
+      pendingShowActionDialogRunnable =
+          () -> {
+            pendingShowActionDialogRunnable = null;
+            showActionDialog(
+                e,
+                real,
+                fSingleClick,
+                fSingleClickType,
+                fSingleClickTransform,
+                fSingleClickNote,
+                fSingleClickHop);
+          };
+      display.timerExec(display.getDoubleClickTime(), 
pendingShowActionDialogRunnable);
     } else {
       showActionDialog(
           e,
@@ -1427,6 +1444,7 @@ public class HopGuiPipelineGraph extends 
HopGuiAbstractGraph
             || !pipelineMeta.getSelectedNotes().isEmpty())) {
       pipelineMeta.unselectAll();
       updateGui();
+      pipelineGridDelegate.onPipelineSelectionChanged();
 
       // Show a short tooltip
       //
@@ -1626,15 +1644,16 @@ public class HopGuiPipelineGraph extends 
HopGuiAbstractGraph
     }
 
     //
-    // Commit to drag mode only after pointer moves past threshold (avoids 
drag when clicking name
-    // or making a small movement)
+    // Commit to drag mode only after pointer moves past threshold while 
primary button is still
+    // down (avoids drag on click jitter; threshold distinguishes click vs 
intentional drag).
     //
     if (currentTransform != null
         && iconOffset != null
         && !iconDragCommitted
         && iconDragStartScreen != null
         && startHopTransform == null
-        && selectionRegion == null) {
+        && selectionRegion == null
+        && (event.stateMask & SWT.BUTTON1) != 0) {
       int dx = event.x - iconDragStartScreen.x;
       int dy = event.y - iconDragStartScreen.y;
       int thresholdSq = ICON_DRAG_THRESHOLD_PX * ICON_DRAG_THRESHOLD_PX;
@@ -1674,7 +1693,9 @@ public class HopGuiPipelineGraph extends 
HopGuiAbstractGraph
       // Track that a note was selected
       pipelineGridDelegate.onPipelineSelectionChanged();
       doRedraw = true;
-    } else if (selectionRegion != null && startHopTransform == null) {
+    } else if (selectionRegion != null
+        && startHopTransform == null
+        && (event.stateMask & SWT.BUTTON1) != 0) {
       // Did we select a region...?
       //
       selectionRegion.width = real.x - selectionRegion.x;
@@ -5423,6 +5444,7 @@ public class HopGuiPipelineGraph extends 
HopGuiAbstractGraph
   @Override
   public void unselectAll() {
     clearSettings();
+    pipelineGridDelegate.onPipelineSelectionChanged();
     updateGui();
   }
 
diff --git 
a/ui/src/main/java/org/apache/hop/ui/hopgui/file/workflow/HopGuiWorkflowGraph.java
 
b/ui/src/main/java/org/apache/hop/ui/hopgui/file/workflow/HopGuiWorkflowGraph.java
index 49a3e280ab..def3696f6b 100644
--- 
a/ui/src/main/java/org/apache/hop/ui/hopgui/file/workflow/HopGuiWorkflowGraph.java
+++ 
b/ui/src/main/java/org/apache/hop/ui/hopgui/file/workflow/HopGuiWorkflowGraph.java
@@ -174,6 +174,7 @@ import org.eclipse.swt.widgets.Canvas;
 import org.eclipse.swt.widgets.Combo;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.Listener;
 import org.eclipse.swt.widgets.Shell;
 import org.eclipse.swt.widgets.ToolBar;
@@ -299,7 +300,7 @@ public class HopGuiWorkflowGraph extends HopGuiAbstractGraph
   protected static final int SIZE = 30; // arrowhead length
 
   /** Minimum pointer movement (px) before an action icon mousedown is treated 
as drag. */
-  private static final int ACTION_DRAG_THRESHOLD_PX = 5;
+  private static final int ACTION_DRAG_THRESHOLD_PX = 3;
 
   protected int currentMouseX = 0;
 
@@ -347,6 +348,7 @@ public class HopGuiWorkflowGraph extends HopGuiAbstractGraph
   private ActionMeta currentAction;
   private boolean ignoreNextClick;
   private boolean doubleClick;
+  private Runnable pendingShowContextDialogRunnable;
   private boolean dragSelection;
   private WorkflowHopMeta clickedWorkflowHop;
 
@@ -577,6 +579,10 @@ public class HopGuiWorkflowGraph extends 
HopGuiAbstractGraph
       mouseHover(event);
     }
     doubleClick = false;
+    if (pendingShowContextDialogRunnable != null) {
+      hopGui.getDisplay().timerExec(-1, pendingShowContextDialogRunnable);
+      pendingShowContextDialogRunnable = null;
+    }
     resize = null;
 
     if (ignoreNextClick) {
@@ -907,6 +913,10 @@ public class HopGuiWorkflowGraph extends 
HopGuiAbstractGraph
       if (selectionRegion.isEmpty()) {
         singleClick = true;
         singleClickType = SingleClickType.Workflow;
+        selectionRegion = null;
+        canvas.setData("mode", "null");
+        setCursor(null);
+        redraw();
       } else {
         workflowMeta.unselectAll();
         selectInRect(workflowMeta, selectionRegion);
@@ -1140,19 +1150,20 @@ public class HopGuiWorkflowGraph extends 
HopGuiAbstractGraph
     final WorkflowHopMeta fSingleClickHop = singleClickHop;
 
     if (PropsUi.getInstance().useDoubleClick()) {
-      hopGui
-          .getDisplay()
-          .timerExec(
-              hopGui.getDisplay().getDoubleClickTime(),
-              () ->
-                  showContextDialog(
-                      event,
-                      real,
-                      fSingleClick,
-                      fSingleClickType,
-                      fSingleClickAction,
-                      fSingleClickNote,
-                      fSingleClickHop));
+      Display display = hopGui.getDisplay();
+      pendingShowContextDialogRunnable =
+          () -> {
+            pendingShowContextDialogRunnable = null;
+            showContextDialog(
+                event,
+                real,
+                fSingleClick,
+                fSingleClickType,
+                fSingleClickAction,
+                fSingleClickNote,
+                fSingleClickHop);
+          };
+      display.timerExec(display.getDoubleClickTime(), 
pendingShowContextDialogRunnable);
     } else {
       showContextDialog(
           event,
@@ -1343,15 +1354,16 @@ public class HopGuiWorkflowGraph extends 
HopGuiAbstractGraph
     }
 
     //
-    // Commit to drag mode only after pointer moves past threshold (avoids 
drag when clicking name
-    // or making a small movement)
+    // Commit to drag mode only after pointer moves past threshold while 
primary button is still
+    // down (avoids drag on click jitter; threshold distinguishes click vs 
intentional drag).
     //
     if (currentAction != null
         && iconOffset != null
         && !actionDragCommitted
         && actionDragStartScreen != null
         && startHopAction == null
-        && selectionRegion == null) {
+        && selectionRegion == null
+        && (event.stateMask & SWT.BUTTON1) != 0) {
       int dx = event.x - actionDragStartScreen.x;
       int dy = event.y - actionDragStartScreen.y;
       int thresholdSq = ACTION_DRAG_THRESHOLD_PX * ACTION_DRAG_THRESHOLD_PX;
@@ -1384,7 +1396,9 @@ public class HopGuiWorkflowGraph extends 
HopGuiAbstractGraph
       selectedNotes.add(selectedNote);
       previousNoteLocations = new Point[] {selectedNote.getLocation()};
       doRedraw = true;
-    } else if (selectionRegion != null && startHopAction == null) {
+    } else if (selectionRegion != null
+        && startHopAction == null
+        && (event.stateMask & SWT.BUTTON1) != 0) {
       // Did we select a region...?
       //
       selectionRegion.width = real.x - selectionRegion.x;

Reply via email to