Make SubScene Resizable (RT-31377)

Kevin Rushforth kevin.rushforth at oracle.com
Wed Sep 18 04:41:47 PDT 2013


Btw, making ImageView and MediaView resizable is filed as 
https://javafx-jira.kenai.com/browse/RT-10610

-- Kevin


John Hendrikx wrote:
> +1 on the ImageView case... getting ImageViews to resize properly, 
> like a Button or other node would, is tricky and often gives 
> unexpected results or doesn't behave the same in all cases.  A custom 
> Wrapper class mitigates the problem somewhat, but I can't help 
> thinking, why isn't there a proper resizable Image node that I can 
> dump in any layout I want?
>
> On 17/09/2013 16:59, Richard Bair wrote:
>> Personally I wish that it were possible to use pattern #2 with 
>> Rectangle, ImageView, and a bunch of others as well. Anything that 
>> *could* be resizable should have an option to be resizable. Heck, I 
>> wish it were possible to turn resizable on/off dynamically for 
>> SubScene or the others, not just an immutable property.
>>
>> But an immutable property with a constructor to set it is a good 
>> first step (especially since we don't have time in this release to do 
>> anything more comprehensive or radical).
>>
>> Richard
>>
>> On Sep 17, 2013, at 1:15 AM, Pavel Safrata<pavel.safrata at oracle.com>  
>> wrote:
>>
>>> 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