mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-07 12:24:58 +10:00
Application freezes when using underside rendering or mirroring on 'Pin Header' when sized at 1x1
This commit is contained in:
+14
@@ -70,6 +70,20 @@ public class PinHeaderTransformer implements IComponentTransformer {
|
||||
@Override
|
||||
public void mirror(IDIYComponent<?> component, Point2D center, int direction) {
|
||||
PinHeader header = (PinHeader) component;
|
||||
int controlPointCount = header.getControlPointCount();
|
||||
|
||||
// Handle single-pin case
|
||||
if (controlPointCount == 1) {
|
||||
Point2D p = header.getControlPoint(0);
|
||||
if (direction == IComponentTransformer.HORIZONTAL) {
|
||||
double dx = 2 * (center.getX() - p.getX());
|
||||
header.setControlPoint(new Point2D.Double(p.getX() + dx, p.getY()), 0);
|
||||
} else {
|
||||
double dy = 2 * (center.getY() - p.getY());
|
||||
header.setControlPoint(new Point2D.Double(p.getX(), p.getY() + dy), 0);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (direction == IComponentTransformer.HORIZONTAL) {
|
||||
double dx = 2 * (center.getX() - header.getControlPoint(1).getX());
|
||||
|
||||
Reference in New Issue
Block a user