Status: New
Owner: ----

New issue 155 by jxb147: If width or height is zero, the rest of bounds are reset.

What steps will reproduce the problem?

1. Here is some code to reproduce the issue:

                PNode testNode3 = new PNode();
                testNode3.setBounds(10, 10, 10, 0);
                System.out.println("Bounds for plain PNode = " +

What is the expected output? What do you see instead?

I would expect that the bounds would be reported as 10, 10, 10, 0, but
instead they are reported as being empty.

What version of the product are you using? On what operating system?

We are using version 1.2.1, but we have inspected the source code and the
issue still appears to exist in trunk, r922.  OS is Windows XP.

Please provide any additional information below.

The reason that this is an issue for us is that in some cases we are
laying out graphs with a number of PNodes whose positions depend on each
other.  Setting the bounds to have only a width or height is necessary in
some cases where the node (such as a textual label) has no value in some
contexts, yet we still want to do a layout based on its position.
However, the x and y values of the bounds are reset if the width or height
are 0, so such a layout fails.  It is possible to work around this by
detecting an empty bounds and using another PNode for the layout
reference, but it makes the code much more complex.

We have no idea if other portions of the Piccolo library depend on the
current behavior of resetting the bounds when length or height are 0.

John Blanco
PhET Project
University of Colorado

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:
Piccolo2D Developers Group:

Reply via email to