Fixed bug with "Highlight Continuity Areas" that makes random components

conductive
This commit is contained in:
Branislav Stojkovic
2019-03-01 09:51:55 +01:00
parent c9a32cc390
commit b0123db3e7
6 changed files with 21 additions and 2 deletions
@@ -36,4 +36,6 @@ public interface IDrawingObserver {
void stopTrackingContinuityArea(); void stopTrackingContinuityArea();
void startTrackingContinuityArea(boolean positive); void startTrackingContinuityArea(boolean positive);
boolean isTrackingContinuityArea();
} }
@@ -264,6 +264,10 @@ public class DrawingManager {
// Draw the component through the g2dWrapper. // Draw the component through the g2dWrapper.
try { try {
component.draw(g2dWrapper, state, drawOptions.contains(DrawOption.OUTLINE_MODE), project, g2dWrapper); component.draw(g2dWrapper, state, drawOptions.contains(DrawOption.OUTLINE_MODE), project, g2dWrapper);
if (g2dWrapper.isTrackingContinuityArea()) {
LOG.info("Component " + component.getName() + " of type " + component.getClass().getName() + " did not stop tracking continuity area.");
g2dWrapper.stopTrackingContinuityArea();
}
} catch (Exception e) { } catch (Exception e) {
LOG.error("Error drawing " + component.getName(), e); LOG.error("Error drawing " + component.getName(), e);
failedComponents.add(component); failedComponents.add(component);
@@ -162,6 +162,10 @@ class G2DWrapper extends Graphics2D implements IDrawingObserver {
this.trackingContinuityAllowed = false; this.trackingContinuityAllowed = false;
} }
@Override
public boolean isTrackingContinuityArea() {
return trackingContinuityAllowed;
}
/** /**
* Appends shape interior to the current component area. * Appends shape interior to the current component area.
@@ -348,6 +348,9 @@ public abstract class AbstractLeadedComponent<T> extends AbstractTransparentComp
g2d.setColor(getLeadColorForPainting(componentState)); g2d.setColor(getLeadColorForPainting(componentState));
g2d.setStroke(stroke); g2d.setStroke(stroke);
g2d.draw(line); g2d.draw(line);
if (isCopperArea)
observer.stopTrackingContinuityArea();
} }
} }
@@ -25,6 +25,7 @@ import java.awt.Color;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.awt.Point; import java.awt.Point;
import org.diylc.common.ObjectCache;
import org.diylc.common.SimpleComponentTransformer; import org.diylc.common.SimpleComponentTransformer;
import org.diylc.components.AbstractComponent; import org.diylc.components.AbstractComponent;
import org.diylc.components.boards.AbstractBoard; import org.diylc.components.boards.AbstractBoard;
@@ -72,6 +73,7 @@ public class TraceCut extends AbstractComponent<Void> {
if (checkPointsClipped(g2d.getClip())) { if (checkPointsClipped(g2d.getClip())) {
return; return;
} }
g2d.setStroke(ObjectCache.getInstance().fetchZoomableStroke(1f));
int size = getClosestOdd((int) this.size.convertToPixels()); int size = getClosestOdd((int) this.size.convertToPixels());
int cutWidth = getClosestOdd((int) CUT_WIDTH.convertToPixels()); int cutWidth = getClosestOdd((int) CUT_WIDTH.convertToPixels());
if (getCutBetweenHoles()) { if (getCutBetweenHoles()) {
+4
View File
@@ -2534,6 +2534,10 @@
<changeType>IMPROVEMENT</changeType> <changeType>IMPROVEMENT</changeType>
<description>Increase the range of zoom slider for images to 500%</description> <description>Increase the range of zoom slider for images to 500%</description>
</org.diylc.appframework.update.Change> </org.diylc.appframework.update.Change>
<org.diylc.appframework.update.Change>
<changeType>BUG_FIX</changeType>
<description>Fixed bug with "Highlight Connected Areas" that makes random components conductive</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>