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/cropzone fix ratio #320

Merged
merged 5 commits into from
Feb 7, 2020
Merged

Feat/cropzone fix ratio #320

merged 5 commits into from
Feb 7, 2020

Conversation

jinwoo-kim-nhn
Copy link
Contributor

@jinwoo-kim-nhn jinwoo-kim-nhn commented Feb 4, 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

작업내용

  • 비율 고정시에는 드레그 마우스 포인터와 리사이즈 컨트롤 위치에 따른 리사이즈 비율의 너비 , 높이 기준점을 정하기 위해서 8개 방위의 리사이즈 컨트롤 별로 계산식이 존재 해야되기 때문에, 기존 방식을 버리고 더 접근하기 쉬운 방식으로 8개의 방위별로 각각 dimension을 구하는 방식으로 변경

    • 기존의 방식은 리사이즈의 기준점이 top-left corner 를 이용해 변경할때와, bottom-right corner를 변경할때의 두가지 관점에서만 dimension값을 판단한 값을 판단하여 8개의 각각 방위마다 조합하여 사용함.

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] 수고 많으십니다.

@@ -97,6 +98,7 @@ class Cropper extends Component {
lockScalingFlip: true,
lockRotation: true
}, this.graphics.cropSelectionStyle);
// this._cropzone.lockUniScaling = true;
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.

넵 제거하겠습니다. 감사합니다.

* @returns {{width: number, height: number}}
* @private
*/
_cornerTypeValid(selectedCorner) {
Copy link
Contributor

Choose a reason for hiding this comment

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

이런 함수는 this를 사용하지 않으니 독립적인 함수로 존재하면 깔끔할 것 같아요. 클래스의 다른 함수들도 그런 모습들이 있네요.
그리고 약간 미세 튜닝 같긴 하지만, 함수 내의 배열은 모듈 로딩할 때 한번만 만드는 것이 어떨까 합니다.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

넵 반영하겠습니다.

* @private
*/
_resizeTL({x, y}) {
const rect = this.getBoundingRect(false, true);
Copy link
Contributor

Choose a reason for hiding this comment

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

이 경우는 destructuring 쓰는게 코드가 좀 더 작지 않을까요?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

넵 그럴것 같네요 반영하겠습니다.

* @private
*/
_calcTopLeftScalingSizeFromPointer(x, y) {
_resizeMT({y}) {
Copy link
Contributor

Choose a reason for hiding this comment

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

_resize~~~ 메소드에 비슷한 패턴의 코드가 중복인 것 같은데요, 공통 부분을 추출할 수 있을까요?

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 7b9d7ea into master Feb 7, 2020
@jinwoo-kim-nhn
Copy link
Contributor Author

중복패턴 제거 작업을 #327 에서 마저 작업함

HerlinMatos pushed a commit to EveryMundo/tui.image-editor that referenced this pull request Jul 2, 2020
* middle commit

* feat: cropzone resizer prototype complete

* refactor: jsdoc with code style changed

* feat: cropzone preset ratio complete

* apply codereview
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

3 participants