source: josm/trunk/src/org/openstreetmap/josm/actions/ZoomInAction.java@ 6049

Last change on this file since 6049 was 5926, checked in by bastiK, 11 years ago

clean up imports

  • Property svn:eol-style set to native
File size: 1.3 KB
Line 
1// License: GPL. Copyright 2007 by Immanuel Scholz and others
2package org.openstreetmap.josm.actions;
3
4import static org.openstreetmap.josm.gui.help.HelpUtil.ht;
5import static org.openstreetmap.josm.tools.I18n.tr;
6
7import java.awt.event.ActionEvent;
8import java.awt.event.KeyEvent;
9
10import org.openstreetmap.josm.Main;
11import org.openstreetmap.josm.tools.Shortcut;
12
13public final class ZoomInAction extends JosmAction {
14
15 public ZoomInAction() {
16 super(
17 tr("Zoom In"),
18 "dialogs/zoomin",
19 tr("Zoom In"),
20 Shortcut.registerShortcut("view:zoomin", tr("View: {0}", tr("Zoom In")),KeyEvent.VK_PLUS, Shortcut.DIRECT),
21 true
22 );
23 putValue("help", ht("/Action/ZoomIn"));
24 // make numpad + behave like +
25 Main.registerActionShortcut(this,
26 Shortcut.registerShortcut("view:zoominkeypad", tr("View: {0}", tr("Zoom In (Keypad)")),
27 KeyEvent.VK_ADD, Shortcut.DIRECT));
28 }
29
30 public void actionPerformed(ActionEvent e) {
31 if (!Main.isDisplayingMapView()) return;
32 Main.map.mapView.zoomToFactor(1/Math.sqrt(2));
33 }
34
35 @Override
36 protected void updateEnabledState() {
37 setEnabled(
38 Main.isDisplayingMapView()
39 && Main.map.mapView.hasLayers()
40 );
41 }
42
43}
Note: See TracBrowser for help on using the repository browser.