Skip to content

Commit

Permalink
Destroy arrows when updating them
Browse files Browse the repository at this point in the history
Signed-off-by: Arnaud Fiorini <fiorini.arnaud@gmail.com>
  • Loading branch information
arfio authored and bhufmann committed Apr 20, 2021
1 parent 8f77d88 commit 40986f2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions timeline-chart/src/components/time-graph-arrow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ export class TimeGraphArrowComponent extends TimeGraphComponent {
this.head = new PIXI.Graphics();
}

destroy() {
this.head.destroy();
super.destroy();
}

render(): void {
const { start, end } = this._options as TimeGraphArrowCoordinates;
this._displayObject.lineStyle(1, 0x000000);
Expand Down
4 changes: 4 additions & 0 deletions timeline-chart/src/components/time-graph-component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ export abstract class TimeGraphComponent {
this._displayObject.clear();
}

destroy() {
this._displayObject.destroy();
}

update(opts?: TimeGraphComponentOptions) {
if (opts) {
this._options = opts;
Expand Down
3 changes: 3 additions & 0 deletions timeline-chart/src/layer/time-graph-chart-arrows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ export class TimeGraphChartArrows extends TimeGraphChartLayer {
if (!this.stateController) {
throw ('Add this TimeGraphChartArrows to a container before adding arrows.');
}
if (this.arrows) {
this.arrows.forEach(rowEl => rowEl.destroy());
}
this.arrows = new Map();
arrows.forEach(arrow => {
this.addArrow(arrow);
Expand Down

0 comments on commit 40986f2

Please sign in to comment.