Giter Club home page Giter Club logo

Comments (3)

OdNairy avatar OdNairy commented on July 23, 2024

For a comparison, on the iPad I see the following event when do release a single finger in two-finger gesture:

<UITouchesEvent: 0x28231e970> timestamp: 7343.81 touches: {(
    <UITouch: 0x10571a400> phase: Ended tap count: 0 force: 0.000 window: <UIWindow: 0x104009c20; frame = (0 0; 1024 768); gestureRecognizers = <NSArray: 0x281671ec0>; layer = <UIWindowLayer: 0x281671d10>> responder: (null) ,
    <UITouch: 0x105624910> phase: Stationary tap count: 1 force: 0.000 window: <UIWindow: 0x104009c20; frame = (0 0; 1024 768); gestureRecognizers = <NSArray: 0x281671ec0>; layer = <UIWindowLayer: 0x281671d10>> responder: (null) 
)}

With the Hammer simulation:

<UITouchesEvent: 0x60000331a490> timestamp: 178538 touches: {(
    <UITouch: 0x1288461a0> phase: Ended tap count: 0 force: 0.000 window: <MBXFingerTipWindow: 0x11fe07840; baseClass = UIWindow; frame = (0 0; 1133 744); gestureRecognizers = <NSArray: 0x60000066a6d0>; layer = <UIWindowLayer: 0x60000066a520>> responder: (null) ,
    <UITouch: 0x128838560> phase: Ended tap count: 0 force: 0.000 window: <MBXFingerTipWindow: 0x11fe07840; baseClass = UIWindow; frame = (0 0; 1133 744); gestureRecognizers = <NSArray: 0x60000066a6d0>; layer = <UIWindowLayer: 0x60000066a520>> responder: <MTKView: 0x12981e400; frame = (0 0; 1133 744); layer = <CAMetalLayer: 0x600000666e80>> location in window: {200, 400} previous location in window: {200, 400} location in view: {200, 400} previous location in view: {200, 400}
)}

It seems that Hammer have to simulate still active touches with stationary phase and not to ignore them.

from hammer.

OdNairy avatar OdNairy commented on July 23, 2024

My early investigation results represents that sending only .stationary phased touches in the fingerUp method is the correct way to fix the issue and preserve existing functionality.
POC implementation:

    public func fingerUp(_ indices: [FingerIndex?] = .automatic) throws {
        let indices = try self.fillExistingFingerIndices(indices, withMinimum: 1)
        let endingFingers = self.activeTouches.fingers.map { finger in
            return FingerInfo(fingerIndex: finger.fingerIndex,
                              location: finger.location,
                              phase: indices.contains(finger.fingerIndex) ?  .ended : .stationary,
                              pressure: 0, twist: 0, majorRadius: kDefaultRadius, minorRadius: kDefaultRadius)
        }

        try self.sendEvent(hand: HandInfo(fingers: endingFingers.filter({ $0.phase == .stationary })))
    }

from hammer.

OdNairy avatar OdNairy commented on July 23, 2024

From the production-ready implementation it would be a challenge to correctly remove ended touches as we do report only the stationary one so no downstream code for cleanup would be called.

from hammer.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.