Skip to content

Commit 6560b60

Browse files
committed
fix potential crash
1 parent 7a27f90 commit 6560b60

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/app/canvas/canvas.component.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,6 @@ export class CanvasComponent implements AfterViewInit, OnDestroy {
5656
@ViewChild('renderingCanvas') private renderingCanvasRef: ElementRef;
5757
@ViewChildren(CanvasRulerDirective) canvasRulers: QueryList<CanvasRulerDirective>;
5858

59-
// TODO: make use of this variable (i.e. only show labeled points for active path, etc.)
60-
private activePathId: string;
6159
private cssContainerWidth = 1;
6260
private cssContainerHeight = 1;
6361
private vlWidth = DEFAULT_VIEWPORT_SIZE;
@@ -72,7 +70,6 @@ export class CanvasComponent implements AfterViewInit, OnDestroy {
7270
private currentHover: Hover;
7371
private currentHoverSplitPreviewPath: Path;
7472
private shouldLabelPoints = false;
75-
private shouldDrawLayer = false;
7673
private shouldDisableLayer = false;
7774
private readonly subscriptions: Subscription[] = [];
7875

@@ -96,7 +93,6 @@ export class CanvasComponent implements AfterViewInit, OnDestroy {
9693
this.subscriptions.push(
9794
this.layerStateService.getVectorLayerObservable(this.canvasType)
9895
.subscribe(vl => {
99-
this.shouldDrawLayer = !!vl && !!this.activePathId;
10096
const newWidth = vl ? vl.width : DEFAULT_VIEWPORT_SIZE;
10197
const newHeight = vl ? vl.height : DEFAULT_VIEWPORT_SIZE;
10298
const didSizeChange = this.vlWidth !== newWidth || this.vlHeight !== newHeight;
@@ -146,8 +142,6 @@ export class CanvasComponent implements AfterViewInit, OnDestroy {
146142
this.subscriptions.push(
147143
this.layerStateService.getActivePathIdObservable(this.canvasType)
148144
.subscribe(activePathId => {
149-
this.activePathId = activePathId;
150-
this.shouldDrawLayer = !!this.vectorLayer && !!this.activePathId;
151145
interpolatePreview(currentAnimatedFraction);
152146
this.draw();
153147
}));
@@ -177,8 +171,6 @@ export class CanvasComponent implements AfterViewInit, OnDestroy {
177171
this.subscriptions.push(
178172
this.layerStateService.getActivePathIdObservable(this.canvasType)
179173
.subscribe(activePathId => {
180-
this.activePathId = activePathId;
181-
this.shouldDrawLayer = !!this.vectorLayer && !!this.activePathId;
182174
this.draw();
183175
}));
184176
this.subscriptions.push(
@@ -236,10 +228,18 @@ export class CanvasComponent implements AfterViewInit, OnDestroy {
236228
this.subscriptions.forEach(s => s.unsubscribe());
237229
}
238230

239-
get vectorLayer() {
231+
private get vectorLayer() {
240232
return this.layerStateService.getVectorLayer(this.canvasType);
241233
}
242234

235+
private get activePathId() {
236+
return this.layerStateService.getActivePathId(this.canvasType);
237+
}
238+
239+
private get shouldDrawLayer() {
240+
return !!this.vectorLayer && !!this.activePathId;
241+
}
242+
243243
private resizeAndDraw() {
244244
if (!this.isViewInit) {
245245
return;

0 commit comments

Comments
 (0)