mirror of
https://github.com/scratchfoundation/scratch-paint.git
synced 2024-12-22 21:42:30 -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) {
|
||||
const item = this._getFillItem();
|
||||
if (!item) return;
|
||||
if (color1 instanceof paper.Color || gradientType === GradientTypes.SOLID) {
|
||||
item.fillColor = color1;
|
||||
} else {
|
||||
// Only create a gradient if specifically requested, else use color1 directly
|
||||
// This ensures we do not set a gradient by accident (see scratch-paint#830).
|
||||
if (gradientType && gradientType !== GradientTypes.SOLID) {
|
||||
item.fillColor = createGradientObject(color1, color2, gradientType, item.bounds, pointerLocation);
|
||||
} else {
|
||||
item.fillColor = color1;
|
||||
}
|
||||
}
|
||||
_getFillItem () {
|
||||
|
|
Loading…
Reference in a new issue