Make SubScene Resizable (RT-31377)

Pavel Safrata pavel.safrata at oracle.com
Tue Sep 17 01:15:49 PDT 2013


Hello,
we want to make SubScene resizable (reporting min/pref/max sizes 
according to its root) for it to behave nicely when placed in layout ( 
https://javafx-jira.kenai.com/browse/RT-31377 ). For the main driver of 
SubScene's existence - 2D overlays over 3D content - this makes perfect 
sense. However, there are use-cases where the fixed size is needed. 
Mainly, every SubScene with 3D content probably wants the fixed size as 
the content bounds are not really meaningful after the perspective 
projection. So, we need to support both resizable and non-resizable 
SubScene.

There are two basic options:

1. Follow the pattern used in layouts. As SubScene is not a layout class 
(doesn't inherit from Region), this would mean adding the six methods ( 
set{Min|Pref|Max}{Width|Height} ) and duplicating the Region's 
USE_COMPUTED_SIZE constant.

+ consistent with layouts
- duplicated API
- user needs six calls to make sure the SubScene has fixed size

2. Add an isResizable constructor argument, then just make the SubScene 
report root's min/pref/max sizes in the resizable case.

+ easy to use the SubScene in the fixed-size manner (and resizable, too)
+ small API change
- probably an unfamiliar pattern we don't have elsewhere (but, SubScene 
is a pretty unique node)

What do you think?

Thanks,
Pavel



More information about the openjfx-dev mailing list