fix clipped cache when using multiple objects with cacheless filters #979
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Following code will clip
objectBig
to the size ofobjectSmall
on the second update call:https://codepen.io/adabru/pen/aaOxZb?editors=1000
The error comes from following code:
EaselJS/src/easeljs/display/StageGL.js
Lines 2619 to 2620 in c7b6035
EaselJS/src/easeljs/display/StageGL.js
Lines 2631 to 2644 in c7b6035
On the first update call, every item will go into the
if (item.bitmapCache === null)
branch and thebounds
variable will be assigned to the correct bounds. On the second update call however, no item will go into this branch asbitmapCache
is assigned for each of them. Thereforebounds
is assigned by the linebounds = bounds || item.getBounds();
. Asbounds
isnull
on declaration, the first item will get its correct bounds assigned with this statement. BUT asbounds
is declared asvar
and therefore its scope is for the entire function, the next items will pick the first item's bounds and thus be clipped if they are smaller than the first item.One fix could be to use
var bounds = null;
. The fix in this pull request is usinglet bounds;
instead to block-scope thebounds
variable.See https://codepen.io/adabru/pen/rZVZyX?editors=1000 .
let
syntax is not handled bygrunt-contrib-uglify
default branch, so this pull request also changes this dependency to itsgrunt-contrib-uglify-es
branch (https://github.com/gruntjs/grunt-contrib-uglify/tree/harmony).My workaround at the moment is using a fork of this repo. I hope this issue can soon be fixed in master.