Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update imageEditor.js #50

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,3 @@ report
*.vim
test.html

# Compiled files
dist
OculusMode marked this conversation as resolved.
Show resolved Hide resolved
14 changes: 12 additions & 2 deletions src/js/imageEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -297,12 +297,12 @@ class ImageEditor {
_onKeyDown(e) {
if ((e.ctrlKey || e.metaKey) && e.keyCode === keyCodes.Z) {
// There is no error message on shortcut when it's empty
this.undo()['catch'](() => {});
this.undo()['catch'](() => { });
}

if ((e.ctrlKey || e.metaKey) && e.keyCode === keyCodes.Y) {
// There is no error message on shortcut when it's empty
this.redo()['catch'](() => {});
this.redo()['catch'](() => { });
OculusMode marked this conversation as resolved.
Show resolved Hide resolved
}

if ((e.keyCode === keyCodes.BACKSPACE || e.keyCode === keyCodes.DEL)) {
Expand Down Expand Up @@ -486,6 +486,16 @@ class ImageEditor {
this._graphics.renderAll();
}

/**
* set selection style properties
* @param {Object} styles - Object of styles
* @example
* imageEditor.setSelectionStyle({ cornerSize: 50 });
*/
setSelectionStyle(styles) {
this._graphics.setSelectionStyle(styles);
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is an option for setting selectionStyle.

I don't think this method is required.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@junghwan-park indeed there is but only if you include ui. If you don't include UI. then there is no way to change selectionStyles i.e. cornerSize.
Hence one can use this method to do something like:

imageEditor.setSelectionStyle({ cornerSize: 10 });

/**
* discard selction
* @example
Expand Down