- Timestamp:
- 2023-01-11T17:10:44+01:00 (21 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java
r18586 r18631 268 268 public static final CachingProperty<Boolean> PROP_PREVIEW_ON_HOVER_PRIORITIZE_SELECTION = 269 269 new BooleanProperty("propertiesdialog.preview-on-hover.always-show-selected", true).cached(); 270 private final HoverPreviewPreferSelectionPropListener hoverPreviewPrioritizeSelectionPropListener = 271 new HoverPreviewPreferSelectionPropListener(); 270 272 271 273 /** … … 328 330 329 331 PROP_PREVIEW_ON_HOVER.addListener(hoverPreviewPropListener); 332 PROP_PREVIEW_ON_HOVER_PRIORITIZE_SELECTION.addListener(hoverPreviewPrioritizeSelectionPropListener); 330 333 } 331 334 … … 645 648 TaggingPresets.removeListener(this); 646 649 PROP_PREVIEW_ON_HOVER.removeListener(hoverPreviewPropListener); 650 PROP_PREVIEW_ON_HOVER_PRIORITIZE_SELECTION.removeListener(hoverPreviewPrioritizeSelectionPropListener); 647 651 Container parent = pluginHook.getParent(); 648 652 if (parent != null) { … … 665 669 666 670 // Temporarily disable listening to primitive mouse hover events while we have a selection as that takes priority 667 if ( PROP_PREVIEW_ON_HOVER.get() && PROP_PREVIEW_ON_HOVER_PRIORITIZE_SELECTION.get()) {671 if (Boolean.TRUE.equals(PROP_PREVIEW_ON_HOVER.get())) { 668 672 if (newSel.isEmpty()) { 669 673 MainApplication.getMap().mapView.addPrimitiveHoverListener(this); 670 } else {674 } else if (Boolean.TRUE.equals(PROP_PREVIEW_ON_HOVER_PRIORITIZE_SELECTION.get())) { 671 675 MainApplication.getMap().mapView.removePrimitiveHoverListener(this); 672 676 } … … 1527 1531 @Override 1528 1532 public void valueChanged(ValueChangeEvent<? extends Boolean> e) { 1529 if ( e.getProperty().get() && isDialogShowing()) {1533 if (Boolean.TRUE.equals(e.getProperty().get()) && isDialogShowing()) { 1530 1534 MainApplication.getMap().mapView.addPrimitiveHoverListener(PropertiesDialog.this); 1531 } else if ( !e.getProperty().get()) {1535 } else if (Boolean.FALSE.equals(e.getProperty().get())) { 1532 1536 MainApplication.getMap().mapView.removePrimitiveHoverListener(PropertiesDialog.this); 1533 1537 } 1534 1538 } 1535 1539 } 1540 1541 /* 1542 * Ensure HoverListener is re-added when selection priority is disabled while something is selected. 1543 * Otherwise user would need to change selection to see the preference change take effect. 1544 */ 1545 private class HoverPreviewPreferSelectionPropListener implements ValueChangeListener<Boolean> { 1546 @Override 1547 public void valueChanged(ValueChangeEvent<? extends Boolean> e) { 1548 if (Boolean.FALSE.equals(e.getProperty().get()) && 1549 Boolean.TRUE.equals(PROP_PREVIEW_ON_HOVER.get()) && 1550 isDialogShowing()) { 1551 MainApplication.getMap().mapView.addPrimitiveHoverListener(PropertiesDialog.this); 1552 } 1553 } 1554 } 1536 1555 }
Note:
See TracChangeset
for help on using the changeset viewer.