piccolo2d / piccolo2d.java

Structured 2D Graphics Framework
http://piccolo2d.org
Other
51 stars 14 forks source link

Improve semantics for full bounds computation #162

Closed mro closed 10 months ago

mro commented 9 years ago

Originally reported on Google Code with ID 162

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.

Reported by reids%colorado.edu@gtempaccount.com on 2010-02-09 17:03:40

mro 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.

Reported by reids%colorado.edu@gtempaccount.com on 2010-02-09 17:07:50

mro 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.

Reported by reids%colorado.edu@gtempaccount.com on 2010-02-09 17:08:43

mro commented 9 years ago

Reported by heuermh on 2013-11-26 21:11:15