From ea31232166670d9b0888585199fd1eebfaa0e34b Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Thu, 20 Jun 2002 07:50:33 +0000 Subject: [PATCH] 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 --- .../threerings/miso/client/SceneViewPanel.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/java/com/threerings/miso/client/SceneViewPanel.java b/src/java/com/threerings/miso/client/SceneViewPanel.java index f0337c1cf..3293c7b69 100644 --- a/src/java/com/threerings/miso/client/SceneViewPanel.java +++ b/src/java/com/threerings/miso/client/SceneViewPanel.java @@ -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) {