feathersui / feathersui-starling

User interface components for Starling Framework and Adobe AIR
https://feathersui.com/learn/as3-starling/
Other
915 stars 386 forks source link

LayoutGroupListItemRenderer with backgroundSkin that has filter does not render correctly #1745

Open mshaffer12882 opened 6 years ago

mshaffer12882 commented 6 years ago

A itemRenderer with a backgroundSkin that has a filter will only show while scrolling. I made a simple test to replicate it. Thanks for the help!

@see: https://forum.starling-framework.org/topic/list-dropshadow?replies=3#post-114690

listWithDropShadow.zip

joshtynjala commented 6 years ago

For my future reference, the following code will reproduce this issue:

var list:List = new List();
list.setSize(200, 200);
list.dataProvider = new ArrayCollection(
[
    { label: "One" },
    { label: "Two" },
    { label: "Three" },
    { label: "Four" },
    { label: "Five" },
    { label: "Six" },
    { label: "Seven" },
    { label: "Eight" },
]);
list.itemRendererFactory = function():IListItemRenderer
{
    return new CustomItemRenderer();
};
var layout:VerticalLayout = new VerticalLayout();
layout.horizontalAlign = HorizontalAlign.JUSTIFY;
layout.padding = 10;
layout.gap = 20;
list.layout = layout;
this.addChild(list);
import feathers.controls.renderers.LayoutGroupListItemRenderer;
import feathers.controls.Label;
import starling.display.Quad;
import starling.filters.DropShadowFilter;

class CustomItemRenderer extends LayoutGroupListItemRenderer
{
    public function CustomItemRenderer()
    {
        this.label = new Label();
        this.addChild(this.label);

        var backgroundSkin:Quad = new Quad(1, 1, 0x000000);
        backgroundSkin.filter = new DropShadowFilter();
        this.backgroundSkin = backgroundSkin;
    }

    protected var label:Label;

    override protected function commitData():void
    {
        if(this.data)
        {
            this.label.text = this.data.label;
        }
        else
        {
            this.label.text = null;
        }
    }
}
joshtynjala commented 6 years ago

@mshaffer12882 Is it possible to add your filter to the item renderer instead of its background?

mshaffer12882 commented 6 years ago

Yes that works.

Thanks Josh