[core] Trigger repaint on source changes
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user