Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when wrapping items to try the package. #24

Open
matthewkrom opened this issue Jan 17, 2025 · 0 comments
Open

Crash when wrapping items to try the package. #24

matthewkrom opened this issue Jan 17, 2025 · 0 comments

Comments

@matthewkrom
Copy link

Interesting library! On my first attempt, wrapping three GroupBoxes that dynamically appear on model load, I saw

Thread 1: Fatal error: view origin is invalid: (407.25, nan), UnitPoint(x: 0.0, y: 0.0), (297.5, inf)

Apologies, I may not spend a lot of time debugging this, but I hope this stack trace and error report might be useful.

Image

Text version, with ** starred line:

    private func alignAndPlace(
        _ item: Line.Element,
        in line: Lines.Element,
        at target: Size
    ) {
        var position = target
        let lineDepth = line.size.depth
        let size = Size(breadth: item.size.breadth, depth: lineDepth)
        let proposedSize = ProposedViewSize(size: size, axis: axis)
        let itemDepth = item.size.depth
        if itemDepth > 0 {
            let dimensions = item.item.subview.dimensions(proposedSize)
            let alignedPosition = alignmentOnDepth(dimensions)
            position.depth += (alignedPosition / itemDepth) * (lineDepth - itemDepth)
        }
        let point = CGPoint(size: position, axis: axis)
**        item.item.subview.place(at: point, anchor: .topLeading, proposal: proposedSize)
    }

Stack trace:

Image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant