mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 09:12:09 +10:00
refine zero location
This commit is contained in:
@@ -165,6 +165,14 @@ public class CanvasPlugin implements IPlugIn, ClipboardOwner {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ConfigurationManager.getInstance().addConfigListener(IPlugInPort.METRIC_KEY, new IConfigListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void valueChanged(String key, Object value) {
|
||||||
|
updateZeroLocation();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
ConfigurationManager.getInstance().addConfigListener(IPlugInPort.EXTRA_SPACE_KEY, new IConfigListener() {
|
ConfigurationManager.getInstance().addConfigListener(IPlugInPort.EXTRA_SPACE_KEY, new IConfigListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -177,8 +185,7 @@ public class CanvasPlugin implements IPlugIn, ClipboardOwner {
|
|||||||
canvasPanel.scrollRectToVisible(visibleRect);
|
canvasPanel.scrollRectToVisible(visibleRect);
|
||||||
canvasPanel.revalidate();
|
canvasPanel.revalidate();
|
||||||
|
|
||||||
double extraSpace = CanvasPlugin.this.plugInPort.getExtraSpace();
|
updateZeroLocation();
|
||||||
getScrollPane().setZeroLocation(new Point2D.Double(extraSpace, extraSpace));
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -687,8 +694,7 @@ public class CanvasPlugin implements IPlugIn, ClipboardOwner {
|
|||||||
canvasPanel.scrollRectToVisible(visibleRect);
|
canvasPanel.scrollRectToVisible(visibleRect);
|
||||||
canvasPanel.revalidate();
|
canvasPanel.revalidate();
|
||||||
|
|
||||||
double extraSpace = CanvasPlugin.this.plugInPort.getExtraSpace();
|
updateZeroLocation();
|
||||||
getScrollPane().setZeroLocation(new Point2D.Double(extraSpace, extraSpace));
|
|
||||||
|
|
||||||
zoomLevel = (Double) params[0];
|
zoomLevel = (Double) params[0];
|
||||||
break;
|
break;
|
||||||
@@ -736,4 +742,9 @@ public class CanvasPlugin implements IPlugIn, ClipboardOwner {
|
|||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateZeroLocation() {
|
||||||
|
double extraSpace = CanvasPlugin.this.plugInPort.getExtraSpace();
|
||||||
|
getScrollPane().setZeroLocation(new Point2D.Double(extraSpace, extraSpace));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -105,7 +105,6 @@ public class StatusBar extends JPanel implements IPlugIn {
|
|||||||
private List<String> selectedComponentNames;
|
private List<String> selectedComponentNames;
|
||||||
private List<String> stuckComponentNames;
|
private List<String> stuckComponentNames;
|
||||||
private String statusMessage;
|
private String statusMessage;
|
||||||
private Point mousePosition;
|
|
||||||
|
|
||||||
private AnnouncementProvider announcementProvider;
|
private AnnouncementProvider announcementProvider;
|
||||||
|
|
||||||
@@ -482,7 +481,7 @@ public class StatusBar extends JPanel implements IPlugIn {
|
|||||||
if (mousePosition == null)
|
if (mousePosition == null)
|
||||||
getPositionLabel().setText(null);
|
getPositionLabel().setText(null);
|
||||||
else
|
else
|
||||||
getPositionLabel().setText(String.format("@%.2f %.2f " + (metric ? "mm" : "in"), mousePosition.getX(), mousePosition.getY()));
|
getPositionLabel().setText(String.format("x:%.2f y:%.2f " + (metric ? "mm" : "in"), mousePosition.getX(), mousePosition.getY()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void refreshStatusText() {
|
private void refreshStatusText() {
|
||||||
|
|||||||
Reference in New Issue
Block a user