Skip to content

Commit

Permalink
fix: make sure offset widht & height existed (#1684)
Browse files Browse the repository at this point in the history
* fix: make sure offset widht & height existed #1683

* chore: commit changeset
  • Loading branch information
xiaoiver authored May 9, 2024
1 parent e97c686 commit 5dfc52e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/breezy-tables-build.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@antv/g-lite': patch
---

Make sure offset widht & height existed.
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 5dfc52e

Please sign in to comment.