-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Reflect changes in icon size immediately #6932
Conversation
@ivovandongen, thanks for your PR! By analyzing the history of the files in this pull request, we identified @tobrun, @cammace and @zugaldia to be potential reviewers. |
@jfirebaugh The problem seems to be that the style needs to be recalculated for the change to appear. Recalculating on all layout property changes is not very efficient, we can limit this to |
1834402
to
9388c93
Compare
9388c93
to
9593fba
Compare
Added test case in: mapbox/mapbox-gl-test-suite#161 |
The regression test passes for me even without the changes here. Can you see what's needed to get that to fail, so we know it's a good regression test? |
@jfirebaugh I've been trying to get the test to fail without success. Whereas the test activity I made clearly reproduces the error, the render tests just wont. Could this be a difference in render modes (still/continuous)? |
That's possible. It'll probably require C++ debugging to track down what's going on here. I'll try setting up the equivalent scenario in macosapp. |
@ivovandongen -- I figured out why the render test was passing. There were a variety of places in which the test harness called map.setZoom, triggering a recalculate that wouldn't normally happen. They are all unnecessary and could have obscured other issues, so I'm eliminating them in #6989, mapbox/mapbox-gl-test-suite#164, and #6990. After those PRs merge, the test case should fail as expected. As to why recalculation is necessary, it comes down to this special logic for |
@jfirebaugh Thanks for looking into this!
No clean ideas yet. I see two options:
I think I would prefer the latter. I'll update the pr accordingly. |
31837ff
to
c522b7b
Compare
@@ -169,7 +169,7 @@ void SymbolLayer::setIconSize(PropertyValue<float> value) { | |||
if (value == getIconSize()) | |||
return; | |||
impl->layout.iconSize.set(value); | |||
impl->observer->onLayerLayoutPropertyChanged(*this); | |||
impl->observer->onLayerLayoutPropertyChanged(*this, true); |
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.
symbol_layer.cpp
is a generated file, so this change will get overwritten.
Instead of a boolean, how about a const char * property
, with name from style spec, e.g. "icon-size"
. We can update layer.cpp.ejs
to add this parameter for every setter, and do exact matches in Style::onLayerLayoutPropertyChanged
.
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.
symbol_layer.cpp is a generated file, so this change will get overwritten.
Of course.. I was a bit too hasty there.
Instead of a boolean, how about a const char * property, with name from style spec
Makes sense, I'll start on that now.
c522b7b
to
27f4b8d
Compare
@jfirebaugh I've updated the PR according to #6932 (comment) |
auto update = Update::Layout; | ||
|
||
//Recalculate the style for certain properties | ||
bool needsRecalculation = strcmp(property, "icon-size") || strcmp(property, "text-size"); |
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.
strcmp returns 0 if they are equal.
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.
Thanks again! Updated the PR and rebased on master.
27f4b8d
to
a8dfd42
Compare
Last step is to merge mapbox/mapbox-gl-test-suite#161 and then update the SHA in package.json. |
a8dfd42
to
c2af994
Compare
Fixes #6903