rui-cruz / Spark-Material

Flex spark based components and skins with Material design by google
Other
26 stars 7 forks source link

TextArea: Replace two Skins by one to implement "enableScrolling" feature #17

Closed olafkrueger closed 7 years ago

olafkrueger commented 9 years ago

Hi Rui, I've spend hours trying to solve this issue with no success :-( I've tried to achive this by using deffered skin parts, but it seems for me that this doesn't work.

The first idea that occurs me, is on updateDisplayList(unscaledWidth:Number,unscaledHeight:Number), assign the skin.scroller or skin.scroller.viewport width/height.. that should

Could you explain this a bit more?

Thanks, Olaf

rui-cruz commented 9 years ago

Sure,

By default the scroller is part of the skin, and only shows scroll. So, basically what we can do is to set the component scroller height to the textHeight and then the scroller never shows. One way to do this is on method updateDisplayList(unscaledWidth:Number,unscaledHeight:Number) on the TextArea.

rui-cruz commented 9 years ago

Hi @ok-at-github ,

I've been thinking about this feature, and I'm starting to think that this is not a feature but instead a layout design decision.. Meaning.. If you don't set the textArea height, then it should grow with content (text height), otherwise it should respect the height of the textArea and show the scroll.

What you think?

rui-cruz commented 9 years ago

Hi @ok-at-github

I've created a new branch TextArea with changes e22fd5fe24ecc59dd9d24300aaeee3ae6408514f regarding my last reply. Please take a look and try to see if it could be one way to go.

Regards

olafkrueger commented 9 years ago

Hi @rui-cruz rui-cruz,

If you don't set the textArea height, then it should grow with content (text height), otherwise it should respect the height of the textArea and show the scroll.

That's a good idea!

Please take a look and try to see if it could be one way to go.

I've done a quick review on it and just test it quickly but in my environment setting the height of the component has no effect... ?

I'll try it again later!

Olaf

rui-cruz commented 9 years ago

I think its something to do with the same issue that I've comment

Known issue: If maxHeight is set on parent of the TextArea (in this case the FormItem), the viewPort of the scroll is not activated. To-do: check on RichEditableText if the override is messing with other funcionalities.

I've commited now a291848ec9392682b2eb06866b175df469c9df47 and works with maxHeight set directly on TextArea

rui-cruz commented 9 years ago

I've made some tests, and I figured out that the height problem is caused by the form, that maxHeight on a FormItem is ignored. I've created a group outside with maxHeight and scroll shows up as espected.

<s:Group maxHeight="150" width="400">
    <components:TextArea prompt="Some Text" width="100%" height="100%"/>    
</s:Group>

So, in conclusion, if you want to show scroll on TextArea inside a FormItem, you need to set the maxHeight directly on the component, otherwise will grow up indefinitely.

olafkrueger commented 9 years ago

Works perfectly, very nice! I've just add a liitle improvement. Please take a look at it: fc4f69f

olafkrueger commented 7 years ago

The main issue "Replace two Skins by one" is resolved with the TextArea branch.