Only bound our view's coordinates if the view model is configured for a
bounded view. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1522 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: IsoSceneViewModel.java,v 1.25 2002/06/17 18:01:47 shaper Exp $
|
||||
// $Id: IsoSceneViewModel.java,v 1.26 2002/06/21 00:04:41 mdb Exp $
|
||||
|
||||
package com.threerings.miso.scene;
|
||||
|
||||
@@ -37,6 +37,10 @@ public class IsoSceneViewModel
|
||||
/** Size of the view in tile count. */
|
||||
public int scenevwid, scenevhei;
|
||||
|
||||
/** Whether or not this view can extend beyond the bounds defined by
|
||||
* the view width and height. True if it cannot, false if it can. */
|
||||
public boolean bounded = true;
|
||||
|
||||
/** The bounds of the view in screen pixel coordinates. */
|
||||
public Rectangle bounds;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: SceneViewPanel.java,v 1.42 2002/06/20 07:50:33 mdb Exp $
|
||||
// $Id: SceneViewPanel.java,v 1.43 2002/06/21 00:04:41 mdb Exp $
|
||||
|
||||
package com.threerings.miso.scene;
|
||||
|
||||
@@ -143,15 +143,16 @@ public class SceneViewPanel extends VirtualMediaPanel
|
||||
// documentation inherited
|
||||
public void setViewLocation (int x, int y)
|
||||
{
|
||||
// make sure no one tries to set our view location outside the
|
||||
// bounds defined by the view model
|
||||
int minx = _viewmodel.bounds.x,
|
||||
maxx = _viewmodel.bounds.width-getWidth();
|
||||
int miny = _viewmodel.bounds.y,
|
||||
maxy = _viewmodel.bounds.height-getHeight();
|
||||
if (x < minx) { x = minx; } else if (x > maxx) { x = maxx; }
|
||||
if (y < miny) { y = miny; } else if (y > maxy) { y = maxy; }
|
||||
|
||||
// if we're bounded, make sure no one tries to set our view
|
||||
// location outside the bounds defined by the view model
|
||||
if (_viewmodel.bounded) {
|
||||
int minx = _viewmodel.bounds.x,
|
||||
maxx = _viewmodel.bounds.width-getWidth();
|
||||
int miny = _viewmodel.bounds.y,
|
||||
maxy = _viewmodel.bounds.height-getHeight();
|
||||
if (x < minx) { x = minx; } else if (x > maxx) { x = maxx; }
|
||||
if (y < miny) { y = miny; } else if (y > maxy) { y = maxy; }
|
||||
}
|
||||
super.setViewLocation(x, y);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user