Let the animated panel handle invalidating the regions exposed by
scrolling so that it can do so with the actual dimensions of the panel (the scene view only knows how big its model wants to be). Changed scrollView to viewWillScroll to more accurately reflect what's going on. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1036 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: AnimatedPanel.java,v 1.12 2002/02/19 04:45:13 mdb Exp $
|
||||
// $Id: AnimatedPanel.java,v 1.13 2002/02/19 05:03:17 mdb Exp $
|
||||
|
||||
package com.threerings.media.animation;
|
||||
|
||||
@@ -159,6 +159,8 @@ public class AnimatedPanel extends Canvas implements AnimatedView
|
||||
// }
|
||||
// _last = now;
|
||||
|
||||
int width = getWidth(), height = getHeight();
|
||||
|
||||
// if scrolling is enabled, determine the scrolling delta to be
|
||||
// used and do the business
|
||||
int dx = 0, dy = 0;
|
||||
@@ -180,6 +182,18 @@ public class AnimatedPanel extends Canvas implements AnimatedView
|
||||
_lasty = ydist;
|
||||
}
|
||||
|
||||
// and add invalid rectangles for the exposed areas
|
||||
if (dx > 0) {
|
||||
invalidRects.add(new Rectangle(width - dx, 0, dx, height));
|
||||
} else if (dx < 0) {
|
||||
invalidRects.add(new Rectangle(0, 0, -dx, height));
|
||||
}
|
||||
if (dy > 0) {
|
||||
invalidRects.add(new Rectangle(0, height - dy, width, dy));
|
||||
} else if (dy < 0) {
|
||||
invalidRects.add(new Rectangle(0, 0, width, -dy));
|
||||
}
|
||||
|
||||
// let our derived classes do whatever they need to do to
|
||||
// prepare to be scrolled
|
||||
viewWillScroll(dx, dy);
|
||||
@@ -208,7 +222,6 @@ public class AnimatedPanel extends Canvas implements AnimatedView
|
||||
createBackBuffer(gc);
|
||||
}
|
||||
|
||||
int width = getWidth(), height = getHeight();
|
||||
Graphics g = null;
|
||||
try {
|
||||
g = _backimg.getGraphics();
|
||||
@@ -236,20 +249,6 @@ public class AnimatedPanel extends Canvas implements AnimatedView
|
||||
if (_stime != 0) {
|
||||
// if it was OK, we may need to do some scrolling
|
||||
g.copyArea(0, 0, width, height, -dx, -dy);
|
||||
|
||||
// and add invalid rectangles for the exposed areas
|
||||
if (dx > 0) {
|
||||
invalidRects.add(
|
||||
new Rectangle(width - dx, 0, dx, height));
|
||||
} else if (dx < 0) {
|
||||
invalidRects.add(new Rectangle(0, 0, -dx, height));
|
||||
}
|
||||
if (dy > 0) {
|
||||
invalidRects.add(
|
||||
new Rectangle(0, height - dy, width, dy));
|
||||
} else if (dy < 0) {
|
||||
invalidRects.add(new Rectangle(0, 0, width, -dy));
|
||||
}
|
||||
}
|
||||
|
||||
// iterate through the invalid rectangles, copying those
|
||||
|
||||
Reference in New Issue
Block a user