Skip to content

Commit

Permalink
refactor(#70): LineView arrageNode 제거 및 NodeView arrangeNode에 updated…
Browse files Browse the repository at this point in the history
…Head 추가
  • Loading branch information
hegleB committed Nov 21, 2023
1 parent df2ab9b commit 9298737
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import boostcamp.and07.mindsync.data.model.Node
import boostcamp.and07.mindsync.data.model.RectangleNode
import boostcamp.and07.mindsync.ui.util.Dp
import boostcamp.and07.mindsync.ui.util.toPx
import boostcamp.and07.mindsync.ui.view.layout.MindmapRightLayoutManager

class LineView constructor(
context: Context,
Expand All @@ -27,20 +26,14 @@ class LineView constructor(
}
private val path = Path()
var head = SampleNode.head
private val rightLayoutManager = MindmapRightLayoutManager()

override fun onDraw(canvas: Canvas) {
super.onDraw(canvas)
arrangeNode()
if (head.nodes.isNotEmpty()) {
traverseLine(canvas, head, 0)
}
}

private fun arrangeNode() {
head = rightLayoutManager.arrangeNode(head)
}

fun updateWithNewHead(newHead: Node) {
head = newHead
invalidate()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ class NodeView constructor(context: Context, attrs: AttributeSet?) : View(contex

private fun arrangeNode() {
head = rightLayoutManager.arrangeNode(head)
mindmapContainer?.updateHead(head)
}

override fun onTouchEvent(event: MotionEvent): Boolean {
Expand Down

0 comments on commit 9298737

Please sign in to comment.