From cdb3d7066e52a353b64143a84ae0809ff5090aae Mon Sep 17 00:00:00 2001 From: Kunal Shroff Date: Fri, 6 Jun 2025 09:39:36 -0400 Subject: [PATCH] Add a pref to make symbols with transparent regions clickable --- .../builder/representation/javafx/JFXPreferences.java | 2 ++ .../representation/javafx/widgets/SymbolRepresentation.java | 2 ++ .../src/main/resources/jfx_repr_preferences.properties | 5 +++++ 3 files changed, 9 insertions(+) diff --git a/app/display/representation-javafx/src/main/java/org/csstudio/display/builder/representation/javafx/JFXPreferences.java b/app/display/representation-javafx/src/main/java/org/csstudio/display/builder/representation/javafx/JFXPreferences.java index cb8df95b79..efce94633e 100644 --- a/app/display/representation-javafx/src/main/java/org/csstudio/display/builder/representation/javafx/JFXPreferences.java +++ b/app/display/representation-javafx/src/main/java/org/csstudio/display/builder/representation/javafx/JFXPreferences.java @@ -22,6 +22,8 @@ public class JFXPreferences @Preference public static int tooltip_delay_ms; /** Tooltip duration */ @Preference public static int tooltip_display_sec; + /** make the transparent parts of symbols clickable */ + @Preference public static boolean pick_on_bounds; static { diff --git a/app/display/representation-javafx/src/main/java/org/csstudio/display/builder/representation/javafx/widgets/SymbolRepresentation.java b/app/display/representation-javafx/src/main/java/org/csstudio/display/builder/representation/javafx/widgets/SymbolRepresentation.java index 65643470ed..60addfc51c 100644 --- a/app/display/representation-javafx/src/main/java/org/csstudio/display/builder/representation/javafx/widgets/SymbolRepresentation.java +++ b/app/display/representation-javafx/src/main/java/org/csstudio/display/builder/representation/javafx/widgets/SymbolRepresentation.java @@ -41,6 +41,7 @@ import org.csstudio.display.builder.model.util.ModelThreadPool; import org.csstudio.display.builder.model.widgets.PVWidget; import org.csstudio.display.builder.model.widgets.SymbolWidget; +import org.csstudio.display.builder.representation.javafx.JFXPreferences; import org.csstudio.display.builder.representation.javafx.JFXUtil; import org.csstudio.display.builder.representation.javafx.SVGHelper; import org.epics.util.array.ListNumber; @@ -477,6 +478,7 @@ protected StackPane createJFXNode ( ) throws Exception { private void enableRunActionsOnMouseClick() { imageView.focusTraversableProperty().set(true); imageView.setStyle("-fx-cursor: hand;"); + imageView.setPickOnBounds(JFXPreferences.pick_on_bounds); ColorAdjust[] clickEffect = { null }; // Values are wrapped in arrays as a workaround of the fact that Java doesn't allow non-final variables to be captured by closures. DropShadow[] focusEffect = { null }; diff --git a/app/display/representation-javafx/src/main/resources/jfx_repr_preferences.properties b/app/display/representation-javafx/src/main/resources/jfx_repr_preferences.properties index 72709db322..11081928b7 100644 --- a/app/display/representation-javafx/src/main/resources/jfx_repr_preferences.properties +++ b/app/display/representation-javafx/src/main/resources/jfx_repr_preferences.properties @@ -17,3 +17,8 @@ tooltip_display_sec=30 # Note that for historic reasons tool tips are also influenced # by the property `org.csstudio.display.builder.disable_tooltips`. # When `true`, tool tips are disabled. + +# Determines whether the mouse can interact with the bounds +# of the symbol widget. If false, interaction is +# limited to the visible area of the element. +pick_on_bounds=false