Переглянути джерело

cannot figure out why on fast forwards we always try to redraw from the last element of the arrylist instead of the first unfinished one

tsdedhar 6 роки тому
батько
коміт
61fbba4762

BIN
assignments/a2/.gradle/4.7/fileHashes/fileHashes.bin


BIN
assignments/a2/.gradle/4.7/fileHashes/fileHashes.lock


BIN
assignments/a2/.gradle/4.7/taskHistory/taskHistory.bin


BIN
assignments/a2/.gradle/4.7/taskHistory/taskHistory.lock


BIN
assignments/a2/.gradle/buildOutputCleanup/buildOutputCleanup.lock


BIN
assignments/a2/build/classes/java/main/Model.class


BIN
assignments/a2/build/classes/java/main/Thingy.class


BIN
assignments/a2/build/classes/java/main/previewLine.class


BIN
assignments/a2/build/classes/java/main/previewPanel$1.class


BIN
assignments/a2/build/classes/java/main/previewPanel.class


+ 6 - 4
assignments/a2/src/main/java/Model.java

@@ -36,7 +36,6 @@ public class Model extends Observable
       // 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
@@ -90,11 +89,14 @@ public class Model extends Observable
       tempLen += thingies.get(i).getVisibleLen();
       index = i;
     }
-    
+ 
     // off by one adjustments if we're at the end of a thingy
-    if (curThingy.getVisibleLen() == 0 && tempLen > x) curThingy = thingies.get(index - 1);
-    if (curThingy.getVisibleLen() == curThingy.getPoints().size() && tempLen < x) curThingy = thingies.get(index + 1);
+    //if (index > 0 && curThingy.getVisibleLen() == 0 && tempLen > x) curThingy = thingies.get(index - 1);
+    //if (curThingy.getVisibleLen() == curThingy.getPoints().size() && tempLen < x) curThingy = thingies.get(index + 1);
     
+    System.out.println("index is: " + index);
+    System.out.println("curthing is: " + thingies.indexOf(curThingy));
+    curThingy = thingies.get(index);
     // now modify tempThingy
     // if we want to go back in time
     if (tempLen > x)

+ 3 - 0
assignments/a2/src/main/java/Sidepane.java

@@ -94,11 +94,13 @@ class previewPanel extends JPanel
 {
   private Model model;
   private JSlider slider;
+  private JLabel label;
   private previewLine preview;
   
   public previewPanel(Model m)
   {
     this.model = m;
+    this.label = new JLabel("Thiccness");
     this.slider = new JSlider(1, 50, model.getThiccness());
     this.slider.addChangeListener(new ChangeListener()
       {
@@ -112,6 +114,7 @@ class previewPanel extends JPanel
     this.setPreferredSize(new Dimension(280, 240));
     this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
     this.add(preview);
+    this.add(label);
     this.add(slider);
   }
 }