Skip to content

Commit b505c94

Browse files
committed
Release 1.1.0
Also updated dev dependencies.
1 parent 7cf49b5 commit b505c94

4 files changed

Lines changed: 50 additions & 15 deletions

File tree

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
# Changelog
22

3+
## [1.1.0] - 2026-04-30
4+
### Added
5+
- `enableResize` option: when set to `true`, resize handles are shown on the viewport edges allowing the user to adjust its size.
6+
- `CroptState` interface with fields `x`, `y`, `zoom`, `width`, and `height` representing a saved crop state.
7+
- `getState()` method to retrieve the current crop state.
8+
- `bind()` now accepts a `CroptState` object as its second argument to restore zoom, position, and viewport dimensions. Passing a number is still supported for backwards compatibility.
9+
10+
### Changed
11+
- Updated demo site to demonstrate the `enableResize` option and saving/restoring crop state.
12+
13+
314
## [1.0.2] - 2026-01-16
415
### Fixed
516
- Incorrect step value for range input.
@@ -88,6 +99,7 @@ This is the initial pre-release after forking from [Foliotek/Croppie](https://gi
8899
[#1]: https://github.com/devtheorem/cropt/pull/1
89100
[#5]: https://github.com/devtheorem/cropt/pull/5
90101
[#6]: https://github.com/devtheorem/cropt/issues/6
102+
[1.1.0]: https://github.com/devtheorem/cropt/compare/v1.0.2...v1.1.0
91103
[1.0.2]: https://github.com/devtheorem/cropt/compare/v1.0.1...v1.0.2
92104
[1.0.1]: https://github.com/devtheorem/cropt/compare/v1.0.0...v1.0.1
93105
[1.0.0]: https://github.com/devtheorem/cropt/compare/v0.9.1...v1.0.0

README.md

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,13 @@ Default value: `{ width: 220, height: 220, borderRadius: "0px" }`
4343
Defines the size and shape of the crop box.
4444
For a circle shape, set the border radius to `"50%"`.
4545

46+
### `enableResize`
47+
48+
Type: `boolean`
49+
Default value: `false`
50+
51+
If set to `true`, resize handles are shown on the edges of the viewport, allowing the user to adjust its size.
52+
4653
### `zoomerInputClass`
4754

4855
Type: `string`
@@ -52,9 +59,25 @@ Optionally set a different class on the zoom range input to customize styling (e
5259

5360
## Methods
5461

55-
### `bind(src: string, zoom: number | null = null): Promise<void>`
62+
### `bind(src: string, state: number | CroptState | null = null): Promise<void>`
63+
64+
Takes an image URL as the first argument. Returns a `Promise` which resolves when the image has been loaded and state is initialized.
65+
66+
The optional second argument can be:
67+
- A `CroptState` object (returned by `getState()`) to restore a previously saved crop position, zoom, and viewport size.
68+
- A `number` to set only the initial zoom level.
5669

57-
Takes an image URL as the first argument, and an optional initial zoom value. Returns a `Promise` which resolves when the image has been loaded and state is initialized.
70+
### `getState(): CroptState`
71+
72+
Returns the current crop state as a `CroptState` object with fields `x`, `y`, `zoom`, `width`, and `height`. This can be stored and later passed to `bind()` to restore the crop position, zoom level, and viewport size.
73+
74+
```javascript
75+
// Save state when the user is done cropping
76+
const state = cropt.getState();
77+
78+
// Later, restore the same crop position on the same image
79+
cropt.bind("path/to/image.jpg", state);
80+
```
5881

5982
### `destroy(): void`
6083

package-lock.json

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cropt",
3-
"version": "1.0.2",
3+
"version": "1.1.0",
44
"description": "A lightweight JavaScript image cropper",
55
"files": [
66
"src/cropt.*"
@@ -12,10 +12,10 @@
1212
"bootstrap": "^5.3.8",
1313
"gh-pages": "^6.3.0",
1414
"http-server": "^14.1.1",
15-
"prettier": "^3.8.2",
15+
"prettier": "^3.8.3",
1616
"sass": "1.78",
1717
"shx": "^0.4.0",
18-
"typescript": "^6.0.2"
18+
"typescript": "^6.0.3"
1919
},
2020
"scripts": {
2121
"deploy": "gh-pages -d ./demo",

0 commit comments

Comments
 (0)