@@ -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
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user