diff options
author | Asheem Mamoowala <asheem.mamoowala@mapbox.com> | 2017-06-14 15:44:42 -0700 |
---|---|---|
committer | Asheem Mamoowala <asheem.mamoowala@mapbox.com> | 2017-06-19 09:50:08 -0700 |
commit | a33cad98557f2d15bfb578e4795b130d25a2def2 (patch) | |
tree | 051ee0078e7edc2ed7d465e052b85cca7093d6a6 | |
parent | ca45974ff2778a48d01b7221b6ab406c3e55c9ca (diff) | |
download | qtlocation-mapboxgl-a33cad98557f2d15bfb578e4795b130d25a2def2.tar.gz |
[core] Trigger repaint on source changes
-rw-r--r-- | src/mbgl/style/sources/geojson_source.cpp | 1 | ||||
-rw-r--r-- | src/mbgl/style/sources/image_source.cpp | 4 | ||||
-rw-r--r-- | src/mbgl/style/style.cpp | 1 | ||||
-rw-r--r-- | test/style/source.test.cpp | 2 |
4 files changed, 5 insertions, 3 deletions
diff --git a/src/mbgl/style/sources/geojson_source.cpp b/src/mbgl/style/sources/geojson_source.cpp index d04c8ffce4..4e3478322d 100644 --- a/src/mbgl/style/sources/geojson_source.cpp +++ b/src/mbgl/style/sources/geojson_source.cpp @@ -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 { diff --git a/src/mbgl/style/sources/image_source.cpp b/src/mbgl/style/sources/image_source.cpp index 757773d218..9313d8da4a 100644 --- a/src/mbgl/style/sources/image_source.cpp +++ b/src/mbgl/style/sources/image_source.cpp @@ -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 { @@ -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 { diff --git a/src/mbgl/style/style.cpp b/src/mbgl/style/style.cpp index 94e003df51..d667ef656f 100644 --- a/src/mbgl/style/style.cpp +++ b/src/mbgl/style/style.cpp @@ -258,6 +258,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) { diff --git a/test/style/source.test.cpp b/test/style/source.test.cpp index aa55db7292..eaa3c72877 100644 --- a/test/style/source.test.cpp +++ b/test/style/source.test.cpp @@ -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(); }; |