Skip to content

V2 beta 2#23

Merged
flipbit merged 29 commits intomainfrom
v2-beta-2
Mar 6, 2026
Merged

V2 beta 2#23
flipbit merged 29 commits intomainfrom
v2-beta-2

Conversation

@flipbit
Copy link
Owner

@flipbit flipbit commented Mar 6, 2026

  • Add automatic image resizing support

setPosition() now multiplies note coordinates by scale factors to convert
from natural pixel space to rendered pixel space. resetPosition() divides
rendered coordinates by scale factors to store natural pixel values.
When autoResize !== false (default true), attach a ResizeObserver to the
canvas that recomputes scale factors and rebuilds annotation views when
the container resizes. Active edits are cancelled on resize. The observer
is disconnected on destroy().
Replace flaky hover-shows-tooltip test (same issue as pre-existing
jquery-basics/vanilla-basics hover failures) with reliable renders-
4-annotations test. Fix viewport resize test to shrink below the
700px CSS breakpoint so the responsive container actually changes width.
…nt cancelEdit

- Extract duplicated scaled-image test helper from 3 test files into
  test/setup.ts as createScaledTestImage()
- Remove redundant cancelEdit() call in rescale() since destroyViews()
  already handles it
Replace manual scaleX/scaleY multiplication and division in annotate-view.ts
and annotate-edit.ts with centralized toRendered() and toNatural() methods.
resetPosition now reads natural coords from the edit note (set by save handler)
instead of re-deriving them from rendered area styles.
…(C1 fix)

The image element is now a visible child of the canvas div instead of
being hidden and replaced with a CSS background-image. This provides
intrinsic sizing via the image itself and simplifies overlay positioning
with CSS inset:0. The destroy() method restores the image to its
original DOM position with guards for multi-instance and framework
(React) unmount scenarios.
When a ResizeObserver fires during an active edit (e.g., mobile keyboard
show/hide), the rescale is now deferred instead of immediately destroying
the edit form. The pending rescale is flushed after save, delete, or cancel.
React: pass autoResize ?? true to core (was passing undefined when omitted).
Vue: change autoResize prop default from undefined to true.
Add autoResize prop tests for both wrappers.
- Remove `width: 100%` from `.image-annotate-canvas > img` to respect
  explicit HTML width attributes (fixes explicit-size scaling test)
- Update hover tooltip tests to find the tooltip within its parent area
  element, matching the new DOM structure where tooltips are children of
  their area (not siblings appended to the view overlay)
- Account for 1px canvas border in explicit-size dimension assertion
- Replace NPM_TOKEN secret with OIDC trusted publishing
- Add npm-publish environment and id-token permission
- Add --provenance --access public flags
- Bump version to 2.0.0-beta.2
@flipbit flipbit merged commit d644f1a into main Mar 6, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant