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

Using itemRenderer.setSkinForState in listView causes hit area to be reduced to only the text

Open ConfidantCommunications opened this issue 6 months ago • 6 comments

My problem may be simpler than what I outline here, but here goes. I have a DisplayObjectRecycler on my listView. When I use the following code, the items in the listView are clickable on their entire area.

var recycler = DisplayObjectRecycler.withFunction(() -> {
	var itemRenderer = new ItemRenderer();
	itemRenderer.textFormat = makeTf(Regular,Body,RtaBlack,LEFT);
	itemRenderer.wordWrap = true;

	var skin = new RectangleSkin();
	skin.fill = SolidColor(cast(RtaLightGrey));
	skin.width = 100;
	skin.height = 30;
	skin.selectedFill = SolidColor(cast(RtaBlue));

	skin.setFillForState(ToggleButtonState.HOVER(false), SolidColor(cast(RtaBlue)));
	skin.setFillForState(ToggleButtonState.HOVER(true), SolidColor(cast(RtaBlue)));
	skin.setBorderForState(ToggleButtonState.HOVER(false), SolidColor(1.0, cast(RtaGrey)));
	skin.setBorderForState(ToggleButtonState.HOVER(true), SolidColor(1.0, cast(RtaGrey)));
	
	itemRenderer.backgroundSkin = skin;

	itemRenderer.setTextFormatForState(ToggleButtonState.HOVER(false), makeTf(SemiBold,Body,RtaWhite,LEFT));

	return itemRenderer;
});
listView.itemRendererRecycler = recycler;

If I eliminate the "setFillForState" and "setBorderForState" lines above (4 total) and use setSkinForState instead (as shown below), then only the text on the listView items is clickable.


	// var skinHover = new RectangleSkin();
	// skinHover.border = SolidColor(1.0, cast(RtaGrey));
	// skinHover.fill = SolidColor(cast(RtaBlue));
	// skinHover.width = 100;
	// skinHover.height = 30;
	// skinHover.selectedFill = SolidColor(cast(RtaBlue));

	// problem: setting the skin in the following way results in only the text being clickable:
	// itemRenderer.setSkinForState(ToggleButtonState.HOVER(true), skinHover);
	// itemRenderer.setSkinForState(ToggleButtonState.HOVER(false), skinHover);

I am currently on FeathersUI 1.2.0 so apologies if this has been fixed already.

ConfidantCommunications avatar May 05 '25 20:05 ConfidantCommunications