Skip to content

Add 'pick_on_bounds' property to symbolwidgets for clicking intricate symbols #3319

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ public class Messages
WidgetProperties_Rotation,
WidgetProperties_Rules,
WidgetProperties_RunActionsOnMouseClick,
WidgetProperties_PickOnBounds,
WidgetProperties_Running,
WidgetProperties_ScaleFactor,
WidgetProperties_ScaleFormat,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ public Widget createWidget ( ) {
/** Property */
public static final WidgetPropertyDescriptor<String> propFallbackSymbol = newFilenamePropertyDescriptor (WidgetPropertyCategory.BEHAVIOR, "fallback_symbol", Messages.WidgetProperties_FallbackSymbol);
public static final WidgetPropertyDescriptor<Boolean> propRunActionsOnMouseClick = newBooleanPropertyDescriptor (WidgetPropertyCategory.BEHAVIOR, "run_actions_on_mouse_click", Messages.WidgetProperties_RunActionsOnMouseClick);

/** 'pick_on_bounds' */
public static final WidgetPropertyDescriptor<Boolean> propPickOnBounds = newBooleanPropertyDescriptor (WidgetPropertyCategory.BEHAVIOR, "pick_on_bounds", Messages.WidgetProperties_PickOnBounds);

/** 'svg_rendering_resolution_factor': */
public static final WidgetPropertyDescriptor<Double> propSVGRenderingResolutionFactor = newDoublePropertyDescriptor(WidgetPropertyCategory.DISPLAY, "svg_rendering_resolution_factor", Messages.WidgetProperties_SVGRenderingResolutionFactor);

Expand Down Expand Up @@ -125,6 +129,7 @@ public Widget createWidget ( ) {
private volatile WidgetProperty<String> fallbackSymbol;
private volatile WidgetProperty<WidgetColor> disconnectOverlayColor;
private volatile WidgetProperty<Boolean> run_actions_on_mouse_click;
private volatile WidgetProperty<Boolean> pick_on_bounds;
private volatile WidgetProperty<Double> svgRenderingResolutionFactor;

/** Returns 'symbol' property: element for list of 'symbols' property */
Expand Down Expand Up @@ -230,6 +235,11 @@ public WidgetProperty<Boolean> propRunActionsOnMouseClick() {
return run_actions_on_mouse_click;
}

/** @return property */
public WidgetProperty<Boolean> propPickOnBounds() {
return pick_on_bounds;
}

/** @return 'svgRenderingResolutionFactor' property */
public WidgetProperty<Double> propSVGRenderingResolutionFactor() {
return svgRenderingResolutionFactor;
Expand Down Expand Up @@ -268,6 +278,7 @@ protected void defineProperties ( final List<WidgetProperty<?>> properties ) {
int indexOfPropActions = properties.indexOf(propActions());
run_actions_on_mouse_click = propRunActionsOnMouseClick.createProperty(this, false);
properties.add(indexOfPropActions + 1, run_actions_on_mouse_click);
properties.add(indexOfPropActions + 2, pick_on_bounds = propPickOnBounds.createProperty(this, false));
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ WidgetProperties_RingWidth=Ring Width
WidgetProperties_Rotation=Rotation
WidgetProperties_Rules=Rules
WidgetProperties_RunActionsOnMouseClick=Run Actions on Mouse Click
WidgetProperties_PickOnBounds=Pick on Bounds
WidgetProperties_Running=Running
WidgetProperties_ScaleFactor=Scale Factor
WidgetProperties_ScaleFormat=Scale Format
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,7 @@ protected StackPane createJFXNode ( ) throws Exception {
private void enableRunActionsOnMouseClick() {
imageView.focusTraversableProperty().set(true);
imageView.setStyle("-fx-cursor: hand;");
imageView.setPickOnBounds(model_widget.propPickOnBounds().getValue());

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 };
Expand Down