Skip to content

Drag from outside the JT3DScrollView frame #9

@andrewzboard

Description

@andrewzboard

The first thing I wanted to do with this View was drag on one of the images that was outside the View's frame. (The JT3DScrollView has clipsToBounds set to false, so the previous and next — and maybe others — show outside the View proper.)

The way to do this is to embed the JT3DScrollView in another view. Make the enclosing view a custom subclass of UIView and add this and only this method:

 override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
    if self.point(inside: point, with: nil) {
        return subviews.first
    } else {
        return super.hitTest(point, with: event)
    }
}

Now drags in the enclosing view will be passed to the enclosed JT3DScrollView. Have fun! And thanks JT for such a clean implementation.

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