Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(event): there is no target for pointerupoutside event #5100

Merged
merged 1 commit into from
May 26, 2023

Conversation

pearmini
Copy link
Member

@pearmini pearmini commented May 26, 2023

pointerupoutside 这个事件没有 target 对象,chart.emit 需要注意。

image

@pearmini pearmini requested review from hustcc and xiaoiver May 26, 2023 05:51
@pearmini pearmini force-pushed the fix/event-pointerupoutside branch from c722f59 to af2b267 Compare May 26, 2023 05:52
@xiaoiver
Copy link
Contributor

xiaoiver commented May 26, 2023

在 Canvas 内按下,再在画布范围之外抬起(例如页面上 <canvas> 之外的某个 DOM 元素)。此时 ev.target 就是 undefined(因为拾取不到了),毕竟已经脱离了 Canvas 范围了。

但如果想在这种情况下让 target 返回 document,可以通过 alwaysTriggerPointerEventOnCanvas 配置项:

const canvas = new Canvas({
  container: 'container',
  width: 600,
  height: 500,
  renderer: canvasRenderer,
  alwaysTriggerPointerEventOnCanvas: true,
});

详见:antvis/G#1332

@pearmini pearmini merged commit 641f966 into v5 May 26, 2023
3 checks passed
@pearmini pearmini deleted the fix/event-pointerupoutside branch May 26, 2023 06:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants