We need the ability to instruct the path *not* to scroll with the view

(useful when the path is actually operating in virtual coordinates which
are mapped to scrolled view coordinates by the pathable).


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1441 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2002-06-12 00:49:15 +00:00
parent 1a3ad13d6e
commit d7a41e61d8
@@ -1,5 +1,5 @@
//
// $Id: LinePath.java,v 1.6 2002/06/11 02:39:14 mdb Exp $
// $Id: LinePath.java,v 1.7 2002/06/12 00:49:15 mdb Exp $
package com.threerings.media.util;
@@ -46,12 +46,26 @@ public class LinePath implements Path
_duration = duration;
}
/**
* Instructs this path to adjust itself when the view scrolls, or not.
* If the path scrolls with the view, it will adjust its starting and
* ending positions by the amount scrolled by the view so that they
* remain fixed relative to the scrolled view. If it doesn't they will
* remain the same regardless of whether the view scrolls.
*/
public void setScrollsWithView (boolean scrollsWithView)
{
_scrollsWithView = scrollsWithView;
}
// documentation inherited from interface
public void viewWillScroll (int dx, int dy)
{
// adjust our source and destination points
_source.translate(-dx, -dy);
_dest.translate(-dx, -dy);
// adjust our source and dest points if we're tracking the view
if (_scrollsWithView) {
_source.translate(-dx, -dy);
_dest.translate(-dx, -dy);
}
}
// documentation inherited
@@ -139,4 +153,9 @@ public class LinePath implements Path
/** The duration that we're to spend following the path. */
protected long _duration;
/** Whether or not we scroll along with the view (which we accomplish
* by scrolling our start and end positions when the view scrolls) or
* if we should leave our coordinates alone. */
protected boolean _scrollsWithView = true;
}