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: free line position middle commit for prototype fix #280

Merged
merged 4 commits into from
Dec 4, 2019

Conversation

jinwoo-kim-nhn
Copy link
Contributor

@jinwoo-kim-nhn jinwoo-kim-nhn commented Nov 29, 2019

현상

버그 원인

  • 전제1: ImageEditor는 rotate 기능을 위해 모든 그려지는 객체의 origin을 center, center 로 변경해줌
  • 전제2: Free Drwaing 의 path객체는 그리기 시작할때 originX, originY값을 지정하고 그릴 수 없음 (default: left, top) 으로 path:created 이벤트가 발생하면 obj를 받아서 origin을 (center, center)로 업데이트 해줌.
  • 원인: origin이 변경되면 x, y 포지션 값 또한 변경되어야 하지만 우리 코드에서는 처리해주는 부분이 없어서, origin이 변경되는 순간 보여지는 포지션이 처음 그릴때와 틀리게 보이게 됨.

버그 해결

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.

[12/03] 리뷰 완료합니다.수고하셨습니다.

@@ -996,7 +996,11 @@ class Graphics {
* @private
*/
_onPathCreated(obj) {
obj.path.set(consts.fObjectOptions.SELECTION_STYLE);
const objCenter = obj.path.getCenterPoint();
Copy link
Contributor

Choose a reason for hiding this comment

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

바로 디스트럭쳐링 써도 되겠네요.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

넵 그렇군요. 적용하겠습니다. 감사합니다.

@@ -996,7 +996,11 @@ class Graphics {
* @private
*/
_onPathCreated(obj) {
obj.path.set(consts.fObjectOptions.SELECTION_STYLE);
const objCenter = obj.path.getCenterPoint();
obj.path.set(extend({}, consts.fObjectOptions.SELECTION_STYLE, {
Copy link
Contributor

Choose a reason for hiding this comment

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

extend의 첫번째 파라미터에 {left, top}의 객체를 넣으면 파라미터가 한개 줄어드네요.

 obj.path.set(extend({
  left: objCenter.x,
  top: objCenter.y
}, consts.fObjectOptions.SELECTION_STYLE));

Copy link
Contributor Author

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 7560063 into master Dec 4, 2019
@jinwoo-kim-nhn jinwoo-kim-nhn deleted the fix/freelineDrawPosition branch March 20, 2020 08:13
HerlinMatos pushed a commit to EveryMundo/tui.image-editor that referenced this pull request Jul 2, 2020
* fix: free line position middle commit for prototype fix

* fix: complate free line drawing bug

* fix: added test and object extend method change

* fix: apply code review
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

2 participants