set() is called when the group transform is realized by the group
on the object, so set needs to be called when the inverse operation
is done too so that things watching these properties see both the
action and the undo.
Previously instances of the IText shape were added to a globally-shared
array when they were created. There are two problems with this approach:
1) Interactions with one canvas affect others. I would never expect
text in one canvas to exit edit mode just because I interacted with
some otherwise-unrelated canvas.
2) Every IText instance leaks. There is no mechanism to clean up references
to IText instances in the global array, so every such instance will
hang around in memory forever, regardless of whether it is removed from
the canvas or if the canvas itself is removed.
Discovered while profiling memory usage in Chrome.
Skips the checking of grouped objects within _searchPossibleTargets since we already check the group as a whole target itself. Failing to do so would lead to grouped objects being picked up as targets outside of the group since their coordinates change temporarily while grouped.
Clone can be async for some object types, so we can't use it during
the serialisation process. Instead, apply the group transforms directly
on the object being serialised, and then undo it after serialising.
Instead, simulate what would happen to the children of the selection
group if the group were to be released. This is non-destructive on
the state of the canvas from the API user's perspective.
toSVG now mirrors the behaviour of toJSON and does not destroy
the active selection group when serialising. Instead, the effect
of the group is simulated on a clone of the object and this is
what gets serialised.
The animation that flashes the iText cursor can race its own
cancellation, meaning that you can have two _tick()'s and two
_tickComplete() animations at the same time. On iOS in particular,
most likely due to the lower frequency of timeouts, this can trap
the cursor in a state where its opacity is always <0.1 and is
essentially invisible.