Texture icon indicating copy to clipboard operation
Texture copied to clipboard

How to get ASCellNode location on ASCollectionNode

Open abhigourking opened this issue 5 years ago • 2 comments

Need to find the X, Y position of ASCellNode on the ASCollectionNode. cellnode.frame always returning 0 for X and Y position.

The frameInWindow property does but it is only for the debugging purpose and can not be accessible in code. // This should only be called for debugging. It's not thread safe and it doesn't assert. // NOTE: Returns CGRectNull if the node isn't in a hierarchy. - (CGRect)_frameInWindow

collectionNode.convert(cellNode.bounds, from: cellNode) Crashing the app Could not find a common ancestor between node1: cellNode and node2: <ASCollectionNode

collectionNode.convert(cellNode.bounds, from: nil) Returning some negative value

Anybody please help me out to find a solution. My requirement is to get the ASCellNode's Frame in respect to ASCellectionNode ie The Y position of frame should increase or decrease while scrolling the colllection node in (vertical layout).

abhigourking avatar Jan 19 '21 19:01 abhigourking

I believe there is a bug in _ASCollectionViewCell.mm. Should be self.node.frame = self.frame;

image

@abhigourking what about your attempts to convert, probably it crashes because of another bug that I described here

beskaska avatar May 25 '21 21:05 beskaska

btw for now you can find the XY position of ASCellNode in ASCollectionNode with node.view.superview.superview.frame

beskaska avatar May 25 '21 22:05 beskaska