megaplot icon indicating copy to clipboard operation
megaplot copied to clipboard

Warn or throw when sprite creation exceeds capacity

Open jimbojw opened this issue 3 years ago • 1 comments

Currently, when a Sprite is created and all of the available capacity is in use, it waits in the Created lifecycle phase for memory to become available. For this reason, Sprites may be invisible, which could be confusing.

When desiredSwatchCapacity is in use, the first time a Sprite is created which cannot be accommodated immediately, it would be useful to inform the API user via console.warn() of this behavior. That way, they can decide whether to increase the desiredSwatchCapacity to match their use case.

Perhaps this warning should be an error by default? Consider adding a flag to the Scene constructor to specify whether Sprites exceeding the memory capacity should throw.

jimbojw avatar May 16 '22 21:05 jimbojw

This may be obviated by implementation of the simplified API described in #83.

Once that is implemented, creating a Sprite will be a separate action from attaching a sprite to a Scene. The attachment might fail, but that would be independent from the creation.

jimbojw avatar Mar 14 '23 20:03 jimbojw