You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by codekarma <co...@gmail.com> on 2014/10/05 19:18:22 UTC

Implementing IViewport and setting content width & height

Hi All,

I have custom container that has Scroller as a child. TheScroller has an
another custom component as a viewport which implements IViewport (its not a
Group).

I'm trying to figure out at what point in the life cycle I need to calculate
contentHeight & contentWidth in order to prevent unnecessary invalidations.

Currently I'm calculating it in the viewport's setActualSize method. The
viewport's contentHeight is set to a custom value but the contentWidth is
equal to explicit or measured width, it doesn't really need to be
calculated. This is the reason I am doing it in setActualSize.

I think doing it in setActualSize causes multiple invalidation cycles
because setting the contentWidth/Height will trigger the scroller to
invalidate the display list.

If anyone knows more on this or have suggestions please let me know.

Thanks,
Purush



--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Implementing-IViewport-and-setting-content-width-height-tp8297.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: Implementing IViewport and setting content width & height

Posted by codekarma <co...@gmail.com>.
Got it and yes I did trace through and found just the scrollbars getting
updated in some (most?) cases.

I did have it measure already but I would have to re-compute during
updateDisplayList if the parent sets the actual width/height to something
different that's why I added to setActualSize. I guess I can optimize if
dimensions don't change during updateDisplayList. Just wanted to make sure
i'm not missing something obvious.

Thanks so much for the answer!



--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Implementing-IViewport-and-setting-content-width-height-tp8297p8322.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: Implementing IViewport and setting content width & height

Posted by Alex Harui <ah...@adobe.com>.
IMO, you want to set contentHeight as soon as you know what it will be.
Every time it changes it can cause invalidations, although some of them
are just to update the scrollbars.

If you look at RichEditableText, I think it actually computes the text
size in the measure phase.

-Alex

On 10/5/14, 10:18 AM, "codekarma" <co...@gmail.com> wrote:

>Hi All,
>
>I have custom container that has Scroller as a child. TheScroller has an
>another custom component as a viewport which implements IViewport (its
>not a
>Group).
>
>I'm trying to figure out at what point in the life cycle I need to
>calculate
>contentHeight & contentWidth in order to prevent unnecessary
>invalidations.
>
>Currently I'm calculating it in the viewport's setActualSize method. The
>viewport's contentHeight is set to a custom value but the contentWidth is
>equal to explicit or measured width, it doesn't really need to be
>calculated. This is the reason I am doing it in setActualSize.
>
>I think doing it in setActualSize causes multiple invalidation cycles
>because setting the contentWidth/Height will trigger the scroller to
>invalidate the display list.
>
>If anyone knows more on this or have suggestions please let me know.
>
>Thanks,
>Purush
>
>
>
>--
>View this message in context:
>http://apache-flex-users.2333346.n4.nabble.com/Implementing-IViewport-and-
>setting-content-width-height-tp8297.html
>Sent from the Apache Flex Users mailing list archive at Nabble.com.