Skip to content

Commit 31beb88

Browse files
committed
fix: consider e notation on path normalization
1 parent 255280a commit 31beb88

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

svg-to-compose/src/commonMain/kotlin/dev/tonholo/s2c/domain/ImageVectorNode.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -488,8 +488,9 @@ private fun normalizePath(path: String): String {
488488
continue
489489
}
490490

491+
val isNotENotation = char != 'e'
491492
val isNotClosingCommand = (char.isLetter() && char.lowercaseChar() != PathCommand.Close.value)
492-
val isNegativeSign = (lastChar.isDigit() && char == '-')
493+
val isNegativeSignSeparator = (lastChar.isDigit() && char == '-')
493494
val reachMaximumDotNumbers = dotCount == 2
494495

495496
char.toPathCommand()?.let {
@@ -506,7 +507,7 @@ private fun normalizePath(path: String): String {
506507
.trimWhitespaceBeforeClose(lastChar, current = char)
507508
.append(
508509
when {
509-
isNotClosingCommand || isNegativeSign || reachMaximumDotNumbers -> {
510+
isNotENotation && (isNotClosingCommand || isNegativeSignSeparator || reachMaximumDotNumbers) -> {
510511
dotCount = resetDotCount(current = char)
511512
" $char"
512513
}

0 commit comments

Comments
 (0)