Fix opacity change not undo-ing properly
This commit is contained in:
parent
f39d744d67
commit
6590a76ff4
@ -216,10 +216,10 @@ public class AppearanceBuilder extends AbstractChangeSource {
|
|||||||
// Clamp opacity between 0 and 1
|
// Clamp opacity between 0 and 1
|
||||||
opacity = Math.max(0, Math.min(1, opacity));
|
opacity = Math.max(0, Math.min(1, opacity));
|
||||||
|
|
||||||
this.paint.setAlpha((int) (opacity * 255));
|
// Instead of simply setting the alpha, we need to create a new color with the new alpha value, otherwise undoing
|
||||||
if (!bypassAppearanceChangeEvent) {
|
// the setOpacity will not work correctly. (don't ask me why)
|
||||||
fireChangeEvent();
|
Color c = new Color(paint.getRed(), paint.getGreen(), paint.getBlue(), (int) (opacity * 255));
|
||||||
}
|
setPaint(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user