From 368cd940b6e33fae6ce2da55aa3fc45e98a0a7c8 Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Mon, 2 Jun 2003 18:57:15 +0000 Subject: [PATCH] Make all of our object radial menus the same size; having them scale to the size of the object is not at all useful. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2630 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../miso/client/MisoScenePanel.java | 33 ++++++++++++++----- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/src/java/com/threerings/miso/client/MisoScenePanel.java b/src/java/com/threerings/miso/client/MisoScenePanel.java index ab9f3dffe..dc807881b 100644 --- a/src/java/com/threerings/miso/client/MisoScenePanel.java +++ b/src/java/com/threerings/miso/client/MisoScenePanel.java @@ -1,5 +1,5 @@ // -// $Id: MisoScenePanel.java,v 1.41 2003/05/31 00:56:38 mdb Exp $ +// $Id: MisoScenePanel.java,v 1.42 2003/06/02 18:57:15 mdb Exp $ package com.threerings.miso.client; @@ -384,16 +384,16 @@ public class MisoScenePanel extends VirtualMediaPanel return; } - // make the menu surround the clicked object, but don't go crazy - // if the object is huge + // make the menu surround the clicked object, but with consistent size Rectangle mbounds = new Rectangle(scobj.bounds); - if (mbounds.width > 100) { - mbounds.x += (mbounds.width-100)/2; - mbounds.width = 100; + Dimension radbox = getObjectRadialSize(); + if (mbounds.width != radbox.width) { + mbounds.x += (mbounds.width-radbox.width)/2; + mbounds.width = radbox.width; } - if (mbounds.height > 100) { - mbounds.y += (mbounds.height-100)/2; - mbounds.height = 100; + if (mbounds.height != radbox.height) { + mbounds.y += (mbounds.height-radbox.height)/2; + mbounds.height = radbox.height; } _activeMenu = menu; @@ -405,6 +405,17 @@ public class MisoScenePanel extends VirtualMediaPanel _activeMenu.activate(this, mbounds, scobj); } + /** + * Returns the size of the rectangle around which we create an + * object's radial menu. The default is a sensible size, but derived + * classes may wish to tune the value to make their menus lay out in a + * more aestetically pleasing manner. + */ + protected Dimension getObjectRadialSize () + { + return DEF_RADIAL_RECT; + } + /** * Called when an object or object menu item has been clicked. */ @@ -1616,4 +1627,8 @@ public class MisoScenePanel extends VirtualMediaPanel /** The alpha used to fill tiles for debugging purposes. */ protected static final Composite ALPHA_FILL_TILE = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.5f); + + /** The default size of the "box" that defines the size of our radial + * menu circles. */ + protected static final Dimension DEF_RADIAL_RECT = new Dimension(80, 80); }