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

mousemove-event-throttle #156

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

mousemove-event-throttle #156

wants to merge 4 commits into from

Conversation

lyj289
Copy link

@lyj289 lyj289 commented Dec 3, 2018

更新了两个地方:
1.百度地图的canvas-layer, _draw方法中,计算canvas元素left,top,避免0.5px的偏差
2.增加对mousemove事件的节流方法,减少事件中间的多余运算

@linghuam
Copy link

linghuam commented Dec 3, 2018

第二个用的是节流方法,但实现方式怎么感觉像防抖?
我理解的节流是周期性的触发,防抖是达到限定值时才触发。
可以参考一下这篇文章:https://mp.weixin.qq.com/s/Vkshf-nEDwo2ODUJhxgzVA

@fuzhenn
Copy link
Contributor

fuzhenn commented Dec 3, 2018

我觉得从api设计上来说,这里是否需要throttle应该商榷:

  • throttle变成了强制性的,用户无法选择
  • 用户可以通过throttle监听函数达到同样的效果

请p主参考

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.

3 participants