-
Notifications
You must be signed in to change notification settings - Fork 41
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
PR for #38 permalink #121
PR for #38 permalink #121
Conversation
All planned permalink features now implemented. Need to revisit layer handling when #113 is merged (async layer creation). |
So this was already there, only unit tests are lacking. The |
Should be good to go. |
lConf.lid = now.getTime(); | ||
// Make a unique layerId from Layer name and URL so contexts | ||
// like permalinks can be reapplied. | ||
lConf.lid = btoa(lConf.url + lConf.name).substr(0, 6); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does every layer has a property url
? Not sure about that
Looks good to me, thanks @justb4. One little question above and one general question: Will it be easily possible to apply another permalink structure? I have a public application called Shareloc, which provides shareable links for OpenLayers maps. In the future I might want to upgrade Shareloc to Wegue. The permalink in this PR looks a bit different from the one used with Shareloc (e.g. |
Not directly, though there is some abstraction already via the config: A next step would be to make all param-names configurable with sensible default. Not too difficult as parameter naming is just in a few places (2). Only |
Thanks for clarification. |
I just tested the Permlink behaviour and found something unexpected. If a layer gets activated it is not added to the permalink. Steps to reporduce:
|
Confirmed. As soon as you alter the Map View (pan, zoom) the Layer is added. Almost sure the problem is that changing active Layers does not trigger |
It is not intended that activating a layer triggers |
Yes, aware by now. Approach now (before seeing comment above) is to listen to two additional events: I will push the changes for now and make it WIP for review. |
… Layer Collection
Thanks for your ongoing work @justb4 ! LGTM, I'll merge now. |
This is a minimal permalink implementation, it is configuration-driven. Using a new
permalink
config object, example:Defaults apply, so
"permalink": {}
is also valid.c
(center),z
(zoom) ,r
(rotation) with optional prefixes e.g.map_c=
.appCtx=
are preservedpopstate
capturemap_z=1.9867&map_c=2.306,39.5258&map_r=0
src/components/ol/PermalinkController.js
as ordinary classMap.vue/PermalinkController.js
app-specific subclasses via Factory Method.PermalinkController.getParamStr ()
) methodPermalinkController.getEmbedHTML ()
) methodextent
URL parameter i.s.o.center+zoom
(configurable)lid
s?) to be encoded (challenge: layers are loadedasync
)