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 end bug #10146

Open
redor85 opened this issue Oct 21, 2019 · 2 comments
Open

Draw end bug #10146

redor85 opened this issue Oct 21, 2019 · 2 comments
Labels

Comments

@redor85
Copy link

redor85 commented Oct 21, 2019

When changing the route of an Angular (8) application back to the map component/page the draw end event doesn't work as expected. On the draw end event the map suddenly disappears until the mouse is moving.

Stackblitz Example:
https://stackblitz.com/edit/angular-ol6-drawbug

Reproduce with Stackblitz:

  1. Draw some rectangles (everything works fine)
  2. Changing the route by clicking on link 'Other Component'
  3. Changing the route back to 'Map'
  4. On DrawEnd Event (do not move mouse) the map disapppears.
  5. The map comes back by moving the mouse.

I don't know whether it's a problem of Openlayers (6) or Angular (8)...

@jahow
Copy link
Contributor

jahow commented Oct 21, 2019

I believe this is a bug related to the fact that the same layers (both image and vector) are added to several maps successively when you change the route. After the initial load the map behaves fine, the problem appears when switching route at least once, which means a new map is created but the same layer reused. IMO it should be supported by the library but apparently isn't... I'm labelling as bug for this reason (but I may be wrong, this needs a bit more investigation).

Thanks for the report!

@jahow jahow added the bug label Oct 21, 2019
@Kylexii
Copy link

Kylexii commented Jan 26, 2021

I met the same bug in Vue & Vue-router project too.
Inspired by what @jahow said, I tried to call removeLayer on the map instance before component destroyed, and find it useful to aviod map flash.

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

No branches or pull requests

3 participants