-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix for model coloring #4798
Fix for model coloring #4798
Conversation
For some reason the CI system fails to run: npm run makeZipFile Running locally the command succeed without any issue. |
Thanks for catching this @szsolt. This is a good initial solution, with the downside being if there is no I think the proper solution may be to turn |
@lilleyse What if we follow how modelMatrix is set a few lines above? model.silhouetteColor = Property.getValueOrClonedDefault(modelGraphics.silhouetteColor, time, defaultSilhouetteColor, model.silhouetteColor);
model.color = Property.getValueOrClonedDefault(modelGraphics._color, time, defaultColor, model.color); |
Updated pull request to avoid creating a new Color each update. Is this good enough or you still prefer the getter/setter option? |
@szsolt can you please send in a Contributor License Agreement (CLA) so we'll be able to merge this? |
I think the getter/setter is still preferable. If the model's color is not set the default color will be cloned every update. |
Updated the pull request. Now if the model color is not set, it will not be cloned for every update. I was wondering if it would worth changing the behavior of getValueOrDefault() or introducing a new method which will allocate a new object when the result is frozen, something like: Property.getValueOrDefaultSafe = function(property, time, valueDefault, result) {
return defined(property) ? defaultValue(property.getValue(time, Object.isFrozen(result) ? undefined : result), valueDefault) : valueDefault;
}; Of course we could implement isFrozen() method like you did for the freeze() method for older browser compatibility. |
Please feel free to modify / replace my implementation as you guys have more expertise on the implementation detail. |
Cool nice idea with only storing the alphas to avoid the clone, and using the underscored colors as scratch variables. I think this is good to go for now, if we decide to use getters/setters for Color later that can be in a different PR. @pjcozzi can you do the final review? |
Looks great, thanks again @szsolt! Great job with this. If you have the time to more involved with Cesium, there's lots of ideas here. |
This bug still appears in 1.96. Link to Sandcastle |
Hi @pikvic, This bug has already been fixed in |
#1 Opened issue