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

feat: undo redo for slider filter (fixed #310) #319

Merged
merged 8 commits into from
Feb 7, 2020

Conversation

jinwoo-kim-nhn
Copy link
Contributor

@jinwoo-kim-nhn jinwoo-kim-nhn commented Feb 3, 2020

Please check if the PR fulfills these requirements

  • It's submitted to right branch according to our branching model
  • It's right issue type on title
  • When resolving a specific issue, it's referenced in the PR's title (e.g. fix #xxx[,#xxx], where "xxx" is the issue number)
  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes/features)
  • Docs have been added/updated (for bug fixes/features)
  • It does not introduce a breaking change or has description for the breaking change

Description

issue

슬라이더 UI의 drag도중에는 undo 스택에 반영 안되도록 개선

  • rotate 기능에 구현된 부분을 참고하여 변경 (isSilent 플래그를 추가하여 운영)

불필요한 sepia2: 'vintage' mapping을 제거 하고 vintage: 'vintage' 만 남김

@jinwoo-kim-nhn jinwoo-kim-nhn changed the title feat: undo redo for slider filter feat: undo redo for slider filter (fixed #310) Feb 3, 2020
Copy link
Contributor

@dongsik-yoo dongsik-yoo left a comment

Choose a reason for hiding this comment

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

[02/07] 수고하셨습니다.

src/js/action.js Outdated
@@ -41,8 +41,14 @@ export default {
this.ui.rotate.setRangeBarAngle('setAngle', angle);
}
};
const setFilterSateRangeBarOnAction = filterOptions => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Sate? => State 인가요?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

오타 수정하겠습니다. 감사합니다.

const maskObj = graphics.getObject(maskObjId);

if (!(maskObj && maskObj.isType('image'))) {
return Promise.reject(rejectMessages.invalidParameters);
Copy link
Contributor

Choose a reason for hiding this comment

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

이 함수가 Promise.reject을 하는 것은 안 맞는 것 같아요.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

네 맞네요. 수정하겠습니다

graphics.remove(options.mask);
} else {
this.undoData.options = filterComp.getOptions(type);
if (!isSilent) {
Copy link
Contributor

Choose a reason for hiding this comment

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

cacheUndoDataForSilent가 꼭 필요할까 싶습니다. isSilent가 아니면 undoData를 만들고, isSilent이면 최초 한번만 만들면 어떨까요? undoData는 Command의 첫 실행의 상태값만 보관하면 되기 때문입니다.

Copy link
Contributor Author

@jinwoo-kim-nhn jinwoo-kim-nhn Feb 7, 2020

Choose a reason for hiding this comment

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

isSilent === true 이면 처음에만 undoData를 만들도록 수정하겠습니다.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

다시 생각해보니 서로 다른 명령간에 undoData가 섞이면 안되기 때문에, 각각의 명령별로 cacheUndo가 필요하네요 전체적으로 다시 수정하였습니다.

@@ -77,50 +77,122 @@ class Filter extends Submenu {
* @param {Function} actions.applyFilter - apply filter option
*/
addEvent({applyFilter}) {
const changeRangeValue = this._changeRangeValue.bind(this, applyFilter);
const changeFilterState = filterName => this._changeFilterState.bind(this, applyFilter, filterName);
Copy link
Contributor

Choose a reason for hiding this comment

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

addEvent에서 바인딩한 이벤트를 해제할 필요는 없나요?

Copy link
Member

Choose a reason for hiding this comment

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

👍 destroy에서 해제해주면 좋겠네요

Copy link
Contributor Author

Choose a reason for hiding this comment

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

넵. detroy 만드는걸 빼먹었네요 반영하겠습니다.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

이 부분은 일단 작업해 놨습니다만, ImageEditor.destroy 할때 UI 부분을 전체적으로 destroy 하는 부분이 안되고 있네요. 바로 이슈 잡아서 이후 작업으로 나머지도 진행 하겠습니다.

@@ -41,8 +41,14 @@ export default {
this.ui.rotate.setRangeBarAngle('setAngle', angle);
}
};
const setFilterSateRangeBarOnAction = filterOptions => {
if (this.ui.submenu === 'filter') {
this.ui.filter.setFilterState(filterOptions);
Copy link
Member

Choose a reason for hiding this comment

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

한 파일에 this.ui가 꽤 많이 나오는데 캐싱해서 쓰면 어떨까요 ㅎㅎ

Copy link
Contributor Author

Choose a reason for hiding this comment

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

캐싱해서 쓰면 참조가 깨지면서 에러가 나는 현상이 있네요;; 이부분은 이 pr에서는 일단 두고 추후에 신중이 일괄 작업하겠습니다.

undoData.options = prevfilterOption;
} else {
undoData.options = cacheUndoData.options;
}
Copy link
Member

Choose a reason for hiding this comment

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

여기 삼항 연산자를 쓰면 어떨까요??

undoData.options = cacheUndoData ? cacheUndoData.options : prevfilterOption;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

네 이 부분 반영하겠습니다.

Copy link
Member

@junghwan-park junghwan-park left a comment

Choose a reason for hiding this comment

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

완료입니다! 고생많으셨어요

@jinwoo-kim-nhn jinwoo-kim-nhn merged commit 800f6c2 into master Feb 7, 2020
@jinwoo-kim-nhn jinwoo-kim-nhn deleted the feat/undoRedoForSliderFilter branch March 20, 2020 08:13
HerlinMatos pushed a commit to EveryMundo/tui.image-editor that referenced this pull request Jul 2, 2020
* feat: slider undo redo for filter - middle commit

* middle commit

* feat: prototype complete

* fix: added test and refactoring

* refactor: add jsdoc with filter typename map

* refactor: isSilent for cacheUndodata

* apply codereview

Co-authored-by: superlucky84 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants