[770] | 1 | // License: GPL. Copyright 2007 by Immanuel Scholz and others
|
---|
| 2 | package org.openstreetmap.josm.actions;
|
---|
| 3 |
|
---|
[2550] | 4 | import static org.openstreetmap.josm.gui.help.HelpUtil.ht;
|
---|
[770] | 5 | import static org.openstreetmap.josm.tools.I18n.tr;
|
---|
| 6 |
|
---|
| 7 | import java.awt.event.ActionEvent;
|
---|
| 8 | import java.awt.event.KeyEvent;
|
---|
| 9 |
|
---|
| 10 | import org.openstreetmap.josm.Main;
|
---|
[1084] | 11 | import org.openstreetmap.josm.tools.Shortcut;
|
---|
[770] | 12 |
|
---|
| 13 | public final class ZoomInAction extends JosmAction {
|
---|
| 14 |
|
---|
[1169] | 15 | public ZoomInAction() {
|
---|
[2550] | 16 | super(
|
---|
| 17 | tr("Zoom In"),
|
---|
| 18 | "dialogs/zoomin",
|
---|
| 19 | tr("Zoom In"),
|
---|
[4982] | 20 | Shortcut.registerShortcut("view:zoomin", tr("View: {0}", tr("Zoom In")),KeyEvent.VK_PLUS, Shortcut.DIRECT),
|
---|
[2550] | 21 | true
|
---|
| 22 | );
|
---|
[2323] | 23 | putValue("help", ht("/Action/ZoomIn"));
|
---|
[3252] | 24 | // make numpad + behave like +
|
---|
[4891] | 25 | Main.registerActionShortcut(this,
|
---|
| 26 | Shortcut.registerShortcut("view:zoominkeypad", tr("View: {0}", tr("Zoom In (Keypad)")),
|
---|
[4982] | 27 | KeyEvent.VK_ADD, Shortcut.DIRECT));
|
---|
[1169] | 28 | }
|
---|
[770] | 29 |
|
---|
[6084] | 30 | @Override
|
---|
[1169] | 31 | public void actionPerformed(ActionEvent e) {
|
---|
[2343] | 32 | if (!Main.isDisplayingMapView()) return;
|
---|
[4494] | 33 | Main.map.mapView.zoomToFactor(1/Math.sqrt(2));
|
---|
[1169] | 34 | }
|
---|
[1854] | 35 |
|
---|
| 36 | @Override
|
---|
| 37 | protected void updateEnabledState() {
|
---|
| 38 | setEnabled(
|
---|
[2343] | 39 | Main.isDisplayingMapView()
|
---|
[1895] | 40 | && Main.map.mapView.hasLayers()
|
---|
[1854] | 41 | );
|
---|
| 42 | }
|
---|
| 43 |
|
---|
[770] | 44 | }
|
---|