AsyncDisplayKit icon indicating copy to clipboard operation
AsyncDisplayKit copied to clipboard

[ASLayoutSpec] ASStackLayoutJustifyContentSpaceBetween flooring causing issues

Open tomizimobile opened this issue 10 years ago • 3 comments

I have a ASStackLayoutSpec that contains nine views stacked with .SpaceBetween. The flooring in the following line causes enough extra spacing to make the views not perfectly aligned: return stackedLayout(style, 0, floorf(violation / numOfSpacings), fmodf(violation, numOfSpacings), unpositionedLayout, constrainedSize); In my specific case at least, it seems to lay out perfectly like this: return stackedLayout(style, 0, violation / numOfSpacings, 0, unpositionedLayout, constrainedSize);

Is this something that should be changed, or maybe a new ASStackLayoutJustifyContent case made for?

tomizimobile avatar Mar 07 '16 22:03 tomizimobile

@maicki - could you make a call on fix / won't fix please?

hannahmbanana avatar Nov 15 '16 05:11 hannahmbanana

@hannahmbanana Would be great to have a sample project to reproduce the issue. cc @tomizimobile

maicki avatar Nov 15 '16 05:11 maicki

Here's a sample project that shows this off. I quickly trimmed out and converted the view I had this issue with, which was using a much older version of ASDK, and jammed it in another project I've used to debug ASDK issues, so excuse the mess ;)

After running the project, just hit the "Show table" button and play with the cell. It's a slider that locks at time intervals, and you'll see that the thumb image in the slider is off-center compared to the stack of views above it (and gets worse as you slide right). Changing the line of code as suggested in my first post lines things up nicely.

The code for that cell with the control is in TimeNode.swift

ASDK-crash.zip

tomizimobile avatar Nov 15 '16 14:11 tomizimobile