Format, fix an edgecase
Test / test (push) Failing after 2m3s

This commit is contained in:
2026-02-24 16:04:52 +09:00
parent 60f6465c24
commit b44ea6d321
2 changed files with 8 additions and 5 deletions
+1 -2
View File
@@ -78,8 +78,7 @@ class KanjiStrokeNumber {
KanjiStrokeNumber(this.num, this.position);
@override
String toString() =>
'KanjiStrokeNumber(number: $num, position: $position)';
String toString() => 'KanjiStrokeNumber(number: $num, position: $position)';
}
/// Contents of a `<path>` element in the KanjiVG SVG files
+7 -3
View File
@@ -32,7 +32,9 @@ const _commands = {
// const _uppercaseCommands = {'M', 'Z', 'L', 'H', 'V', 'C', 'S', 'Q', 'T', 'A'};
final _commandPattern = RegExp("(?=[${_commands.join('')}])");
final _floatPattern = RegExp(r"^[-+]?(?:[0-9]+\.?[0-9]*|[0-9]*\.?[0-9]+)(?:[eE][-+]?[0-9]+)?");
final _floatPattern = RegExp(
r"^[-+]?(?:[0-9]+\.?[0-9]*|[0-9]*\.?[0-9]+)(?:[eE][-+]?[0-9]+)?",
);
class ParserResult<T> {
final T value;
@@ -253,8 +255,10 @@ Path parsePath(String pathdef) {
segments.add(Move(to: currentPos));
startPos = currentPos;
} else if (command == "Z") {
// TODO Throw error if not available:
segments.add(Close(start: currentPos, end: startPos!));
if (startPos == null) {
throw InvalidPathError("Path closed without a starting position.");
}
segments.add(Close(start: currentPos, end: startPos));
currentPos = startPos;
} else if (command == "L") {
Point pos = token.args[0] as Point;