* Refactor: Add index to shapes package
* Add shape draw callback API to setupImageCloze
* Expose IO drawing API, switch away from image cloze naming
We currently use "image occlusion" in most places, but some references to "image cloze" still remain. For consistency's sake and to make it easier to quickly find IO-related code, this commit replaces all remaining references to "image cloze", only maintaining those required for backwards compatibility with existing note types.
* Add cloze ordinal to shapes
* Do not mutate original shapes during (de)normalization
Mutating shapes would be a recipe for trouble when combined with IO API use by external consumers.
(makeNormal(makeAbsolute(makeNormal())) is not idempotent,
and keeping track of the original state would introduce
additional complexity with no discernible performance benefit
or otherwise.)
* Tweak IO API, allowing modifications to ShapeProperties
* Tweak drawShape parameters
* Switch method order
For consistency with previous implementation
* Run Rust formatters
* Simplify position (de)normalization
---------
Co-authored-by: Glutanimate <glutanimate@users.noreply.github.com>
* Add text tool to IO
* Remove unnecessary parentheses
* Fix text objects always grouped
* Remove log
* Fix text objects hidden on back side
* Implement text scaling
* Add inverse text outline
* Warn about IO notes with only text objects
This will result in a different error message than the case where no
objects are added at all though, and the user can bypass the warning.
Maybe this is better to avoid discarding the user's work if they have
spent some time adding text.
* Add isValidType
* Use matches!
* Lock aspect ratio of text objects
* Reword misleading comment
The confusion probably comes from the Fabric docs, which apparently need updating: http://fabricjs.com/docs/fabric.Canvas.html#uniformScaling
* Do not count text objects when calculating current index
* Make text objects respond to size changes
* Fix uniform scaling not working when editing
* Use Arial font
* Escape colons and unify parsing
* Handle scale factor when restricting shape to view
* Use 'cloned'
* Add text background
* Tweak drawShape's params