|
@@ -31,6 +31,22 @@ public class Model extends Observable
|
|
|
|
|
|
public void newThingy(int x, int y)
|
|
|
{
|
|
|
+ if (totalLen != totalVisibleLen)
|
|
|
+ {
|
|
|
+ // resize curthingy to it's visible length
|
|
|
+ ArrayList<Point> temp = (ArrayList<Point>)curThingy.getPoints().subList(0, curThingy.getVisibleLen());
|
|
|
+ curThingy.setPoints(temp);
|
|
|
+ //curThingy.points.addAll(temp);
|
|
|
+ // reset total length to total visible length
|
|
|
+ totalLen = totalVisibleLen;
|
|
|
+ // delete extra nodes in thingies
|
|
|
+ int start = thingies.indexOf(curThingy);
|
|
|
+ for (int i = start + 1; i < thingies.size(); i++)
|
|
|
+ {
|
|
|
+ thingies.remove(i);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
curThingy = new Thingy(curColour, curThiccness);
|
|
|
thingies.add(curThingy);
|
|
|
curThingy.addPoint(x, y);
|
|
@@ -181,6 +197,11 @@ class Thingy
|
|
|
{
|
|
|
return points;
|
|
|
}
|
|
|
+
|
|
|
+ public void setPoints(ArrayList a)
|
|
|
+ {
|
|
|
+ points = a;
|
|
|
+ }
|
|
|
|
|
|
public Color getColour()
|
|
|
{
|