Skip to content

Commit

Permalink
Improve province selection
Browse files Browse the repository at this point in the history
Fix a slight timing bug with province selection, where if a click was executed with a slight drag into a different province, the second province would be selected instead of the first.
Fix a small bug with the province name label and the province history button when using multi-selection to completely deselect all provinces.
  • Loading branch information
mmyers committed Jun 15, 2024
1 parent d75e333 commit ea07ea7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions EU3_Scenario_Editor/src/editor/EditorUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -787,10 +787,11 @@ private void mapPanelMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:ev
showProvHistButton.setEnabled(false);
final int clickCount = evt.getClickCount();
final boolean addToSelection = (evt.isControlDown() || evt.isMetaDown() || SwingUtilities.isRightMouseButton(evt));
final Province selectedProv = lastProvRolledOver;

java.awt.EventQueue.invokeLater(
() -> {
doMouseClick(lastProvRolledOver, addToSelection);
doMouseClick(selectedProv, addToSelection);

// If it was a double click, go ahead and show an editor.
if (clickCount > 1 && !addToSelection) {
Expand Down Expand Up @@ -916,7 +917,7 @@ private void doMouseClick(final ProvinceData.Province p, boolean addToSelection)
else
currentProvinces.add(p);

if (p != null && p.getId() != 0) {
if (p != null && p.getId() != 0 && !currentProvinces.isEmpty()) {
flashCurrentProvinces(1, Color.WHITE);
} else { // (p == null)
provNameLabel.setText("Click to select a province; right-click or hold <ctrl> to select multiple provinces");
Expand Down

0 comments on commit ea07ea7

Please sign in to comment.