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

Drag from outside the JT3DScrollView frame #9

Open
andrewzboard opened this issue Jul 6, 2018 · 0 comments
Open

Drag from outside the JT3DScrollView frame #9

andrewzboard opened this issue Jul 6, 2018 · 0 comments

Comments

@andrewzboard
Copy link

andrewzboard commented Jul 6, 2018

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.

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