Skip to content

Commit efe3cb2

Browse files
committed
Remove unnecessary clean-up in Toolbar.#adjustScaleWidth
While zeroing the temporary `canvas` makes sense, manually clearing the canvas and its context doesn't really accomplish anything since those are tied to the scope of the method.
1 parent 3dd8b9c commit efe3cb2

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

web/toolbar.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,8 @@ class Toolbar {
260260
);
261261

262262
// The temporary canvas is used to measure text length in the DOM.
263-
let canvas = document.createElement("canvas");
264-
let ctx = canvas.getContext("2d", { alpha: false });
263+
const canvas = document.createElement("canvas");
264+
const ctx = canvas.getContext("2d", { alpha: false });
265265
ctx.font = `${style.fontSize} ${style.fontFamily}`;
266266

267267
let maxWidth = 0;
@@ -281,7 +281,6 @@ class Toolbar {
281281
// immediately, which can greatly reduce memory consumption.
282282
canvas.width = 0;
283283
canvas.height = 0;
284-
canvas = ctx = null;
285284
}
286285
}
287286

0 commit comments

Comments
 (0)