Skip to content

Commit

Permalink
Improve edit current svg
Browse files Browse the repository at this point in the history
  • Loading branch information
hieuwu committed Nov 27, 2024
1 parent b836a95 commit 2d63e78
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,6 @@ fun DrawCanvas(modifier: Modifier, viewModel: EditViewModel) {

svg.apply {
val svgCommand = SVGCommand.MoveTo(eventX, eventY).apply {
//TODO Add color for paint
paintColor = editManager.currentPaint.color.value
brushSizeId = Size.MEDIUM.id
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class SvgResourceManager(
editManager.addDrawPath(draw.path)
editManager.setPaintColor(draw.paint.color)
}
editManager.svg.addAll(svgPaths.getCommands())
}

override suspend fun saveResource(path: Path) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ class SVG {
commands.addLast(command)
}

fun getCommands(): ArrayDeque<SVGCommand> {
return commands
}

fun addPath(path: DrawPath) {
paths.addLast(path)
}
Expand Down Expand Up @@ -110,6 +114,10 @@ class SVG {
}
}

fun addAll(commands: ArrayDeque<SVGCommand>) {
commands.addAll(commands)
}

companion object {
fun parse(path: Path): SVG = SVG().apply {
val xmlParser = Xml.newPullParser()
Expand Down

0 comments on commit 2d63e78

Please sign in to comment.