mirror of
https://github.com/scratchfoundation/scratch-paint.git
synced 2024-12-23 05:52:42 -05:00
Change fill logic to prevent setting gradients by accident
This commit is contained in:
parent
f95d458b45
commit
5a3cb1c8de
1 changed files with 5 additions and 3 deletions
|
@ -178,10 +178,12 @@ class FillTool extends paper.Tool {
|
||||||
_setFillItemColor (color1, color2, gradientType, pointerLocation) {
|
_setFillItemColor (color1, color2, gradientType, pointerLocation) {
|
||||||
const item = this._getFillItem();
|
const item = this._getFillItem();
|
||||||
if (!item) return;
|
if (!item) return;
|
||||||
if (color1 instanceof paper.Color || gradientType === GradientTypes.SOLID) {
|
// Only create a gradient if specifically requested, else use color1 directly
|
||||||
item.fillColor = color1;
|
// This ensures we do not set a gradient by accident (see scratch-paint#830).
|
||||||
} else {
|
if (gradientType && gradientType !== GradientTypes.SOLID) {
|
||||||
item.fillColor = createGradientObject(color1, color2, gradientType, item.bounds, pointerLocation);
|
item.fillColor = createGradientObject(color1, color2, gradientType, item.bounds, pointerLocation);
|
||||||
|
} else {
|
||||||
|
item.fillColor = color1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_getFillItem () {
|
_getFillItem () {
|
||||||
|
|
Loading…
Reference in a new issue