Skip to content

Commit

Permalink
fix: optimize getBounds method
Browse files Browse the repository at this point in the history
  • Loading branch information
DeltaZN authored and disyakidneyshot committed Dec 4, 2023
1 parent 7ef2786 commit 8e08125
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/chart/canvas/canvas-bounds-container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -660,10 +660,12 @@ export class CanvasBoundsContainer {
* @return {Bounds} bounds of element
*/
public getBounds(el: string): Bounds {
if (this.bounds[el] === undefined) {
this.bounds[el] = this.copyOf(DEFAULT_BOUNDS);
let bounds = this.bounds[el];
if (bounds === undefined) {
bounds = this.copyOf(DEFAULT_BOUNDS);
this.bounds[el] = bounds;
}
return this.bounds[el];
return bounds;
}
/**
* Returns the position of CANVAS on whole page.
Expand Down

0 comments on commit 8e08125

Please sign in to comment.