* Store coordinates as ratios of full size
* Use single definition for cappedCanvasSize()
* Move I/O review code into ts/image-occlusion
A bit simpler when it's all in one place.
* Reduce number precision, and round to whole pixels
>>> n=10000
>>> for i in range(1, int(n)): assert i == round(float("%0.4f" % (i/n))*n)
* Minor typing tweak
So, it turns out that typing is mostly broken in ts/image-occlusion.
We're importing from fabric which is a js file without types, so types
like fabric.Canvas are resolving to any.
I first tried switching to `@types/fabric`, which introduced a slew of
typing errors. Wasted a few hours trying to address them, before deciding
to give up on it, since the types were not complete. Then found fabric
has a 6.0 beta that introduces typing, and spent some time with that, but
ran into some new issues as it still seems to be a work in progress.
I think we're probably best off waiting until it's out and stabilized
before sinking more effort into this.
* Refactor (de)serialization of occlusions
To make the code easier to follow/maintain, cloze deletions are now decoded/
encoded into simple data classes, which can then be converted to Fabric objects
and back. The data objects handle converting from absolute/normal positions, and
producing values suitable for writing to text (eg truncated floats).
Various other changes:
- Polygon points are now stored as 'x,y x2,y2 ...' instead of JSON in cloze
divs, as that makes the handling consistent with reading from cloze deletion
text.
- Fixed the reviewer not showing updated placement when a polygon was moved.
- Disabled rotation controls in the editor, since we don't support rotation during
review.
- Renamed hideInactive to occludeInactive, as it wasn't clear whether the former
meant to hide the occlusions, or keep them (hiding the content). It's stored
as 'oi=1' in the cloze text.
* Increase canvas size limit, and double pixels when required.
* Size canvas based on container size
This results in sharper masks when the intrinsic image size is smaller
than the container, and more legible ones when the container is smaller than
the intrinsic image size.
By using the container instead of the viewport, we account for margins,
and when the pixel ratio is 1x, the canvas size and container size should
match.
* Disable zoom animation on editor load
* Default to rectangle when adding new occlusions
* Allow users to add/update notes directly from mask editing page
* The mask editor needs to work with css pixels, not actual pixels
The canvas and image were being scaled too large, which impacted
performance.
* Add add-on installation hooks
* Fix GUI code run in background thread
deleteAddon() is run in the background in the update routine so it
shouldn't containg any GUI code.
* Add a hint to the docstrings (dae)
* Migrate check_copyright to Rust
* Add a new lint to check accidental usages of /// in ts/svelte comments
* Fix a bunch of incorrect jdoc comments
* Move contributor check into minilints
Will allow users to detect the issue locally with './ninja check'
before pushing to CI.
* Make Cargo.toml consistent with other crates
* Cloze styling is not required in I/O notetype
* Use raw string for IO template
* Rename to notetype.css and use more specific ids
* Move internal i/o styling into runtime
Storing it in the notetype makes it difficult to make changes, and
makes it easier for the user to break.
* Fix misaligned occlusions
At larger screen sizes, the canvas was not increasing above its configured
size, so it ended up being placed top center instead of expanding to fit
the entire container area.
To resolve this, both the image and canvas are forced to the container
size, and the container is constrained to the size of the viewport,
with the same aspect ratio as the image.
Closes#2492
… if page content exceeds viewport.
- Set 'opacity' to 0 instead of setting 'left' to a large negative
value to create an invisible but focusable button.
- Prevent page from scrolling by setting 'left/top' to the values
of 'scrollX/scrollY'.
Somewhat frustratingly, I only discovered this could be resolved with a
manifest change after first wasting hours trying to detect unicode text
in the NSIS installer, and warning the user that they'd need to change
their system locale if unicode text was found. Also tried adjusting the
locale with setlocale() on program startup, which did not help, perhaps
because it needs to be set before libc init.
* add methods that allow the user to configure answer keys
* allow editing answer buttons in preferences
* import optional
* Give the layout referenced in code a clearer name (dae)
* Update placeholder text and make it translatable (dae)
The other items in the preferences screen don't have tooltips, so
placeholder text may be easier for the user to discover than a tooltip.
* changed install location and elevation
* change registry keys to HKCU
change context to current user
* filetype associations non elevated
* added an "upgrade" from elevated to non elevated
* added comment to clarify bug
* removed commented out registry entries
* Update CONTRIBUTORS
add mgrottenthaler to contributors
* change upgrade routine to manual uninstall
* added suggestion
- Ensure our unit tests cover the non-legacy path, and check file
contents and not just existence.
- Pass `compressed` into copy_and_ensure_sha1_set(). We can't just
test for self.sha1.is_none(), as that fails in the case where an existing
media file was found in the legacy path.
https://forums.ankiweb.net/t/anki-media-file-corruption-when-exporting-png-files/30315
Quite a few users have been experiencing crashes recently that were
resolved by resetting their window positions/states. I presume this is
related to Qt updates, as there have been previous instances where old
state caused glitchy behaviour or crashes after a Qt upgrade.
The browser headers are now also reset when resetting window positions
in the preferences.
Way back in Qt4, there was an issue where (some?) windows would open
at a different location to where they were previously open. I've tested
the primary windows in Qt 5.14 on macOS, and the issue no longer seems
to exist, so this code is no longer useful.
The qtmajor > 5 check was a mistake introduced in 70dbd06be3ff56f13b9efe7c886c2a6c4f873ce9;
it was intended to limit the code to Qt 5.
A quick grep of an add-on snapshot indicates there are no add-ons that
were using the offset param, so it has been removed.