david-r-edgar / MapSwitcher

Chrome extension to switch between different mapping websites
MIT License
25 stars 7 forks source link

Leaflet maps on Strava as input #21

Closed joshuahhh closed 4 years ago

joshuahhh commented 4 years ago

Resolves #20, with the added benefit that it makes all Leaflet maps on Strava work as inputs, including ride maps. (Perhaps this could be made into an all-host input, so Leaflet maps anywhere can work as inputs?)

Please let me know what you think! Thanks.

joshuahhh commented 4 years ago

Hi @david-r-edgar! Is it possible for you to take a look at this? Thanks!

david-r-edgar commented 4 years ago

Hi @david-r-edgar! Is it possible for you to take a look at this? Thanks!

Ah, sorry, missed the notification before. Will have a look, thanks for the PR!

joshuahhh commented 4 years ago

Ooooo I wonder if that's a retina thing! (I'm using a MacBook which has a 2x pixel density screen.) I suppose we can just remove that part. I'll revise the PR in the next day to reflect that. Thanks for testing!

On Wed, May 27, 2020, 2:58 PM David Edgar notifications@github.com wrote:

@david-r-edgar commented on this pull request.

In src/dataExtractor.js https://github.com/david-r-edgar/MapSwitcher/pull/21#discussion_r431466658 :

   }
  • resolve(sourceMapData)
  • if (urlMethod()) { return }
  • function tileMethod () {
  • const container = document.querySelector('.leaflet-container')
  • if (!container) { return false }
  • const containerRect = container.getBoundingClientRect()
  • const tile = container.querySelector('.leaflet-tile')
  • if (!tile) { return false }
  • const tileRect = tile.getBoundingClientRect()
  • const re = /\/([0-9]+)\/([0-9]+)\/([0-9]+)@2x.png/

I tried it, and it failed to match here. But when I removed @2x it did succeed (for both rides and routes). Do you have any idea why I don't see this in the tile URL and you, I assume, do?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/david-r-edgar/MapSwitcher/pull/21#pullrequestreview-419638869, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAE5FV3K6UTUCPBJF4XCTC3RTWEIXANCNFSM4MP45ZYQ .

joshuahhh commented 4 years ago

I was able to test this on 2x and 1x resolution mode, so I bet it works! Would be great to get a double-check on your end, though. (Btw: The route planner interface recently changed and it's now based on a canvas. I don't know how to deal with that yet. But this still works for all the tile-based maps around Strava.) Thanks!

david-r-edgar commented 4 years ago

Thanks for the fix! Seems to work well.