samreid / piccolo2d

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

Improve semantics for full bounds computation #162

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
There are currently inconsistencies with respect to how Piccolo computes
full bounds and manages emptiness of PBounds objects.  Many of these issues
were raised as part of issue 155 and issue 161, but have been moved here as
a separate feature request issue for discussion for inclusion in piccolo
2.0.  They should not be included in piccolo 1.3 because they entail a
change in functionality under some circumstances.

Here's a proposed behavior that I think is predominantly consistent with
the pre-r963 behavior, and that makes more sense to me.

1. Container PNodes (i.e. nodes that have children but do not define any
content themselves) should have PBounds[EMPTY] and not be taken into
consideration when computing FullBounds.
2. Content PNodes (i.e. PPath, PText or other nodes that define their own
content and may additionally have children) should never have
PBounds[EMPTY] and should always be taken into consideration when computing
FullBounds.  This means that PPath(Rectangle(0,0,0,0)) would have
PBounds(0,0,0,0) and would impact layout, even if it is not displayed on
the screen under any zoom parameters.  Similarly for PText(""), an empty
PImage etc.

This seems like it would provide reasonable and reliable behavior for
performing layouts.  This would also make the graphical output in
DebugFullBounds.java correct, and its readout of PBounds[EMPTY] for 0-width
0-height rectangles incorrect.  This behavior is also consistent with the
desired behavior reported in Issue 155.

If we agree that this is the best semantics for layout, then we will next
need to discuss the best way of implementing this behavior.

Some discussion was already taking place in issue 161; I'll start moving
the relevant portions to this ticket.

Original issue reported on code.google.com by reids%co...@gtempaccount.com on 9 Feb 2010 at 5:03

GoogleCodeExporter commented 9 years ago
Allain said [in comment 7 of issue 161]:

Regarding [the above proposal]... I'd be OK with that approach, but I think 
that it
ought to be 
the exception rather than the rule. Children classes who wish to abstain from 
full 
bounds computations should override the appropriate methods. Maybe even 
composite only.

Original comment by reids%co...@gtempaccount.com on 9 Feb 2010 at 5:07

GoogleCodeExporter commented 9 years ago
cmalley said (in comment 8 of issue 161):

So regarding [the above proposal]... I would need to think about it some more, 
and I
think the idea may need some refinement.

Original comment by reids%co...@gtempaccount.com on 9 Feb 2010 at 5:08

GoogleCodeExporter commented 9 years ago

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