-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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 coordinates of image/video sources #2184
Conversation
@@ -57,19 +56,27 @@ ImageSource.prototype = util.inherit(Evented, { | |||
onAdd: function(map) { | |||
this.map = map; | |||
if (this.image) { | |||
this.createTile(); | |||
this.setCoordinates(); | |||
} |
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.
This method gets fired when the ImageSource
is added to an instance of Map
. There are two cases to consider:
- the HTTP request for the image finishes before the
ImageSource
gets added to the map - the HTTP request for the image returns after the
ImageSource
gets added to the map
The code in this method deals with the first case.
I think the lack of an argument to setCoordinates
is a mistake. The line should be
this.setCoordinates(this.coordinates)
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.
Oh, I am completely with you on why the code exists, it was the intentional or unintentional lack of arguments that got me confused. If it in fact was unintentional everything makes total sense.
Thank you for the PR @averas! Looking forward to the next round of revisions, feedback from some other Mapbox-ers, and then shipping this! |
Looks good to me! Is there a better name than
|
I like Any last words before we 🚢 @jfirebaugh @mourner? |
👍 |
This fixes #1880 by adding support for updating the coordinates on image- and video sources.
While doing this I noticed this part which I don't really understand how it's supposed to work:
Won't a call without arguments to setCoordinates (perviously createTile) cause an error on the subsequent coordinates.map() in that function?