feathersui-starling icon indicating copy to clipboard operation
feathersui-starling copied to clipboard

LayoutGroupListItemRenderer with backgroundSkin that has filter does not render correctly

Open mshaffer12882 opened this issue 7 years ago • 3 comments

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

mshaffer12882 avatar Jul 17 '18 06:07 mshaffer12882

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 avatar Jul 17 '18 15:07 joshtynjala

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

joshtynjala avatar Jul 17 '18 15:07 joshtynjala

Yes that works.

Thanks Josh

mshaffer12882 avatar Jul 17 '18 16:07 mshaffer12882