@anu3ev/fabric-image-editor 0.9.12 → 0.9.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +7 -0
  2. package/dist/main.js +1284 -1194
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -267,6 +267,7 @@ editor.cropManager.startCanvasCrop({
267
267
  width: 1,
268
268
  height: 1
269
269
  },
270
+ preserveAspectRatio: true,
270
271
  allowFrameOverflow: true,
271
272
  showGrid: true,
272
273
  cancelOnSelectionClear: true
@@ -305,6 +306,10 @@ editor.cropManager.setSize({
305
306
  }
306
307
  })
307
308
 
309
+ editor.cropManager.setPreserveAspectRatio({
310
+ preserveAspectRatio: false
311
+ })
312
+
308
313
  // Apply or cancel the active crop mode
309
314
  const cropResult = editor.cropManager.apply()
310
315
  editor.cropManager.cancel()
@@ -316,12 +321,14 @@ Crop behavior options:
316
321
  - `allowFrameOverflow` defaults to `true` and lets the crop frame become larger than the source object.
317
322
  - `showGrid` defaults to `true` and draws a composition grid inside the crop frame.
318
323
  - `cancelOnSelectionClear` defaults to `true` and cancels crop mode when the crop frame loses focus.
324
+ - `preserveAspectRatio` defaults to `true` and keeps the current aspect ratio during crop resize; `Shift` temporarily inverts the active mode for any resize control.
319
325
 
320
326
  `CropManager` public methods:
321
327
  - `startCanvasCrop()` enters crop mode for the montage area.
322
328
  - `startImageCrop()` enters crop mode for a `FabricImage` target or the active image object.
323
329
  - `setAspectRatio()` updates the active crop frame by width/height ratio.
324
330
  - `setSize()` updates the active crop frame by explicit dimensions.
331
+ - `setPreserveAspectRatio()` toggles whether crop resize keeps the current aspect ratio for the active crop frame.
325
332
  - `getState()` returns the active crop state, including mode, frame, target, options, and result rect.
326
333
  - `apply()` commits the active crop and saves the new state to history.
327
334
  - `cancel()` exits crop mode without changing the montage area or image.