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>