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

Avoid using DOM elements #22

Closed
tmcw opened this issue Jul 15, 2015 · 10 comments
Closed

Avoid using DOM elements #22

tmcw opened this issue Jul 15, 2015 · 10 comments

Comments

@tmcw
Copy link
Contributor

tmcw commented Jul 15, 2015

Many of the guides and intermediate drawing UI in gl-draw are constructed using divs and CSS: these should be implemented in GL land instead.

@tristen
Copy link
Member

tristen commented Jul 15, 2015

Where are we using DOM elements?

@tristen
Copy link
Member

tristen commented Jul 15, 2015

These are guides for heaven's sake!

@tristen
Copy link
Member

tristen commented Jul 15, 2015

And it's much faster to render these as DOM elements than burning them into the canvas only to remove them when a feature is drawn.

@tmcw
Copy link
Contributor Author

tmcw commented Jul 15, 2015

Is it? GL needs to be fast enough to power a drawing interface without resorting to DOM overlays.

@tristen
Copy link
Member

tristen commented Jul 15, 2015

It has to be. The latency between adding a marker and rendering on a map is still pretty long. These are likely to only ever be the DOM elements constructed. Why is this a problem exactly?

@tmcw
Copy link
Contributor Author

tmcw commented Jul 15, 2015

Because it splits the styling and design worlds. Handler divs will be accidentally restyled by people's CSS. When someone customizes the style of the drawn layer in GL JSON, they'll have to customize the style of the guide in CSS to match. When we port this to native, we'll have to make an exception to the GL-only canvas and draw over it in retained mode.

@tristen
Copy link
Member

tristen commented Jul 15, 2015

When we port this to native, we'll have to make an exception to the GL-only canvas and draw over it in retained mode.

This is the only reasonable argument you are making.

@1ec5
Copy link

1ec5 commented Jul 29, 2015

I don’t see how this simplifies much for gl-native. At least on iOS, implementing these guides would be more straightforward as native views than baked into GL. We want to / have to support native views as annotations anyways: mapbox/mapbox-gl-native#1784. (Performance would theoretically be better in GL, but animation and gesture recognition are much better on native views.)

As for the Web, how will resize handles be given grab cursors on mouseover and while dragging?

@tmcw
Copy link
Contributor Author

tmcw commented Jul 29, 2015

As for the Web, how will resize handles be given grab cursors on mouseover and while dragging?

The same as in Canvas & WebGL based applications: by setting a cursor class on the canvas.

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

3 participants