Skip to content

Fix(#177, #178): 화이트보드(지우개, 메모지) 관련 버그 수정 #179

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

Merged
merged 2 commits into from
Dec 4, 2023

Conversation

Byeonjin
Copy link
Collaborator

@Byeonjin Byeonjin commented Dec 2, 2023

작업 개요

화이트보드(지우개, 메모지) 관련 버그 수정

작업 사항

fix: 지우개 툴 선택 후 선택툴 클릭시 요소 삭제 오류 해결 close #177
fix: 메모지 내에 입력한 개행이 사라지는 버그 close #178

고민한 점들(필수 X)

fix: 지우개 툴 선택 후 선택툴 클릭시 요소 삭제 오류 해결

  • 원인: 지우개의 selection:created 이벤트가 등록된 상태로 선택 툴에서 같은 이벤트가 발생해 그래픽 요소 삭제

  • 해결: 툴이 바뀔 때마다 이벤트를 지워주는 코드가 있는데 selection:created도 지우도록 했습니다.

fix: 메모지 내에 입력한 개행이 사라지는 버그

  • 원인: 메모지에 공백을 입력시 텍스트를 디폴트 값으로 바꿔주게 구현이 되어있습니다.
    개행만 하고 다른 텍스트를 입력하지 않았을 때를 체크하기 위해 모든 개행문자를 제거하고 글자 수를 체크합니다.
    이 개행문자가 제거된 텍스트가 편집후 메모지의 텍스트 내용으로 갱신되기 때문에 문제가 발생했습니다.

  • 해결: 개행만하고 다른 문자를 입력하지 않는가를 체크하기 위해 개행을 제거하는 동작을 조건문 안에서만 실행되게 수정했습니다.

  • 추가 사항: 개행 뿐만 아니라 띄어쓰기로만 이뤄진 텍스트인가도 체크하도록 정규표현식을 수정했습니다.

스크린샷(필수 X)

  • 삭제 버그 해결
2023-12-02.7.26.39.mov
  • 개행 제거 버그 해결
2023-12-02.7.27.01.mov

- 원인: 지우개의 selection:created 이벤트가 등록된 상태로 선택 툴에서 같은 이벤트가 발생해 그래픽 요소 삭제
- 해결: 툴이 바뀔 때마다 이벤트를 지워주는 코드가 있는데 selection:created도 지우도록 했습니다.
- 원인: 메모지에 공백을 입력시 텍스트를 디폴트 값으로 바꿔주게 구현이 되어있습니다.
개행만 하고 다른 텍스트를 입력하지 않았을 때를 체크하기 위해 모든 개행문자를 제거하고 글자 수를 체크합니다.
이 개행문자가 제거된 텍스트가 편집후 메모지의 텍스트 내용으로 갱신되기 때문에 문제가 발생했습니다.

- 해결: 개행만하고 다른 문자를 입력하지 않는가를 체크하기 위해 개행을 제거하는 동작을 조건문 안에서만 실행되게 수정했습니다.
@Byeonjin Byeonjin added 🐞 Fix 버그 수정 🛠️ Refactor 리팩토링 작업 FE 프론트엔드 작업 labels Dec 2, 2023
@Byeonjin Byeonjin added this to the 4주차 milestone Dec 2, 2023
@Byeonjin Byeonjin self-assigned this Dec 2, 2023
Copy link

netlify bot commented Dec 2, 2023

Deploy Preview for boarlog ready!

Name Link
🔨 Latest commit caffd7e
🔍 Latest deploy log https://app.netlify.com/sites/boarlog/deploys/656b06c80c915300081a3a09
😎 Deploy Preview https://deploy-preview-179--boarlog.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Collaborator

@Jw705 Jw705 left a comment

Choose a reason for hiding this comment

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

주말인데도 고생 많으셨습니다!

Comment on lines +210 to +220
const handleMouseUp = (target: fabric.Object | undefined) => {
if (!target) return;
canvas.remove(target);
});
};

canvas.on("selection:created", ({ selected }) => {
const handleSelectionCreated = (selected: fabric.Object[] | undefined) => {
if (activeTool === "eraser") {
selected?.forEach((object) => canvas.remove(object));
}
canvas.discardActiveObject().renderAll();
});
};
Copy link
Collaborator

Choose a reason for hiding this comment

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

함수로 분리한 거 좋네요!

Copy link
Collaborator

@LellowMellow LellowMellow left a comment

Choose a reason for hiding this comment

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

코드 잘 읽었습니다! 깔끔하게 정규식으로 처리하신 부분 좋습니다 :)

@Byeonjin Byeonjin merged commit 1d48c65 into boostcampwm2023:dev Dec 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FE 프론트엔드 작업 🐞 Fix 버그 수정 🛠️ Refactor 리팩토링 작업
Projects
None yet
3 participants