From d7a41e61d80dd92c58c15ff2008f1b7aba2b1201 Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Wed, 12 Jun 2002 00:49:15 +0000 Subject: [PATCH] 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 --- .../com/threerings/media/util/LinePath.java | 27 ++++++++++++++++--- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/src/java/com/threerings/media/util/LinePath.java b/src/java/com/threerings/media/util/LinePath.java index 46d4f5834..0d6c89d8e 100644 --- a/src/java/com/threerings/media/util/LinePath.java +++ b/src/java/com/threerings/media/util/LinePath.java @@ -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; }