Animate Bugs and Fixes

Yup, there are some bugs in the demo, which means that there are some bugs in the template code. The code on the web site and on the U: drive is updated, but in case you want to change code you already downloaded, here are the bugs and fixes:

  BUG: Handles not always updated correctly
FIX: change one line in InteractivePolygon::getBounds
was: int maxy = (int) maxx;
should be: int maxy = (int) miny;
FILES:InteractivePolygon.java
template updated: 1/30, 9:30am (on website only)

BUG: choosing yellow as draw color gives gray
FIX: change last element in keyframeApp::_definedColors from Color.gray to Color.yellow
FILES:keyframeApp.java
template updated: 1/27, 12:30pm

BUG: selection handles don't stay with the shape when changing keyframes using Edit Keyframe
FIX:
  1. in draw.DrawCanvas::setShapes() add the following line of code after the outer for loop (over shapes):
    selectShape(NO_SELECTION);
  2. in draw.DrawCanvas.setShapes() add the following line of code after the inner for loop (over vertices):
    ((InteractivePolygon) oldPoly).updateHandles();
  3. in draw.InteractivePolygon add the following two methods:
    protected Rectangle getBounds() {
       if (numVertices() == 0 ) {
         return null;
       }
    
       int minx = (int) getVertex(0).getX();
       int miny = (int) getVertex(0).getY();
       int maxx = (int) minx;
       int maxy = (int) maxx;    
    
      for (int i=1; i < numVertices(); i++) {
         int x = (int) getVertex(i).getX();
         int y = (int) getVertex(i).getY();
    
         minx = Math.min(minx, x);
         miny = Math.min(miny, y);
         maxx = Math.max(maxx, x);
         maxy = Math.max(maxy, y);
       }
    
       return new Rectangle(minx, miny, maxx-minx, maxy-miny);
     } // end getBounds
    
    public void updateHandles() {}	     
    	    
  4. in draw.InteractiveRect add the following method:
    public void updateHandles() {
      setHandlePositions(getBounds());
    }
    
FILES:draw.DrawCanvas.java
draw.InteractivePolygon.java
draw.InteractiveRect.java
template updated: 1/27, 12:30pm


jpower@cs.washington.edu
Last modified: Mon Feb 2 16:00:45 PST 1998