enable specifying scale/translate in query params for a map#883
enable specifying scale/translate in query params for a map#883
Conversation
113c67e to
a43fb2c
Compare
| }) | ||
| describe('queryParams', function () { | ||
| it.skiy('TODO need window') | ||
| }) |
There was a problem hiding this comment.
Needs to be it.skip (spelling)
3b39824 to
4568004
Compare
4568004 to
ca86e4e
Compare
ca86e4e to
206a327
Compare
|
I got it to update the query string when you zoom/pan the map in this PR! |
11c428b to
159330b
Compare
|
this is exciting! would love to see this one out on heroku for testing soon as well. I've started reading through the code. |
be218cf to
1643448
Compare
frontend/src/Metamaps/Visualize.js
Outdated
| const cachedPathname = window.location.pathname | ||
| const updateScaleInUrl = debounce(() => { | ||
| Util.updateQueryParams({ scale: self.mGraph.canvas.scaleOffsetX.toFixed(2) }) | ||
| Util.updateQueryParams({ scale: self.mGraph.canvas.scaleOffsetX.toFixed(2) }, pathname) |
There was a problem hiding this comment.
isn't pathname undefined here?
There was a problem hiding this comment.
thanks, fixed. it was working anyways since I had a default argument in Util, but fixing is good
frontend/src/Metamaps/Visualize.js
Outdated
| const newX = self.mGraph.canvas.translateOffsetX.toFixed(2) | ||
| const newY = self.mGraph.canvas.translateOffsetY.toFixed(2) | ||
| Util.updateQueryParams({ translate: `${newX},${newY}` }) | ||
| Util.updateQueryParams({ translate: `${newX},${newY}` }, pathname) |
|
I wonder about calling these |
|
FWIW I like zoom more than scale (for similar reasons to connor)... But I prefer translate slightly more than pan because it is a math term, instead of a film (?) term... and we aren't really panning a camera :P Not a big deal for me either way though |
|
Isn't it called panning also when you mouse down, grab a surface and move
it? Like in Google maps?
Looks like Google has avoided the issue of naming these parameters. This is
kind of nice and is a behaviour that we could roughly model after
https://www.google.com/maps/@43.6711147,-79.3046103,17z
|
bf42daa to
5bdc792
Compare
|
@devvmh I'm going to work on this a little bit and come up with a final version of how to store it in the URL. This will be so useful to get in! |
|
That's great! This is a big "public api" decision, so i think it's prudent to really think it through before pushing to metamaps.cc. once we enable it it'll be hard to turn off. So I'm okay if we merge, but also ok if we wait |
|
yeah, exactly. agreed. I want to design a good solution here |
|
Can't wait to have this one deployed! It has so many powerful uses and implications |
5bdc792 to
e0eb3e6
Compare
the issue as framed from the users perspective: https://trello.com/c/J1ryF0gX/49-enable-map-link-to-be-shared-with-the-zoom-and-pan-preset-for-viewer
e.g.
http://localhost:3000/maps/12?scale=0.5&translate=-350,300related to issue #833
The second commit actually updates the query string when you scale or translate the map, via monkey patching the JIT functions. I'm not sure how I feel about this approach. Also, it doesn't seem to be 100% accurate.