mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-11 01:32:08 +10:00
meta zoom and two finger click fixes for mac
This commit is contained in:
@@ -3280,11 +3280,23 @@
|
||||
<changes>
|
||||
<org.diylc.appframework.update.Change>
|
||||
<changeType>NEW_FEATURE</changeType>
|
||||
<description>macOS: added pinch zooming functionality</description>
|
||||
<description>Added pinch zooming functionality for compatible devices (tested on Mac and Win laptops)</description>
|
||||
</org.diylc.appframework.update.Change>
|
||||
<org.diylc.appframework.update.Change>
|
||||
<changeType>IMPROVEMENT</changeType>
|
||||
<description>macOS: added meta +/- (minus and equal keys) keyboard shortcuts for zooming</description>
|
||||
<description>macOS: added meta +/- keyboard shortcuts for zooming</description>
|
||||
</org.diylc.appframework.update.Change>
|
||||
<org.diylc.appframework.update.Change>
|
||||
<changeType>IMPROVEMENT</changeType>
|
||||
<description>macOS: two finger click shows the popup menu without deselecting a selected component</description>
|
||||
</org.diylc.appframework.update.Change>
|
||||
<org.diylc.appframework.update.Change>
|
||||
<changeType>IMPROVEMENT</changeType>
|
||||
<description>Apply context menu rotation and mirroring to Trimmer potentiometers</description>
|
||||
</org.diylc.appframework.update.Change>
|
||||
<org.diylc.appframework.update.Change>
|
||||
<changeType>IMPROVEMENT</changeType>
|
||||
<description>Apply context menu rotation and mirroring to SMD components</description>
|
||||
</org.diylc.appframework.update.Change>
|
||||
</changes>
|
||||
<url>https://github.com/bancika/diy-layout-creator/releases</url>
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -340,7 +340,7 @@ public class MainFrame extends JFrame implements ISwingUI {
|
||||
rightPanel.add(component);
|
||||
break;
|
||||
case SwingConstants.CENTER:
|
||||
centerPanel.add(component, BorderLayout.CENTER);
|
||||
centerPanel.add(component);
|
||||
break;
|
||||
default:
|
||||
throw new BadPositionException();
|
||||
|
||||
@@ -139,10 +139,14 @@ public class CanvasPanel extends JComponent implements Autoscroll {
|
||||
|
||||
getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW)
|
||||
.put(KeyStroke.getKeyStroke(KeyEvent.VK_ADD, KeyEvent.CTRL_DOWN_MASK), "zoomIn");
|
||||
getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW)
|
||||
.put(KeyStroke.getKeyStroke(KeyEvent.VK_PLUS, 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");
|
||||
.put(KeyStroke.getKeyStroke(KeyEvent.VK_ADD, KeyEvent.META_DOWN_MASK), "zoomIn");
|
||||
getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW)
|
||||
.put(KeyStroke.getKeyStroke(KeyEvent.VK_PLUS, KeyEvent.META_DOWN_MASK), "zoomIn");
|
||||
getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW)
|
||||
.put(KeyStroke.getKeyStroke(KeyEvent.VK_EQUALS, KeyEvent.META_DOWN_MASK), "zoomIn");
|
||||
getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW)
|
||||
|
||||
@@ -258,9 +258,12 @@ public class CanvasPlugin implements IPlugIn, ClipboardOwner {
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
if (scrollPane.isMouseScrollMode() || e.getButton() == MouseEvent.BUTTON2)
|
||||
return;
|
||||
|
||||
// do not pass isMetaDown on mac when button3 (two finger click) is pressed
|
||||
boolean ctrlDown = Utils.isMac() ? (e.getButton() == MouseEvent.BUTTON3 ? false : e.isMetaDown()): e.isControlDown();
|
||||
|
||||
plugInPort.mouseClicked(e.getPoint(), e.getButton(),
|
||||
Utils.isMac() ? e.isMetaDown() : e.isControlDown(), e.isShiftDown(), e.isAltDown(),
|
||||
e.getClickCount());
|
||||
ctrlDown, e.isShiftDown(), e.isAltDown(), e.getClickCount());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -466,7 +469,7 @@ public class CanvasPlugin implements IPlugIn, ClipboardOwner {
|
||||
}
|
||||
|
||||
public void zoom(int direction) {
|
||||
Point mousePos = canvasPanel.getMousePosition(true);
|
||||
Point mousePos = canvasPanel.getMousePosition(true);
|
||||
|
||||
// change zoom level
|
||||
double oldZoom = plugInPort.getZoomLevel();
|
||||
@@ -491,6 +494,9 @@ public class CanvasPlugin implements IPlugIn, ClipboardOwner {
|
||||
|
||||
JScrollBar horizontal = scrollPane.getHorizontalScrollBar();
|
||||
JScrollBar vertical = scrollPane.getVerticalScrollBar();
|
||||
|
||||
if (mousePos == null)
|
||||
mousePos = new Point((int)visibleRect.getCenterX(), (int)visibleRect.getCenterY());
|
||||
|
||||
if (selectionBounds == null) {
|
||||
// center to cursor
|
||||
|
||||
Reference in New Issue
Block a user