Skip to content

Crash when wrapping items to try the package. #24

Closed
1 of 1 issue completed
Closed
1 of 1 issue completed
@matthewkrom

Description

@matthewkrom

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

Sub-issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions