fix for transparency when dragging

This commit is contained in:
Bane Stojkovic
2026-04-06 21:34:58 +02:00
parent 8318b34967
commit b034c8c761
5 changed files with 17 additions and 4 deletions
@@ -149,7 +149,7 @@ public abstract class AbstractCurvedComponent<T> extends AbstractTransparentComp
path.curveTo(p[4].getX(), p[4].getY(), p[5].getX(), p[5].getY(), p[6].getX(), p[6].getY());
}
Composite oldComposite = applyAlpha(g2d, componentState);
Composite oldComposite = applyAlpha(g2d);
drawCurve(path, g2d, componentState, drawingObserver);
@@ -64,4 +64,13 @@ public abstract class AbstractTransparentComponent<T> extends AbstractComponent<
}
return oldComposite;
}
public Composite applyAlpha(Graphics2D g2d) {
Composite oldComposite = g2d.getComposite();
int alpha = getAlpha().getValue();
if (alpha < MAX_ALPHA) {
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, alpha / 100f));
}
return oldComposite;
}
}
@@ -317,6 +317,10 @@
<changeType>NEW_FEATURE</changeType>
<description>Added more ceramic resistor variants to 'Resistor' component</description>
</org.diylc.appframework.update.Change>
<org.diylc.appframework.update.Change>
<changeType>IMPROVEMENT</changeType>
<description>Improved rendering of components while being dragged to show only the outline, making it easier to place</description>
</org.diylc.appframework.update.Change>
<org.diylc.appframework.update.Change>
<changeType>IMPROVEMENT</changeType>
<description>Improved data model for storing transparency alpha and other properties that are edited using a slider widget; as a result, the editing is more precise and does not randomly change to neighboring values</description>
@@ -64,7 +64,7 @@ public class CutLine extends AbstractTransparentComponent<Void> {
: color);
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(w));
Composite oldComposite = applyAlpha(g2d, componentState);
Composite oldComposite = applyAlpha(g2d);
if (getOrientation() == OrientationHV.HORIZONTAL)
g2d.drawLine((int)point.getX(), (int)point.getY(), (int)point.getX() + l, (int)point.getY());
@@ -41,9 +41,9 @@ import org.diylc.core.measures.Resistance;
import org.diylc.core.measures.Size;
import org.diylc.core.measures.SizeUnit;
@ComponentDescriptor(name = "Toroidal Inductor", author = "Branislav Stojkovic", category = "Passive",
@ComponentDescriptor(name = "Inductor (Toroidal)", author = "Branislav Stojkovic", category = "Passive",
creationMethod = CreationMethod.POINT_BY_POINT, instanceNamePrefix = "L",
description = "Ferrite core torroidal inductor mounted vertically", zOrder = IDIYComponent.COMPONENT,
description = "Ferrite core toroidal inductor mounted vertically", zOrder = IDIYComponent.COMPONENT,
transformer = SimpleComponentTransformer.class)
public class ToroidalInductor extends AbstractLeadedComponent<Inductance> implements IGerberComponentSimple {