From 863af05b72a22245a8c6415ebc5a7eeeadae61ce Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Thu, 15 May 2003 18:24:01 +0000 Subject: [PATCH] Allow derived classes to dictate whether or not we allow traversal of tiles that are offscreen. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2576 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../miso/client/MisoScenePanel.java | 29 +++++++++++++------ 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/src/java/com/threerings/miso/client/MisoScenePanel.java b/src/java/com/threerings/miso/client/MisoScenePanel.java index b8cd3ab3a..a8f690038 100644 --- a/src/java/com/threerings/miso/client/MisoScenePanel.java +++ b/src/java/com/threerings/miso/client/MisoScenePanel.java @@ -1,5 +1,5 @@ // -// $Id: MisoScenePanel.java,v 1.28 2003/05/12 02:03:31 mdb Exp $ +// $Id: MisoScenePanel.java,v 1.29 2003/05/15 18:24:01 mdb Exp $ package com.threerings.miso.client; @@ -511,20 +511,31 @@ public class MisoScenePanel extends VirtualMediaPanel // documentation inherited public boolean canTraverse (Object traverser, int tx, int ty) { - // if the tile is not on-screen, no traversy - MisoUtil.tileToScreen(_metrics, tx, ty, _tcoords); - _trect.setLocation(_tcoords); - _trect.width = _metrics.tilewid; - _trect.height = _metrics.tilehei; - if (!_vbounds.intersects(_trect)) { - return false; + // if the tile is not on-screen, we may want to refuse traversal + if (!allowOffScreenTraversal()) { + MisoUtil.tileToScreen(_metrics, tx, ty, _tcoords); + _trect.setLocation(_tcoords); + _trect.width = _metrics.tilewid; + _trect.height = _metrics.tilehei; + if (!_vbounds.intersects(_trect)) { + return false; + } } - // if it is on screen, check the tile traversability + // otherwise, check the tile traversability SceneBlock block = getBlock(tx, ty); return (block == null) ? false : block.canTraverse(traverser, tx, ty); } + /** + * Derived classes can control whether or not we allow paths to be + * computed that take the client off-screen. + */ + protected boolean allowOffScreenTraversal () + { + return true; + } + // documentation inherited from interface public Rectangle getViewBounds () {