-
-
Notifications
You must be signed in to change notification settings - Fork 16
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
Update fragment hash in URL so you can link to zoomed map #13
Comments
Should this add to the history so that the back button works? Yes, maybe - but only if it's severely rare limited, maybe adding a history checkpoint every few seconds. |
https://github.com/kluizeberg/Leaflet.Map-hash does exactly what I want here. It's not rate-limited but it doesn't affect browser history so that's not a problem. |
I'm going to enable this by default but allow users to disable it using a plugin configuration setting. |
One catch: that plugin doesn't play well with the changes |
const serialize = (obj, prefix) => Object.keys(obj).filter(key => obj[key]).map(
key => `${prefix}.${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`
).join('&');
const unserialize = (s, prefix) => {
if (s && s[0] === '#') {
s = s.slice(1);
}
if (!s) {
return {};
}
var obj = {};
s.split('&').filter(bit => bit.slice(0, prefix.length + 1) === `${prefix}.`).forEach(bit => {
let pair = bit.split('=');
obj[decodeURIComponent(pair[0]).replace(new RegExp(`^${prefix}\\.`), '')] = decodeURIComponent(pair[1]);
});
return obj;
}; |
I'm going to use a |
I had a go at this (I have a datasette deployment with the hashmap working with some edits to the Specifically in this case: https://github.com/simonw/datasette-vega/blob/master/src/DatasetteVega.js#L168
(where I suspect alterations to the vendored leaflet-map-hash will have to also happen, as that script directly removes any hash data de8d788#diff-887aaf7973cd28479fd3326e3777360fb835b5e8d1fe00f55b4a849d54b6dcbcR63-R67
I suspect changes to
I can have a go at this, if this isn't in your immediate radar. I suspect my implementation would require some alteration to the current serialise/unserialise methods, as I think there would have to be context-aware serialisation for the plugins to actually work together. |
No description provided.
The text was updated successfully, but these errors were encountered: