Don't set color in bitmap shape onSelectionChanged

This *should* be safe because OvalTool and RectTool's wrapper "mode"
components, the only places that call onSelectionChanged, also update
the tools' color, and the color state reducers will always set the color
every time the selection changes, meaning it'll be updated anyway.
This commit is contained in:
adroitwhiz 2020-06-08 22:53:26 -04:00
parent f625109c67
commit 9f77faf5c1
2 changed files with 2 additions and 4 deletions
src/helper/bit-tools

View file

@ -76,8 +76,8 @@ class OvalTool extends paper.Tool {
this.thickness = this.oval.strokeWidth;
}
this.filled = this.oval.strokeWidth === 0;
const color = this.filled ? this.oval.fillColor : this.oval.strokeColor;
this.color = color ? color.toCSS() : null;
// We don't need to set our color from the selected oval's color because the color state reducers will
// do that for us every time the selection changes.
} else if (this.oval && this.oval.isInserted() && !this.oval.selected) {
// Oval got deselected
this.commitOval();

View file

@ -76,8 +76,6 @@ class RectTool extends paper.Tool {
this.thickness = this.rect.strokeWidth;
}
this.filled = this.rect.strokeWidth === 0;
const color = this.filled ? this.rect.fillColor : this.rect.strokeColor;
this.color = color ? color.toCSS() : null;
} else if (this.rect && this.rect.isInserted() && !this.rect.selected) {
// Rectangle got deselected
this.commitRect();