Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
haven2world committed Nov 15, 2022
1 parent 2bafda3 commit aff7d0b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ const DefaultOptions: Required<ImageEditOptions> = {
disableCrop: false,
disableRotate: false,
disableSideResize: false,
onSelectState: ImageEditOperation.ResizeAndRotate,
};

/**
Expand Down Expand Up @@ -182,13 +183,11 @@ export default class ImageEdit implements EditorPlugin {
switch (e.eventType) {
case PluginEventType.SelectionChanged:
if (
// this.options.onSelectState !== ImageEditOperation.None &&
e.selectionRangeEx &&
e.selectionRangeEx.type === SelectionRangeTypes.ImageSelection
) {
this.setEditingImage(
e.selectionRangeEx.image,
ImageEditOperation.ResizeAndRotate
);
this.setEditingImage(e.selectionRangeEx.image, this.options.onSelectState);
}
break;
case PluginEventType.MouseDown:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import ModeIndependentColor from './ModeIndependentColor';
import { ImageEditOperation } from '../enum';

/**
* Options for ImageEdit plugin
Expand Down Expand Up @@ -63,4 +64,10 @@ export default interface ImageEditOptions {
* Whether image crop is disabled. @default false
*/
disableCrop?: boolean;

/**
* Which operations will be executed when image is selected
* @default ImageEditOperation.ResizeAndRotate
*/
onSelectState?: ImageEditOperation;
}

0 comments on commit aff7d0b

Please sign in to comment.