diff --git a/.changeset/breezy-tables-build.md b/.changeset/breezy-tables-build.md new file mode 100644 index 000000000..4fc16861f --- /dev/null +++ b/.changeset/breezy-tables-build.md @@ -0,0 +1,5 @@ +--- +'@antv/g-lite': patch +--- + +Make sure offset widht & height existed. diff --git a/packages/g-lite/src/services/EventService.ts b/packages/g-lite/src/services/EventService.ts index e0b3cc6ba..a003ddadb 100644 --- a/packages/g-lite/src/services/EventService.ts +++ b/packages/g-lite/src/services/EventService.ts @@ -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,