cascade stylesheet on every update, including animations

previously, animations didn't trigger a style cascade, leading to overly thick lines

fixes #81
This commit is contained in:
Konstantin Käfer
2014-04-15 11:40:52 -04:00
parent 70bb318e75
commit e9db888491

View File

@@ -40,7 +40,6 @@ void Map::loadSettings() {
transform.setAngle(settings.angle);
transform.setScale(settings.scale);
transform.setLonLat(settings.longitude, settings.latitude);
style.cascade(transform.getNormalizedZoom());
update();
}
@@ -81,7 +80,6 @@ void Map::stopPanning() {
void Map::scaleBy(double ds, double cx, double cy, double duration) {
transform.scaleBy(ds, cx, cy, duration);
style.cascade(transform.getNormalizedZoom());
update();
transform.getLonLat(settings.longitude, settings.latitude);
@@ -131,7 +129,6 @@ void Map::getLonLat(double& lon, double& lat) const {
void Map::setLonLatZoom(double lon, double lat, double zoom, double duration) {
transform.setLonLatZoom(lon, lat, zoom, duration);
style.cascade(transform.getNormalizedZoom());
update();
transform.getLonLat(settings.longitude, settings.latitude);
@@ -145,7 +142,6 @@ void Map::getLonLatZoom(double& lon, double& lat, double& zoom) const {
void Map::setScale(double scale, double cx, double cy, double duration) {
transform.setScale(scale, cx, cy, duration);
style.cascade(transform.getNormalizedZoom());
update();
transform.getLonLat(settings.longitude, settings.latitude);
@@ -155,7 +151,6 @@ void Map::setScale(double scale, double cx, double cy, double duration) {
void Map::setZoom(double zoom, double duration) {
transform.setZoom(zoom, duration);
style.cascade(transform.getNormalizedZoom());
update();
transform.getLonLat(settings.longitude, settings.latitude);
@@ -209,7 +204,6 @@ void Map::resetPosition() {
transform.setAngle(0);
transform.setLonLat(0, 0);
transform.setZoom(0);
style.cascade(transform.getNormalizedZoom());
update();
transform.getLonLat(settings.longitude, settings.latitude);
@@ -234,7 +228,13 @@ void Map::cancelAnimations() {
}
void Map::update() {
// Loads new tiles and removes old ones.
updateTiles();
// Updates the stylesheet to the new zoom level
style.cascade(transform.getNormalizedZoom());
// Schedules a repaint
platform::restart();
}
@@ -437,6 +437,9 @@ bool Map::render() {
if (transform.needsAnimation()) {
transform.updateAnimations(animationTime);
// Animations change the transform which affects the stylesheet.
style.cascade(transform.getNormalizedZoom());
}
if (*style.sprite->raster && !style.sprite->raster->textured) {