Changeset 5127 in josm


Ignore:
Timestamp:
2012-03-28T20:30:52+02:00 (8 years ago)
Author:
jttt
Message:

Show opacity slider in the middle of the screen in case opacity button is hidden

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/dialogs/LayerListDialog.java

    r5030 r5127  
    267267        layerList.getActionMap().put("deleteLayer", deleteLayerAction);
    268268        adaptTo(deleteLayerAction, selectionModel);
     269        getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(
     270                KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0),"delete"
     271                );
     272        getActionMap().put("delete", deleteLayerAction);
     273
    269274
    270275        createLayout(layerList, true, Arrays.asList(new SideButton[] {
     
    592597        public void actionPerformed(ActionEvent e) {
    593598            slider.setValue((int)Math.round(getOpacity()*100));
    594             popup.show(opacityButton, 0, opacityButton.getHeight());
     599            if (e.getSource() == opacityButton) {
     600                popup.show(opacityButton, 0, opacityButton.getHeight());
     601            } else {
     602                // Action can be trigger either by opacity button or by popup menu (in case toggle buttons are hidden).
     603                // In that case, show it in the middle of screen (because opacityButton is not visible)
     604                popup.show(Main.parent, Main.parent.getWidth() / 2, (Main.parent.getHeight() - popup.getHeight()) / 2);
     605            }
    595606        }
    596607
Note: See TracChangeset for help on using the changeset viewer.