Skip to content

Commit

Permalink
fix: make sure offset widht & height existed #1683
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoiver committed May 9, 2024
1 parent e97c686 commit 1cabc6a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/g-lite/src/services/EventService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,10 @@ export class EventService {
this.context.contextService.getDomElement() as HTMLCanvasElement;
if ($el && bbox) {
const { offsetWidth, offsetHeight } = $el;
scaleX = bbox.width / offsetWidth;
scaleY = bbox.height / offsetHeight;
if (offsetWidth && offsetHeight) {
scaleX = bbox.width / offsetWidth;
scaleY = bbox.height / offsetHeight;
}
}
return {
scaleX,
Expand Down

0 comments on commit 1cabc6a

Please sign in to comment.