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

Few issues with Touch events #104

Closed
ystrot opened this issue Mar 1, 2017 · 0 comments
Closed

Few issues with Touch events #104

ystrot opened this issue Mar 1, 2017 · 0 comments
Assignees
Milestone

Comments

@ystrot
Copy link
Member

ystrot commented Mar 1, 2017

For some reason touch events don't work from the first time. And after animation they don't work at all. Here is full example:

class MorphingView: MacawView {

    required init?(coder aDecoder: NSCoder) {
        super.init(node: MorphingView.newScene(), coder: aDecoder)
    }

    class func newScene() -> Node {
        let stroke = Stroke(width: 15.0, cap: .round)
        let contents1 = [
            Shape(form: Line(x1: 90.0, y1: 110.0, x2: 210.0, y2: 110.0), stroke: stroke),
            Shape(form: Line(x1: 90.0, y1: 150.0, x2: 210.0, y2: 150.0), stroke: stroke),
            Shape(form: Line(x1: 90.0, y1: 190.0, x2: 210.0, y2: 190.0), stroke: stroke),
        ]

        let contents2 = [
            Shape(form: Line(x1: 110.0, y1: 150.0, x2: 135.0, y2: 125.0), stroke: stroke),
            Shape(form: Line(x1: 110.0, y1: 150.0, x2: 190.0, y2: 150.0), stroke: stroke),
            Shape(form: Line( x1: 110.0, y1: 150.0, x2: 135.0, y2: 175.0), stroke: stroke),
        ]

        var switched = false
        let group = contents1.group()
        group.onTouchPressed { e in
            group.contentsVar.animate(to: switched ? contents1 : contents2)
            switched = !switched
        }
        return group
    }
}
@ystrot ystrot added this to the 0.8.1 milestone Mar 1, 2017
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

2 participants