Correctly sub-list MoveTo arguments

pull/35/head
James Ball 2021-07-09 20:14:27 +01:00
rodzic f809b9f577
commit 642f165501
2 zmienionych plików z 3 dodań i 3 usunięć

Wyświetl plik

@ -18,7 +18,7 @@ class LineTo {
int expectedArgs = isHorizontal && isVertical ? 2 : 1;
if (args.size() % expectedArgs != 0 || args.size() < expectedArgs) {
throw new IllegalArgumentException("SVG lineto command has incorrect number of arguments.");
throw new IllegalArgumentException("SVG lineto command has incorrect number of arguments. Expected multiple of " + expectedArgs + ", got " + args.size());
}
List<Shape> lines = new ArrayList<>();

Wyświetl plik

@ -20,13 +20,13 @@ class MoveTo {
state.currPoint = vec;
state.initialPoint = state.currPoint;
if (args.size() > 2) {
return LineTo.absolute(state, args.subList(2, args.size() - 1));
return LineTo.absolute(state, args.subList(2, args.size()));
}
} else {
state.currPoint = state.currPoint.translate(vec);
state.initialPoint = state.currPoint;
if (args.size() > 2) {
return LineTo.relative(state, args.subList(2, args.size() - 1));
return LineTo.relative(state, args.subList(2, args.size()));
}
}