mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 17:22:09 +10:00
Fix the issue with tube symbol mirroring
This commit is contained in:
@@ -2856,11 +2856,15 @@
|
|||||||
</org.diylc.appframework.update.Change>
|
</org.diylc.appframework.update.Change>
|
||||||
<org.diylc.appframework.update.Change>
|
<org.diylc.appframework.update.Change>
|
||||||
<changeType>BUG_FIX</changeType>
|
<changeType>BUG_FIX</changeType>
|
||||||
<description>Fix the issue with theme configuration that causes the app to fail to start and some components to fail to render</description>
|
<description>Choosing a default theme in the Config menut causes the app to fail to start and some components to fail to render</description>
|
||||||
</org.diylc.appframework.update.Change>
|
</org.diylc.appframework.update.Change>
|
||||||
<org.diylc.appframework.update.Change>
|
<org.diylc.appframework.update.Change>
|
||||||
<changeType>BUG_FIX</changeType>
|
<changeType>BUG_FIX</changeType>
|
||||||
<description>Fix the issue tube socket pins that can be dragged independently from the socket</description>
|
<description>Fixed the issue with tube symbol mirroring</description>
|
||||||
|
</org.diylc.appframework.update.Change>
|
||||||
|
<org.diylc.appframework.update.Change>
|
||||||
|
<changeType>BUG_FIX</changeType>
|
||||||
|
<description>Fixed tube socket pins that can be dragged independently from the socket</description>
|
||||||
</org.diylc.appframework.update.Change>
|
</org.diylc.appframework.update.Change>
|
||||||
</changes>
|
</changes>
|
||||||
<url>https://github.com/bancika/diy-layout-creator/releases</url>
|
<url>https://github.com/bancika/diy-layout-creator/releases</url>
|
||||||
|
|||||||
Binary file not shown.
@@ -26,6 +26,7 @@ import java.awt.geom.AffineTransform;
|
|||||||
|
|
||||||
import org.diylc.common.IComponentTransformer;
|
import org.diylc.common.IComponentTransformer;
|
||||||
import org.diylc.common.Orientation;
|
import org.diylc.common.Orientation;
|
||||||
|
import org.diylc.components.semiconductors.SymbolFlipping;
|
||||||
import org.diylc.components.tube.AbstractTubeSymbol;
|
import org.diylc.components.tube.AbstractTubeSymbol;
|
||||||
import org.diylc.core.IDIYComponent;
|
import org.diylc.core.IDIYComponent;
|
||||||
|
|
||||||
@@ -71,54 +72,33 @@ public class TubeSymbolTransformer implements IComponentTransformer {
|
|||||||
public void mirror(IDIYComponent<?> component, Point center, int direction) {
|
public void mirror(IDIYComponent<?> component, Point center, int direction) {
|
||||||
AbstractTubeSymbol tube = (AbstractTubeSymbol) component;
|
AbstractTubeSymbol tube = (AbstractTubeSymbol) component;
|
||||||
|
|
||||||
|
Orientation o = tube.getOrientation();
|
||||||
|
SymbolFlipping flip = tube.getFlip();
|
||||||
|
|
||||||
if (direction == IComponentTransformer.HORIZONTAL) {
|
if (direction == IComponentTransformer.HORIZONTAL) {
|
||||||
int dx = 2 * (center.x - tube.getControlPoint(0).x);
|
if (o == Orientation.DEFAULT || o == Orientation._180) {
|
||||||
int dy = 0;
|
if (flip == SymbolFlipping.NONE)
|
||||||
|
tube.setFlip(SymbolFlipping.X);
|
||||||
Orientation o = tube.getOrientation();
|
else if (flip == SymbolFlipping.X)
|
||||||
switch (o) {
|
tube.setFlip(SymbolFlipping.NONE);
|
||||||
case DEFAULT:
|
} else if (o == Orientation._90 || o == Orientation._270) {
|
||||||
o = Orientation._180;
|
if (flip == SymbolFlipping.NONE)
|
||||||
break;
|
tube.setFlip(SymbolFlipping.Y);
|
||||||
case _90:
|
else if (flip == SymbolFlipping.Y)
|
||||||
break;
|
tube.setFlip(SymbolFlipping.NONE);
|
||||||
case _180:
|
|
||||||
o = Orientation.DEFAULT;
|
|
||||||
break;
|
|
||||||
case _270:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < tube.getControlPointCount(); i++) {
|
|
||||||
Point p = tube.getControlPoint(i);
|
|
||||||
tube.setControlPoint(new Point(p.x + dx, p.y + dy), i);
|
|
||||||
}
|
|
||||||
|
|
||||||
tube.setOrientation(o);
|
|
||||||
} else {
|
} else {
|
||||||
int dx = 0;
|
if (o == Orientation.DEFAULT || o == Orientation._180) {
|
||||||
int dy = 2 * (center.y - tube.getControlPoint(0).y);
|
if (flip == SymbolFlipping.NONE)
|
||||||
|
tube.setFlip(SymbolFlipping.Y);
|
||||||
Orientation o = tube.getOrientation();
|
else if (flip == SymbolFlipping.Y)
|
||||||
switch (o) {
|
tube.setFlip(SymbolFlipping.NONE);
|
||||||
case DEFAULT:
|
} else if (o == Orientation._90 || o == Orientation._270) {
|
||||||
break;
|
if (flip == SymbolFlipping.NONE)
|
||||||
case _90:
|
tube.setFlip(SymbolFlipping.X);
|
||||||
o = Orientation._270;
|
else if (flip == SymbolFlipping.X)
|
||||||
break;
|
tube.setFlip(SymbolFlipping.NONE);
|
||||||
case _180:
|
|
||||||
break;
|
|
||||||
case _270:
|
|
||||||
o = Orientation._90;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < tube.getControlPointCount(); i++) {
|
|
||||||
Point p = tube.getControlPoint(i);
|
|
||||||
tube.setControlPoint(new Point(p.x + dx, p.y + dy), i);
|
|
||||||
}
|
|
||||||
|
|
||||||
tube.setOrientation(o);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user