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
This commit is contained in:
@@ -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;
|
package com.threerings.miso.client;
|
||||||
|
|
||||||
@@ -511,20 +511,31 @@ public class MisoScenePanel extends VirtualMediaPanel
|
|||||||
// documentation inherited
|
// documentation inherited
|
||||||
public boolean canTraverse (Object traverser, int tx, int ty)
|
public boolean canTraverse (Object traverser, int tx, int ty)
|
||||||
{
|
{
|
||||||
// if the tile is not on-screen, no traversy
|
// if the tile is not on-screen, we may want to refuse traversal
|
||||||
MisoUtil.tileToScreen(_metrics, tx, ty, _tcoords);
|
if (!allowOffScreenTraversal()) {
|
||||||
_trect.setLocation(_tcoords);
|
MisoUtil.tileToScreen(_metrics, tx, ty, _tcoords);
|
||||||
_trect.width = _metrics.tilewid;
|
_trect.setLocation(_tcoords);
|
||||||
_trect.height = _metrics.tilehei;
|
_trect.width = _metrics.tilewid;
|
||||||
if (!_vbounds.intersects(_trect)) {
|
_trect.height = _metrics.tilehei;
|
||||||
return false;
|
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);
|
SceneBlock block = getBlock(tx, ty);
|
||||||
return (block == null) ? false : block.canTraverse(traverser, 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
|
// documentation inherited from interface
|
||||||
public Rectangle getViewBounds ()
|
public Rectangle getViewBounds ()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user