From 0d79024b5cf6aabf856b8dbfc4f1b51adfc3c5a1 Mon Sep 17 00:00:00 2001 From: Ray Greenwell Date: Tue, 24 Jun 2003 02:24:54 +0000 Subject: [PATCH] When centering on a pathable, center on its center rather than its upper-left coordinate. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2677 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- src/java/com/threerings/media/VirtualMediaPanel.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/java/com/threerings/media/VirtualMediaPanel.java b/src/java/com/threerings/media/VirtualMediaPanel.java index bdac3fe84..7e38467b6 100644 --- a/src/java/com/threerings/media/VirtualMediaPanel.java +++ b/src/java/com/threerings/media/VirtualMediaPanel.java @@ -1,5 +1,5 @@ // -// $Id: VirtualMediaPanel.java,v 1.20 2003/05/08 16:10:50 mdb Exp $ +// $Id: VirtualMediaPanel.java,v 1.21 2003/06/24 02:24:54 ray Exp $ package com.threerings.media; @@ -259,16 +259,16 @@ public class VirtualMediaPanel extends MediaPanel int width = getWidth(), height = getHeight(); int nx = _vbounds.x, ny = _vbounds.y; + Rectangle bounds = _fpath.getBounds(); // figure out where to move switch (_fmode) { case CENTER_ON_PATHABLE: - nx = _fpath.getX() - width/2; - ny = _fpath.getY() - height/2; + nx = bounds.x + (bounds.width - width)/2; + ny = bounds.y + (bounds.height - height)/2; break; case ENCLOSE_PATHABLE: - Rectangle bounds = _fpath.getBounds(); if (nx > bounds.x) { nx = bounds.x; } else if (nx + width < bounds.x + bounds.width) {