Skip to content

Commit 33825b0

Browse files
committed
fix: handle null color
1 parent a510c17 commit 33825b0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Diff for: src/shapes/shape.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ export function stringProperty(...args) {
9797
export function colorProperty(target: any, k?, desc?: PropertyDescriptor): any;
9898
export function colorProperty(options: ShapePropertyOptions): (target: any, k?, desc?: PropertyDescriptor) => any;
9999
export function colorProperty(...args) {
100-
return shapeProperty((v) => new Color(v), args);
100+
return shapeProperty((v) => (v ? new Color(v) : null), args);
101101
}
102102
export function lengthProperty(target: any, k?, desc?: PropertyDescriptor): any;
103103
export function lengthProperty(options: ShapePropertyOptions): (target: any, k?, desc?: PropertyDescriptor) => any;
@@ -171,12 +171,12 @@ export default abstract class Shape extends Observable {
171171
paintSetter: applyShadow,
172172
})
173173
shadow: Shadow;
174-
@stringProperty({ nonPaintProp:true }) visibility: Visibility = 'visible';
174+
@stringProperty({ nonPaintProp: true }) visibility: Visibility = 'visible';
175175

176176
abstract drawOnCanvas(canvas: Canvas, parent: CanvasView): void;
177177

178178
drawMyShapeOnCanvas(canvas: Canvas, parent: CanvasView) {
179-
if (this.visibility!== 'visible') {
179+
if (this.visibility !== 'visible') {
180180
return;
181181
}
182182
const paint = this.paint;

0 commit comments

Comments
 (0)