Web-Map-Custom-Element
Web-Map-Custom-Element copied to clipboard
Feature links layer duplication bug?
More of a feature than a big, imho
Is the bug the flickering or the fact that the layer gets added multiple times when pressed multiple times?
More of a feature than a big, imho
What's the usefulness of re-adding layers in such a manner? I can only see how it can be confusing to users.
Also, because the layer is duplicated each time it could potentially have a huge performance impact?
Is the bug the flickering or the fact that the layer gets added multiple times when pressed multiple times?
@ahmadayubi Sorry I should've been more clear, I was in a rush. It is the latter.
Is the flickering perhaps related to:
https://github.com/Maps4HTML/Web-Map-Custom-Element/blob/90540cbb67ba9ca3511087f62274a74581141831/src/mapml-viewer.js#L204-L209
?
Is the flickering perhaps related to:
I think the flickering is related to how layers are fit to the extent of the map. Since leaflets fitToBounds function only considers position and not zoom level a custom solution had to be used. This custom solution tries zoom levels until it finds the best one, although this works fine when it transitions to a different zoom level, it causes flickering when it's best fit is the current zoom. This could be improved by rather calculating fit (some what complicated) instead of trying it.
More of a feature than a big, imho
What's the usefulness of re-adding layers in such a manner? I can only see how it can be confusing to users.
That file is a test file; the target="_blank"
means that the author has set the page up that way. The default value of target
is _self
, which replaces the current layer. Maybe you think that _blank
for maps is not useful as implemented? When the type
attribute is text/html
, _blank
opens a new tab. When the mime type is text/mapml
, _blank
adds a new layer.
You (the author) could use javascript to remove the link once it's traversed, or set the url to something else, or remove the originating feature etc. Worth thinking about and experimenting with. We don't currently have an experiment for _blank
Also, because the layer is duplicated each time it could potentially have a huge performance impact?
I suppose. This is under the control of the author, so kind of their responsibility, I think.