Fixed the issue with 'Add Flexible Leads' functionality placing the flexible leads wrong on leaded components (e.g. resistors, capacitors...)

This commit is contained in:
Bane Stojkovic
2022-03-07 19:21:58 +01:00
parent b646d90179
commit d513cb2667
10 changed files with 27 additions and 11 deletions
@@ -471,8 +471,6 @@ public class CanvasPlugin implements IPlugIn, ClipboardOwner {
public void zoom(int direction) {
Point mousePosBefore = canvasPanel.getMousePosition(true);
Point locationBefore = canvasPanel.getLocation();
int relativeX = (int) (mousePosBefore.getX() + locationBefore.getX());
int relativeY = (int) (mousePosBefore.getY() + locationBefore.getY());
// change zoom level
double oldZoom = plugInPort.getZoomLevel();
@@ -504,6 +502,8 @@ public class CanvasPlugin implements IPlugIn, ClipboardOwner {
if (selectionBounds == null) {
// center to cursor
int relativeX = (int) (mousePosBefore.getX() + locationBefore.getX());
int relativeY = (int) (mousePosBefore.getY() + locationBefore.getY());
Point desiredPos = new Point((int) (1d * mousePosBefore.getX() / oldZoom * newZoom),
(int) (1d * mousePosBefore.getY() / oldZoom * newZoom));
int newHorizontalPos = (int) (desiredPos.getX() - relativeX);