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

更改鼠标样式 #684

Closed
zeroHW opened this issue May 18, 2021 · 3 comments
Closed

更改鼠标样式 #684

zeroHW opened this issue May 18, 2021 · 3 comments

Comments

@zeroHW
Copy link

zeroHW commented May 18, 2021

滑过pointlayer时鼠标样式如何改变,若更改css,有没有具体的class名

@lzxue
Copy link
Contributor

lzxue commented May 26, 2021

@lzxue lzxue closed this as completed May 26, 2021
@hellorayza
Copy link

hellorayza commented Sep 14, 2024

hi, @lzxue 目录变化很大,参照链接失效了
有什么好办法解决 mapbox 实例图层中的 mouse cursor 受到影响吗?

@ravengao
Copy link

ravengao commented Oct 4, 2024

@hellorayza 我在L7-draw里找到了类似的解决方法: https://github.com/antvis/L7Draw/blob/master/src/interactive/cursor.ts#L15
首先需要复制getMapDom的实现方式(https://github.com/antvis/L7Draw/blob/master/src/utils/common.ts#L13)
(返回的element顺序很重要,直接修改scene.getContainer().style.cursor在很多情况下是无效的)
其次,在你的鼠标事件中,修改用getMapDom获取的HTMLElement,代码示例如下:

      pointLayer.on('mousemove', event => {
        // update cursor style
        if (
          sceneRef.current &&
          getMapDom(sceneRef.current) !== null &&
          (getMapDom(sceneRef.current) as HTMLElement).style.cursor !== 'pointer'
        ) {
          (getMapDom(sceneRef.current) as HTMLElement).style.cursor = 'pointer';
        }

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

No branches or pull requests

4 participants