mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 17:22:09 +10:00
add meta for zoom shortcuts
This commit is contained in:
@@ -141,10 +141,18 @@ public class CanvasPanel extends JComponent implements Autoscroll {
|
|||||||
.put(KeyStroke.getKeyStroke(KeyEvent.VK_ADD, KeyEvent.CTRL_DOWN_MASK), "zoomIn");
|
.put(KeyStroke.getKeyStroke(KeyEvent.VK_ADD, KeyEvent.CTRL_DOWN_MASK), "zoomIn");
|
||||||
getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW)
|
getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW)
|
||||||
.put(KeyStroke.getKeyStroke(KeyEvent.VK_SUBTRACT, KeyEvent.CTRL_DOWN_MASK), "zoomOut");
|
.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)
|
getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW)
|
||||||
.put(KeyStroke.getKeyStroke(KeyEvent.VK_0, KeyEvent.CTRL_DOWN_MASK), "resetZoom");
|
.put(KeyStroke.getKeyStroke(KeyEvent.VK_0, KeyEvent.CTRL_DOWN_MASK), "resetZoom");
|
||||||
getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW)
|
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++) {
|
for (int i = 1; i <= 12; i++) {
|
||||||
final int x = i;
|
final int x = i;
|
||||||
@@ -219,8 +227,8 @@ public class CanvasPanel extends JComponent implements Autoscroll {
|
|||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
List<String> recent = (List<String>) configManager
|
List<String> recent =
|
||||||
.readObject(IPlugInPort.RECENT_COMPONENTS_KEY, null);
|
(List<String>) configManager.readObject(IPlugInPort.RECENT_COMPONENTS_KEY, null);
|
||||||
if (recent != null && !recent.isEmpty()) {
|
if (recent != null && !recent.isEmpty()) {
|
||||||
String clazz = recent.get(0);
|
String clazz = recent.get(0);
|
||||||
Map<String, List<ComponentType>> componentTypes =
|
Map<String, List<ComponentType>> componentTypes =
|
||||||
@@ -242,7 +250,8 @@ public class CanvasPanel extends JComponent implements Autoscroll {
|
|||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
protected void functionKeyPressed(int i) {
|
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)
|
if (shortcutMap == null)
|
||||||
return;
|
return;
|
||||||
String typeName = shortcutMap.get("F" + i);
|
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,
|
Set<DrawOption> drawOptions =
|
||||||
DrawOption.CONTROL_POINTS);
|
EnumSet.of(DrawOption.SELECTION, DrawOption.ZOOM, DrawOption.CONTROL_POINTS);
|
||||||
|
|
||||||
if (configManager.readBoolean(IPlugInPort.ANTI_ALIASING_KEY, true)) {
|
if (configManager.readBoolean(IPlugInPort.ANTI_ALIASING_KEY, true)) {
|
||||||
drawOptions.add(DrawOption.ANTIALIASING);
|
drawOptions.add(DrawOption.ANTIALIASING);
|
||||||
|
|||||||
Reference in New Issue
Block a user