CreateJS / EaselJS

The Easel Javascript library provides a full, hierarchical display list, a core interaction model, and helper classes to make working with the HTML5 Canvas element much easier.
http://createjs.com/
MIT License
8.13k stars 1.97k forks source link

Dynamic text bounds not working after cache, Setbounds cannot be used as the text is dynamic #991

Closed joseph-olivemultimedia closed 5 years ago

joseph-olivemultimedia commented 5 years ago

Iam building a text scroller with Mask and i cannot get the dynamic text bounds, i saw other solutions in this blog, where setBounds would be a solution. But for the dynamic texts, we cannot set the height without getbounds. I think its a bug.

Im using createjs 1.0 version.

lannymcnie commented 5 years ago

Your title says it happens after the cache. Cached items return their cache's size, and not the dynamic contents not displayed. This is currently a fact-of-life. Since you have to re-cache when the size changes, you might be able to:

  1. Remove the cache using uncache()
  2. Measure the bounds again with the new text
  3. Re-cache with the new bounds

Hope that helps.

gskinner commented 5 years ago

Out of curiousity, do you have a use case for checking the bounds that does not also involve updating the cache? We could potentially add a param to allow bypassing the cache bounds, I'd just like to understand the use case.