feat: ✨ add allowReverse option for resizing
This commit is contained in:
@ -333,7 +333,10 @@ export class Transform extends Widget<Transform.Options> {
|
||||
}
|
||||
|
||||
const relativeDirection = data.relativeDirection
|
||||
if (rawWidth <= -width || rawHeight <= -height) {
|
||||
if (
|
||||
options.allowReverse &&
|
||||
(rawWidth <= -width || rawHeight <= -height)
|
||||
) {
|
||||
let reverted: Node.ResizeDirection
|
||||
|
||||
if (relativeDirection === 'left') {
|
||||
@ -537,6 +540,10 @@ export namespace Transform {
|
||||
* aspect ratio of the node. Default is `false`.
|
||||
*/
|
||||
preserveAspectRatio?: boolean
|
||||
/**
|
||||
* Reaching the minimum width or height is whether to allow control points to reverse
|
||||
*/
|
||||
allowReverse?: boolean
|
||||
}
|
||||
}
|
||||
|
||||
@ -572,6 +579,7 @@ namespace Private {
|
||||
orthogonalResizing: true,
|
||||
restrictedResizing: false,
|
||||
autoScrollOnResizing: true,
|
||||
allowReverse: true,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -242,6 +242,7 @@ export class Hook extends Base implements Hook.IHook {
|
||||
resizing.restrict != null ? resizing.restrict : resizing.restricted,
|
||||
autoScrollOnResizing: resizing.autoScroll,
|
||||
preserveAspectRatio: resizing.preserveAspectRatio,
|
||||
allowReverse: resizing.allowReverse,
|
||||
|
||||
rotatable: rotating.enabled,
|
||||
rotateGrid: rotating.grid,
|
||||
|
@ -458,6 +458,7 @@ export namespace Options {
|
||||
restricted?: boolean | number
|
||||
autoScroll?: boolean
|
||||
preserveAspectRatio?: boolean
|
||||
allowReverse?: boolean
|
||||
}
|
||||
|
||||
export type Resizing = {
|
||||
@ -703,6 +704,7 @@ export namespace Options {
|
||||
restricted: false,
|
||||
autoScroll: true,
|
||||
preserveAspectRatio: false,
|
||||
allowReverse: true,
|
||||
},
|
||||
rotating: {
|
||||
enabled: false,
|
||||
|
Reference in New Issue
Block a user