kopia lustrzana https://github.com/jameshball/osci-render
Correctly sub-list MoveTo arguments
rodzic
f809b9f577
commit
642f165501
|
@ -18,7 +18,7 @@ class LineTo {
|
||||||
int expectedArgs = isHorizontal && isVertical ? 2 : 1;
|
int expectedArgs = isHorizontal && isVertical ? 2 : 1;
|
||||||
|
|
||||||
if (args.size() % expectedArgs != 0 || args.size() < expectedArgs) {
|
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<>();
|
List<Shape> lines = new ArrayList<>();
|
||||||
|
|
|
@ -20,13 +20,13 @@ class MoveTo {
|
||||||
state.currPoint = vec;
|
state.currPoint = vec;
|
||||||
state.initialPoint = state.currPoint;
|
state.initialPoint = state.currPoint;
|
||||||
if (args.size() > 2) {
|
if (args.size() > 2) {
|
||||||
return LineTo.absolute(state, args.subList(2, args.size() - 1));
|
return LineTo.absolute(state, args.subList(2, args.size()));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
state.currPoint = state.currPoint.translate(vec);
|
state.currPoint = state.currPoint.translate(vec);
|
||||||
state.initialPoint = state.currPoint;
|
state.initialPoint = state.currPoint;
|
||||||
if (args.size() > 2) {
|
if (args.size() > 2) {
|
||||||
return LineTo.relative(state, args.subList(2, args.size() - 1));
|
return LineTo.relative(state, args.subList(2, args.size()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue