Comment #3 on issue 176 by tbit455...@aol.com: PBoundsHandle does not change cursor and installs action when mouse moves over
http://code.google.com/p/piccolo2d/issues/detail?id=176

I use a customized PSelectionHandler that overwrites decorateSelectedNode; maybe
this is the problem? See code below:

/**
 * A selection event handler. The first selected node is the 'master' node.
* Selected nodes are decorated by handles. The master node handles are marked * by using the DEFAULT_MASTER_COLOR color. All other selected node handles are * marked by using the DEFAULT_SLAVE_COLOR. If only one node is selected it is
 * automatically the 'master' node.
 *
 * @author Tom
 */
public class MyPSelectionEventHandler extends PSelectionEventHandler {
    private static final Logger logger = Logger.getLogger
("MyPSelectionEventHandler");
    /**
     * The color used by handles to mark the 'master' node.
     */
    public static final Color DEFAULT_MASTER_COLOR = Color.red;
    /**
     * The color used by handles to mark all other nodes then the 'master'.
     */
    public static final Color DEFAULT_SLAVE_COLOR = Color.green;

    private Color masterColor = DEFAULT_MASTER_COLOR;
    private Color slaveColor = DEFAULT_SLAVE_COLOR;

    {
        PHandle.DEFAULT_HANDLE_SIZE = 3.0f;
    }

    private PNode master = null;

    /**
     * Creates a new instance of MyPSelectionEventHandler
     * @param marqueeParent
     * @param selectableParent
     */
public MyPSelectionEventHandler(PNode marqueeParent, PNode selectableParent) {
        super(marqueeParent, selectableParent);
    }

    /**
     * Creates a new instance of MyPSelectionEventHandler
     * @param marqueeParent
     * @param selectableParents
     */
public MyPSelectionEventHandler(PNode marqueeParent, List selectableParents) {
        super(marqueeParent, selectableParents);
    }

    /**
     *
     * @param node
     */
    @Override
    public void decorateSelectedNode(final PNode node) {
        // Decorate the first node as master node in masterColor
        if (getSelection().size() == 1) {
            PHandle.DEFAULT_COLOR = masterColor;
            master = node;
        }
        else {
            PHandle.DEFAULT_COLOR = slaveColor;
        }

        PHandle.DEFAULT_HANDLE_SHAPE = new Rectangle2D.Float(0f, 0f,
PHandle.DEFAULT_HANDLE_SIZE, PHandle.DEFAULT_HANDLE_SIZE);
        PInnerBoundsHandle.addBoundsHandlesTo(node);
    }

    /**
     *
     * @param node
     */
    @Override
    public void undecorateSelectedNode(PNode node) {
        super.undecorateSelectedNode(node);
        if (node == master) {
            master = null;
        }
    }

    /**
     * Get the currently selected 'master' node.
     * @return the master node
     */
    public PNode getMaster() {
        logger.finer("MASTER=" + master);
        return master;
    }

    public Color getMasterColor() {
        return masterColor;
    }

    public void setMasterColor(final Color col) {
        masterColor = col;
    }

    public Color getSlaveColor() {
        return slaveColor;
    }

    public void setSlaveColor(Color slaveColor) {
        this.slaveColor = slaveColor;
    }
}


--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

--
Piccolo2D Developers Group: http://groups.google.com/group/piccolo2d-dev?hl=en

Reply via email to