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

configurable hash format #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

bryanbuchs
Copy link

I'm using a leaflet map inside a backbone application, and I need the hash to keep my original values. I added a simple option here to allow a "path" option to be passed. Example:

// track the map parameters (zoom/lat/lng) in the URL
var hashed = new L.Hash(myMap, {path: 'map/{z}/{lat}/{lng}'});

@calvinmetcalf
Copy link
Contributor

you should use L.Util.template that way you can do

hash = L.Util.template(opts.path,{
    lat:center.lat.toFixed(precision),
    lng:center.lng.toFixed(precision),
    z:zoom
})

@trygve-lie
Copy link

I find myself needing this feature also. Any possibility to get this resolved and merged into the master any time soon?

@tmcw tmcw mentioned this pull request Dec 21, 2013
@tmcw
Copy link
Contributor

tmcw commented Dec 21, 2013

Can't you just override the parseHash and formatHash functions on a L.hash instance?

@calvinmetcalf
Copy link
Contributor

Probably, I was going through an awkward coffeescript phase when I opened
this
On Dec 21, 2013 3:07 PM, "Tom MacWright" [email protected] wrote:

Can't you just override the parseHash and formatHash functions on a L.hashinstance?


Reply to this email directly or view it on GitHubhttps://github.com//pull/10#issuecomment-31071122
.

@calvinmetcalf
Copy link
Contributor

sorry for the nonsensical comment 😳 , I replied to via email and thought you were talking about a different issue.

@stevevance
Copy link

I would like this function to be able to permalink certain layers in Layers.control.

@animaux
Copy link

animaux commented Apr 16, 2014

Is any of the current forks adding this capability? Doesn’t look like it, but I might have overlooked it.

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

Successfully merging this pull request may close these issues.

6 participants