add meta for zoom shortcuts

This commit is contained in:
bancika
2020-09-18 21:24:04 +02:00
parent 9372858596
commit 7a5a6a469d
@@ -141,10 +141,18 @@ public class CanvasPanel extends JComponent implements Autoscroll {
.put(KeyStroke.getKeyStroke(KeyEvent.VK_ADD, KeyEvent.CTRL_DOWN_MASK), "zoomIn");
getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW)
.put(KeyStroke.getKeyStroke(KeyEvent.VK_SUBTRACT, KeyEvent.CTRL_DOWN_MASK), "zoomOut");
getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW)
.put(KeyStroke.getKeyStroke(KeyEvent.VK_ADD, KeyEvent.META_DOWN_MASK), "zoomIn");
getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW)
.put(KeyStroke.getKeyStroke(KeyEvent.VK_SUBTRACT, KeyEvent.META_DOWN_MASK), "zoomOut");
getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW)
.put(KeyStroke.getKeyStroke(KeyEvent.VK_0, KeyEvent.CTRL_DOWN_MASK), "resetZoom");
getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW)
.put(KeyStroke.getKeyStroke(KeyEvent.VK_NUMPAD0, KeyEvent.CTRL_DOWN_MASK), "resetZoom");
.put(KeyStroke.getKeyStroke(KeyEvent.VK_NUMPAD0, KeyEvent.CTRL_DOWN_MASK), "resetZoom");
getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW)
.put(KeyStroke.getKeyStroke(KeyEvent.VK_0, KeyEvent.META_DOWN_MASK), "resetZoom");
getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW)
.put(KeyStroke.getKeyStroke(KeyEvent.VK_NUMPAD0, KeyEvent.META_DOWN_MASK), "resetZoom");
for (int i = 1; i <= 12; i++) {
final int x = i;
@@ -219,8 +227,8 @@ public class CanvasPanel extends JComponent implements Autoscroll {
@SuppressWarnings("unchecked")
@Override
public void actionPerformed(ActionEvent e) {
List<String> recent = (List<String>) configManager
.readObject(IPlugInPort.RECENT_COMPONENTS_KEY, null);
List<String> recent =
(List<String>) configManager.readObject(IPlugInPort.RECENT_COMPONENTS_KEY, null);
if (recent != null && !recent.isEmpty()) {
String clazz = recent.get(0);
Map<String, List<ComponentType>> componentTypes =
@@ -242,7 +250,8 @@ public class CanvasPanel extends JComponent implements Autoscroll {
@SuppressWarnings("unchecked")
protected void functionKeyPressed(int i) {
HashMap<String, String> shortcutMap = (HashMap<String, String>) configManager.readObject(TreePanel.COMPONENT_SHORTCUT_KEY, null);
HashMap<String, String> shortcutMap =
(HashMap<String, String>) configManager.readObject(TreePanel.COMPONENT_SHORTCUT_KEY, null);
if (shortcutMap == null)
return;
String typeName = shortcutMap.get("F" + i);
@@ -313,8 +322,8 @@ public class CanvasPanel extends JComponent implements Autoscroll {
}
Set<DrawOption> drawOptions = EnumSet.of(DrawOption.SELECTION, DrawOption.ZOOM,
DrawOption.CONTROL_POINTS);
Set<DrawOption> drawOptions =
EnumSet.of(DrawOption.SELECTION, DrawOption.ZOOM, DrawOption.CONTROL_POINTS);
if (configManager.readBoolean(IPlugInPort.ANTI_ALIASING_KEY, true)) {
drawOptions.add(DrawOption.ANTIALIASING);