Closed GoogleCodeExporter closed 9 years ago
Sorry
I have to correct step 3.
3 Move the cursor over any handle on the selected node
Original comment by tbit455...@aol.com
on 20 Apr 2010 at 3:20
The selection example
(examples/src/main/java/edu/umd/cs/piccolo/examples/SelectionExample.java)
seems to
work fine for me with version 1.3 and svn trunk.
It uses PSelectionEventHandler to create the selection handles as follows
extras/src/main/java/edu/umd/cs/piccolox/event/PSelectionEventHandler.java:
public void decorateSelectedNode(final PNode node) {
PBoundsHandle.addBoundsHandlesTo(node);
}
Might you be able to attach an example that demonstrates the problem? Perhaps
you
are using PBoundsHandle through a different code path.
Original comment by heue...@gmail.com
on 20 Apr 2010 at 3:23
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;
}
}
Original comment by tbit455...@aol.com
on 20 Apr 2010 at 4:47
Forget about this issue. It was a fault in my application ;-)
Original comment by tbit455...@aol.com
on 7 May 2010 at 11:01
Original comment by allain.lalonde
on 7 May 2010 at 12:53
Original issue reported on code.google.com by
tbit455...@aol.com
on 20 Apr 2010 at 3:14