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

노드 정렬 알고리즘(LayoutManager)구현, 리팩토링 #49

Merged
merged 7 commits into from
Nov 18, 2023

Conversation

yang1318
Copy link
Collaborator

@yang1318 yang1318 commented Nov 18, 2023

관련 이슈

작업한 내용

  1. Head 의 노드 정보가 주어졌을 때, Head를 기준으로 나머지의 위치를 재정렬 하는 코드 작성

    • Before : x, y 좌표를 직접 정해주지 않으면 자유분방하게 배치됨
      스크린샷 2023-11-18 오후 9 32 24

    • After : arrangement 함수만 호출해주면 자동으로 정렬됨
      스크린샷 2023-11-18 오후 9 32 44

  2. 리팩토링

    • Node 클래스의 nodes 타입을 List에서 List로 변경함. 자식 노드는 무조건 RectangleNode라서 변경.
    • Dp, Px 클래스에서 operator 추가 구현 (float, int로도 연산 가능하도록 함)
    • toPx, toDp의 함수의 반환값이 기존에는 Int형이었는데, 매번 float로 바꾸는 일이 많아서 float를 반환하도록 변경

@yang1318 yang1318 added this to the 마인드 맵 milestone Nov 18, 2023
@yang1318 yang1318 self-assigned this Nov 18, 2023
@github-actions github-actions bot added the 📱AOS 안드로이드 작업 label Nov 18, 2023
@yang1318 yang1318 added 💡Feature 기능 개발 💪Refactor 코드 리팩토링 labels Nov 18, 2023
@yang1318 yang1318 changed the title Aos feature/mindmap node 노드 정렬 알고리즘(LayoutManager)구현, 리팩토링 Nov 18, 2023
val scale = context.resources.displayMetrics.density
return (pxVal / scale).toInt()
return pxVal / scale
Copy link
Member

Choose a reason for hiding this comment

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

Int형이라서 너무 괴로웠는데 좋은거 같습니다.

@@ -3,17 +3,17 @@ package boostcamp.and07.mindsync.data.model
sealed class Node(
open val path: NodePath,
open val description: String,
open val nodes: List<Node>,
open val nodes: List<RectangleNode>,
Copy link
Member

Choose a reason for hiding this comment

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

자식들은 무조건 RectangleNode 일수밖에 없어서 이렇게 하신것도 좋은거 같아요

Comment on lines 3 to +6
sealed class Node(
open val path: NodePath,
open val description: String,
open val nodes: List<Node>,
open val nodes: List<RectangleNode>,
Copy link
Member

Choose a reason for hiding this comment

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

Node를 RectangleNode로 변경하신 부분이 매우 좋은 거 같습니다!!

Comment on lines 10 to 12
private val verticalSpacing = Dp(50f)

fun arrangement(node: Node): Node {
Copy link
Member

Choose a reason for hiding this comment

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

arrangement 함수를 동사로 변경하면 좋을 거 같아요!!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

앗 맞네요 ㅎㅎ arrangeNode로 수정하겠습니다~!!

Comment on lines 67 to 69
}

}
Copy link
Member

Choose a reason for hiding this comment

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

불필요한 공백 제거하면 좋을거 같아요

@hegleB hegleB merged commit 88ba75a into AOS-feature/mindmap Nov 18, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📱AOS 안드로이드 작업 💡Feature 기능 개발 💪Refactor 코드 리팩토링
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants