Added code to ensure that the scene view is not scrolled outside the

bounds described by the view model.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1508 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2002-06-20 07:50:33 +00:00
parent fd05e9cdbc
commit ea31232166
@@ -1,5 +1,5 @@
//
// $Id: SceneViewPanel.java,v 1.41 2002/06/18 22:38:12 mdb Exp $
// $Id: SceneViewPanel.java,v 1.42 2002/06/20 07:50:33 mdb Exp $
package com.threerings.miso.scene;
@@ -140,6 +140,21 @@ public class SceneViewPanel extends VirtualMediaPanel
// ", nx: " + _nx + ", ny: " + _ny + ".");
}
// 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; }
super.setViewLocation(x, y);
}
// documentation inherited
protected void paintBetween (Graphics2D gfx, Rectangle dirty)
{