|
| 1 | +# Changelog |
| 2 | + |
| 3 | +## 15.1.0 (2026-03-21) |
| 4 | + |
| 5 | +### Features |
| 6 | + |
| 7 | +- **`useAvatarEditor` hook** — new hook that provides `getImage()`, `getImageScaledToCanvas()`, and `getCroppingRect()` without manual ref management. All methods return `null` safely when no image is loaded. |
| 8 | +- **`getCroppingRect()` on ref** — now exposed on the imperative ref alongside `getImage` and `getImageScaledToCanvas`. |
| 9 | +- **`onLoadStart` callback** — fires when image loading begins, complementing the existing `onLoadSuccess`/`onLoadFailure`. |
| 10 | +- **Loading indicator** — the canvas shows a subtle pulsating fill while an image is loading. |
| 11 | + |
| 12 | +### Bug Fixes |
| 13 | + |
| 14 | +- **Fix color overlay on exported image on Windows** ([#420](https://github.com/mosch/react-avatar-editor/issues/420)) — `getImageScaledToCanvas()` no longer uses `destination-over` compositing which caused color artifacts on some Windows GPU drivers. |
| 15 | +- **Fix touch drag in DevTools responsive mode** ([#403](https://github.com/mosch/react-avatar-editor/issues/403)) — touch event listeners are now always registered instead of being gated behind a one-time `isTouchDevice` check. Also guards `preventDefault()` with `e.cancelable` to avoid console errors. |
| 16 | + |
| 17 | +## 15.0.0 (2026-03-21) |
| 18 | + |
| 19 | +### Breaking Changes |
| 20 | + |
| 21 | +- **Removed `...rest` prop forwarding** — unknown props are no longer spread onto the `<canvas>` element. If you relied on passing custom HTML attributes (e.g. `id`, `className`, `data-*`) directly to the canvas, this will no longer work. |
| 22 | +- **`getCroppingRect()` return change** — returns `{x:0, y:0, width:1, height:1}` instead of throwing when no image is loaded. |
| 23 | +- **`getInitialSize()` precision** — returns exact floating-point values instead of rounded integers, fixing off-by-one pixel issues. |
| 24 | +- **Core bundled into lib** — `@react-avatar-editor/core` is no longer a separate npm dependency; it's bundled into `react-avatar-editor`. |
| 25 | + |
| 26 | +### Features |
| 27 | + |
| 28 | +- **`useAvatarEditor` hook** — new ergonomic API for accessing editor methods. |
| 29 | +- **`onLoadStart` callback** — fires when image loading begins. |
| 30 | +- **Loading indicator** — pulsating canvas fill during image load. |
| 31 | +- **`showGrid` / `gridColor` props** — rule-of-thirds grid overlay (existed in source but was non-functional in v13/v14 npm releases). |
| 32 | +- **`borderColor` prop** — draw a 1px border around the crop mask. |
| 33 | + |
| 34 | +### Bug Fixes |
| 35 | + |
| 36 | +- **Fix #389** — `getCroppingRect()` no longer returns NaN when no image is loaded. |
| 37 | +- **Fix #429** — square cropper no longer produces off-by-one pixel dimensions. |
| 38 | +- **Fix #431** — drag/pan now works correctly in React 17 (stale closure fix). |
| 39 | +- **Fix #402** — canvas no longer clipped on Windows with display scaling > 100%. |
| 40 | +- **Fix #432** — added `repository` field to package.json. |
| 41 | +- **Fix #406** — unknown props no longer leak to the canvas DOM element. |
| 42 | +- **Fix canvas repaint** — all visual props now correctly trigger canvas re-render. |
| 43 | + |
| 44 | +### Tooling |
| 45 | + |
| 46 | +- Migrated from ESLint + Prettier to oxlint + oxfmt. |
| 47 | +- Migrated from tsdown to Vite for library builds. |
| 48 | +- 123 unit tests (84 core + 39 component) + 8 Playwright visual regression tests. |
| 49 | +- TypeScript 5.9, Vite 8, React 19 (dev). |
0 commit comments