Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
[core] Trigger repaint on source changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Asheem Mamoowala committed Jun 15, 2017
1 parent 30ca78a commit 8ffbd43
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/mbgl/style/sources/geojson_source.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ void GeoJSONSource::setURL(const std::string& url_) {
void GeoJSONSource::setGeoJSON(const mapbox::geojson::geojson& geoJSON) {
req.reset();
baseImpl = makeMutable<Impl>(impl(), geoJSON);
observer->onSourceChanged(*this);
}

optional<std::string> GeoJSONSource::getURL() const {
Expand Down
4 changes: 2 additions & 2 deletions src/mbgl/style/sources/image_source.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const ImageSource::Impl& ImageSource::impl() const {

void ImageSource::setCoordinates(const std::array<LatLng, 4>& coords_) {
baseImpl = makeMutable<Impl>(impl(), coords_);
observer->onSourceLoaded(*this);
observer->onSourceChanged(*this);
}

std::array<LatLng, 4> ImageSource::getCoordinates() const {
Expand All @@ -44,7 +44,7 @@ void ImageSource::setImage(UnassociatedImage&& image_) {
}
loaded = true;
baseImpl = makeMutable<Impl>(impl(), std::move(image_));
observer->onSourceLoaded(*this);
observer->onSourceChanged(*this);
}

optional<std::string> ImageSource::getURL() const {
Expand Down
1 change: 1 addition & 0 deletions src/mbgl/style/style.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ void Style::onSourceLoaded(Source& source) {
void Style::onSourceChanged(Source& source) {
sources.update(source);
observer->onSourceChanged(source);
observer->onUpdate(Update::Repaint);
}

void Style::onSourceError(Source& source, std::exception_ptr error) {
Expand Down
2 changes: 1 addition & 1 deletion test/style/source.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ TEST(Source, ImageSourceImageUpdate) {
response.data = std::make_unique<std::string>(util::read_file("test/fixtures/image/no_profile.png"));
return response;
};
test.styleObserver.sourceLoaded = [&] (Source&) {
test.styleObserver.sourceChanged = [&] (Source&) {
// Should be called (test will hang if it doesn't)
test.end();
};
Expand Down

0 comments on commit 8ffbd43

Please sign in to comment.