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

Draw cursor not set to "crosshair" if default cursor of map is set to "default" or "pointer" #907

Open
dev-aritra opened this issue Jul 29, 2019 · 3 comments

Comments

@dev-aritra
Copy link

Draw cursor not set to "crosshair" if default cursor of map is set to "default" ,"pointer" or anything else maybe.

The draw cursor is set to "crosshair" only when the cursor style is not explicitly set.

For example if I do
map.getCanvas().style.cursor = "default"
The draw cursor is also set to "default"

But if I just remove the above-mentioned line, the draw cursor is set to "crosshair" upon selecting a draw mode.

mapbox-gl-js 1.0.0:
mapbox-gl-draw 1.1.2:

Steps to Trigger Behavior

  1. Set map cursor to anything explicitly, for example
    map.getCanvas().style.cursor = "default"
  2. Select a shape to draw
  3. See the cursor to be set as "default" instead of "crosshair"

Expected Behavior

Cursor is to be set to crosshair when a draw mode is selected.

Actual Behavior

Cursor is not set to crosshair when a draw mode is selected.

@kkaefer
Copy link
Contributor

kkaefer commented Jan 7, 2020

I'm not sure I understand this issue. It seems like you're explicitly forcing the cursor to be something else, but then you expect that the cursor still changes? Could you just remove the line that sets the cursor explicitly?

@Sultan-Alrefaei
Copy link

map.getCanvas().style.cursor = "unset";

@palhal
Copy link

palhal commented Feb 7, 2022

I had the same problem. It's not as easy as "do not set the cursor then" as the other answers here suggest.
Instead of:

map.getCanvas().style.cursor = 'default'

You should override the cursor with CSS:

.mapboxgl-canvas-container.mapboxgl-interactive,
.mapboxgl-canvas-container.mapboxgl-interactive:active {
    cursor: default;
}

This way you can override the default cursor and have the correct drawing cursors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants