Skip to content

Commit

Permalink
perf(): measuring canvas size (fabricjs#9697)
Browse files Browse the repository at this point in the history
  • Loading branch information
ShaMan123 authored Feb 29, 2024
1 parent 5dbf45f commit e16980c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## [next]

- perf(): measuring canvas size [#9697](https://github.com/fabricjs/fabric.js/pull/9697)
- chore(TS): Add type for options in toCanvasElement and toDataUrl [#9673](https://github.com/fabricjs/fabric.js/pull/9673)
- ci(): add source map support to node sandbox [#9686](https://github.com/fabricjs/fabric.js/pull/9686)
- fix(Canvas): Correct type mainTouchId initialization [#9684](https://github.com/fabricjs/fabric.js/pull/9684)
Expand Down
4 changes: 3 additions & 1 deletion src/shapes/Text/Text.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ let measuringContext: CanvasRenderingContext2D | null;
*/
function getMeasuringContext() {
if (!measuringContext) {
measuringContext = createCanvasElement().getContext('2d');
const canvas = createCanvasElement();
canvas.width = canvas.height = 0;
measuringContext = canvas.getContext('2d');
}
return measuringContext;
}
Expand Down

0 comments on commit e16980c

Please sign in to comment.