GoogleCodeArchive / piccolo2d

Automatically exported from code.google.com/p/piccolo2d
0 stars 0 forks source link

Refactor PNode.moveToBack() and related #166

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I would like to rename & refactor the Z-order methods in PNode to the following

Methods that change the Z-order of this

void raise();
void lower();
void raiseToTop();
void lowerToBottom();

Methods that change the Z-order of a child node

void raise(PNode child)
void lower(PNode child)
void raiseToTop(PNode child)
void lowerToBottom(PNode child)

I find the current methods, as defined in terms of their parent, rather
awkwardly defined as evidenced by Issue 165.

These new method names are the action names used in Inkscape.

Original issue reported on code.google.com by heue...@gmail.com on 26 Feb 2010 at 5:57

GoogleCodeExporter commented 9 years ago
Unless you keep the existing methods doesn't moving a child to be immediately 
before
one of its siblings cumbersome?

Original comment by allain.lalonde on 26 Feb 2010 at 8:33

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r974.

Original comment by heue...@gmail.com on 26 Feb 2010 at 9:55

GoogleCodeExporter commented 9 years ago
False alarm, issue 165 was fixed by r974, not this one.

Original comment by heue...@gmail.com on 26 Feb 2010 at 10:01

GoogleCodeExporter commented 9 years ago
raiseToTop() == moveToFront()
lowerToBack() == moveToBack()

But I don't understand how the 4 raise and lower methods work -- raise and lower
relative to what? Perhaps this is a reason to keep the existing methods.  I 
also like
the fact that all of the existing method names start with "move", much easier to
remember.  So I'm not sold on this change.

Original comment by cmal...@pixelzoom.com on 27 Feb 2010 at 6:20

GoogleCodeExporter commented 9 years ago
Copying this comment from a thread on piccolo2d-dev@ to here

cmalley@pixelzoom.com wrote:

"I realize this is z-ordering.  But if this is supposed to replace the
existing z-ordering interface, then raise and lower would be replacing
moveToFrontOf(PNode) and moveInBackOf(PNode).  So, again, how does
raise and lower allow me to put one sibling in front/back of another
sibling?  Imho, this new interface proposal reduces the functionality
of the interface, and (as Allain noted previously) makes make changing
the z-order of siblings cumbersome, if not downright difficult."

Original comment by heue...@gmail.com on 9 Apr 2010 at 9:31

GoogleCodeExporter commented 9 years ago
Methods that change the Z-order of a peer node

void raiseAbove(PNode peer)
void lowerBelow(PNode peer)

?

Original comment by heue...@gmail.com on 9 Apr 2010 at 10:10

GoogleCodeExporter commented 9 years ago
My revised proposal is as follows:

Methods that change the Z-order of this

void raise();
void lower();
void raiseToTop();
void lowerToBottom();
void raiseAbove(PNode peer);
void lowerBelow(PNode peer);

Methods that change the Z-order of a child node

void raise(PNode child)
void lower(PNode child)
void raiseToTop(PNode child)
void lowerToBottom(PNode child)

Original comment by heue...@gmail.com on 1 Nov 2011 at 7:27

GoogleCodeExporter commented 9 years ago

Original comment by heue...@gmail.com on 26 Nov 2013 at 9:57

GoogleCodeExporter commented 9 years ago

Original comment by heue...@gmail.com on 26 Nov 2013 at 9:58

GoogleCodeExporter commented 9 years ago
$ svn commit -m "Issue 166 ; refactor PNode moveToBack and related" .
Sending        core/src/main/java/org/piccolo2d/PNode.java
Sending        core/src/main/java/org/piccolo2d/event/PDragEventHandler.java
Sending        core/src/test/java/org/piccolo2d/PNodeTest.java
Sending        core/src/test/java/org/piccolo2d/event/PDragEventHandlerTest.java
Sending        examples/src/main/java/org/piccolo2d/examples/GridExample.java
Sending        
examples/src/main/java/org/piccolo2d/tutorial/PiccoloPresentation.java
Transmitting file data ......
Committed revision 1227.

Original comment by heue...@gmail.com on 26 Nov 2013 at 10:55

GoogleCodeExporter commented 9 years ago
$ svn commit -m "Issue 166 ; mark PNode moveToFront and related as @deprecated" 
.
Sending        core/src/main/java/org/piccolo2d/PNode.java
Sending        core/src/main/java/org/piccolo2d/event/PDragEventHandler.java
Transmitting file data ..
Committed revision 1228.

Original comment by heue...@gmail.com on 26 Nov 2013 at 10:59

GoogleCodeExporter commented 9 years ago

Original comment by heue...@gmail.com on 26 Nov 2013 at 11:18