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
This commit is contained in:
@@ -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;
|
package com.threerings.media;
|
||||||
|
|
||||||
@@ -259,16 +259,16 @@ public class VirtualMediaPanel extends MediaPanel
|
|||||||
|
|
||||||
int width = getWidth(), height = getHeight();
|
int width = getWidth(), height = getHeight();
|
||||||
int nx = _vbounds.x, ny = _vbounds.y;
|
int nx = _vbounds.x, ny = _vbounds.y;
|
||||||
|
Rectangle bounds = _fpath.getBounds();
|
||||||
|
|
||||||
// figure out where to move
|
// figure out where to move
|
||||||
switch (_fmode) {
|
switch (_fmode) {
|
||||||
case CENTER_ON_PATHABLE:
|
case CENTER_ON_PATHABLE:
|
||||||
nx = _fpath.getX() - width/2;
|
nx = bounds.x + (bounds.width - width)/2;
|
||||||
ny = _fpath.getY() - height/2;
|
ny = bounds.y + (bounds.height - height)/2;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ENCLOSE_PATHABLE:
|
case ENCLOSE_PATHABLE:
|
||||||
Rectangle bounds = _fpath.getBounds();
|
|
||||||
if (nx > bounds.x) {
|
if (nx > bounds.x) {
|
||||||
nx = bounds.x;
|
nx = bounds.x;
|
||||||
} else if (nx + width < bounds.x + bounds.width) {
|
} else if (nx + width < bounds.x + bounds.width) {
|
||||||
|
|||||||
Reference in New Issue
Block a user