mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 17:22:09 +10:00
Transistor would disappear when "Folded" is selected
This commit is contained in:
@@ -2940,7 +2940,7 @@
|
|||||||
</org.diylc.appframework.update.Change>
|
</org.diylc.appframework.update.Change>
|
||||||
<org.diylc.appframework.update.Change>
|
<org.diylc.appframework.update.Change>
|
||||||
<changeType>NEW_FEATURE</changeType>
|
<changeType>NEW_FEATURE</changeType>
|
||||||
<description>Added "Sub-Mini" tube</description>
|
<description>Added "Sub-Mini Tube" component</description>
|
||||||
</org.diylc.appframework.update.Change>
|
</org.diylc.appframework.update.Change>
|
||||||
<org.diylc.appframework.update.Change>
|
<org.diylc.appframework.update.Change>
|
||||||
<changeType>NEW_FEATURE</changeType>
|
<changeType>NEW_FEATURE</changeType>
|
||||||
@@ -2982,6 +2982,10 @@
|
|||||||
<changeType>BUG_FIX</changeType>
|
<changeType>BUG_FIX</changeType>
|
||||||
<description>All terminals of a "Terminal Strip" were connected together by mistake</description>
|
<description>All terminals of a "Terminal Strip" were connected together by mistake</description>
|
||||||
</org.diylc.appframework.update.Change>
|
</org.diylc.appframework.update.Change>
|
||||||
|
<org.diylc.appframework.update.Change>
|
||||||
|
<changeType>BUG_FIX</changeType>
|
||||||
|
<description>Transistor would disappear when "Folded" is selected</description>
|
||||||
|
</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>
|
||||||
</org.diylc.appframework.update.Version>
|
</org.diylc.appframework.update.Version>
|
||||||
|
|||||||
+29
-3
@@ -27,6 +27,7 @@ import java.awt.Graphics2D;
|
|||||||
import java.awt.Point;
|
import java.awt.Point;
|
||||||
import java.awt.geom.Area;
|
import java.awt.geom.Area;
|
||||||
import java.awt.geom.Rectangle2D;
|
import java.awt.geom.Rectangle2D;
|
||||||
|
import java.awt.geom.Rectangle2D.Double;
|
||||||
|
|
||||||
import org.diylc.awt.StringUtils;
|
import org.diylc.awt.StringUtils;
|
||||||
import org.diylc.common.HorizontalAlignment;
|
import org.diylc.common.HorizontalAlignment;
|
||||||
@@ -218,9 +219,34 @@ public abstract class AbstractTransistorPackage extends AbstractTransparentCompo
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Rectangle2D getCachingBounds() {
|
public Rectangle2D getCachingBounds() {
|
||||||
int margin = 20;
|
int margin = 50;
|
||||||
Rectangle2D bounds = getBody()[0].getBounds2D();
|
double minX = Integer.MAX_VALUE;
|
||||||
return new Rectangle2D.Double(bounds.getX() - margin, bounds.getY() - margin, bounds.getWidth() + 2 * margin, bounds.getHeight() + 2 * margin);
|
double minY = Integer.MAX_VALUE;
|
||||||
|
double maxX = Integer.MIN_VALUE;
|
||||||
|
double maxY = Integer.MIN_VALUE;
|
||||||
|
for(Area a : getBody())
|
||||||
|
if (a != null) {
|
||||||
|
Rectangle2D b = a.getBounds2D();
|
||||||
|
if (b.getMinX() < minX)
|
||||||
|
minX = b.getMinX();
|
||||||
|
if (b.getMaxX() > minX)
|
||||||
|
maxX = b.getMaxX();
|
||||||
|
if (b.getMinY() < minY)
|
||||||
|
minY = b.getMinY();
|
||||||
|
if (b.getMaxY() > minY)
|
||||||
|
maxY = b.getMaxY();
|
||||||
|
}
|
||||||
|
for (Point p : controlPoints) {
|
||||||
|
if (p.getX() < minX)
|
||||||
|
minX = p.getX();
|
||||||
|
if (p.getX() > minX)
|
||||||
|
maxX = p.getX();
|
||||||
|
if (p.getY() < minY)
|
||||||
|
minY = p.getY() ;
|
||||||
|
if (p.getY() > minY)
|
||||||
|
maxY = p.getY() ;
|
||||||
|
}
|
||||||
|
return new Rectangle2D.Double(minX - margin, minY - margin, maxX - minX + 2 * margin, maxY - minY + 2 * margin);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean flipPinoutLabel() {
|
protected boolean flipPinoutLabel() {
|
||||||
|
|||||||
Reference in New Issue
Block a user