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

fix: not uncheck filter's checkbox when reset image [fix #552] #570

Merged
merged 1 commit into from
Apr 8, 2021
Merged
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
fix: not uncheck filter's checkbox when reset image [fix #552]
  • Loading branch information
lja1018 committed Apr 1, 2021
commit e504fc41b6e74da098b90ecf3b57016bc1246990
7 changes: 7 additions & 0 deletions apps/image-editor/src/js/action.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ export default {
this._graphics.endHandMode();
}
};
const initFilterState = () => {
if (this.ui.filter) {
this.ui.filter.initFilterCheckBoxState();
}
};

return extend(
{
Expand Down Expand Up @@ -104,6 +109,7 @@ export default {
exitCropOnAction();
this.loadImageFromURL(this.ui.initializeImgUrl, 'resetImage').then((sizeValue) => {
exitCropOnAction();
initFilterState();
this.ui.resizeEditor({ imageSize: sizeValue });
this.clearUndoStack();
this._initHistory();
Expand All @@ -130,6 +136,7 @@ export default {
this.loadImageFromFile(file)
.then((sizeValue) => {
exitCropOnAction();
initFilterState();
this.clearUndoStack();
this.ui.activeMenuEvent();
this.ui.resizeEditor({ imageSize: sizeValue });
Expand Down
13 changes: 13 additions & 0 deletions apps/image-editor/src/js/ui/filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,19 @@ class Filter extends Submenu {
this.checkedMap[filterName].checked = !isRemove;
}

/**
* Init all filter's checkbox to unchecked state
lja1018 marked this conversation as resolved.
Show resolved Hide resolved
*/
initFilterCheckBoxState() {
snippet.forEach(
this.checkedMap,
(filter) => {
filter.checked = false;
},
this
);
}

/**
* Set filter for undo changed
* @param {string} filterName - filter name
Expand Down