Giter Site home page Giter Site logo

mikalv / m5multitouchsupport Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mhuusko5/m5multitouchsupport

0.0 2.0 0.0 482 KB

[Maintained] [macOS] Easily and (thread/memory) safely consume global macOS multitouch (trackpad, Magic Mouse) events.

License: MIT License

C 7.44% Objective-C 87.02% Ruby 5.54%

m5multitouchsupport's Introduction

M5MultitouchSupport

Easily and (thread/memory) safely consume global OS X multitouch (trackpad, Magic Mouse) events.

Installation

From CocoaPods

CocoaPods is a dependency manager for Objective-C, which automates and simplifies the process of using 3rd-party libraries like M5MultitouchSupport in your projects. Simply add the following line to your Podfile:

pod 'M5MultitouchSupport'

If you want to use the latest features of M5MultitouchSupport add :head:

pod 'M5MultitouchSupport', :head

This pulls from the master branch directly, which is almost always usually stable.

Manually

Note: Requires ARC, and Mac OS 10.8+

Using Framework

  • Open the M5MultitouchSupport/M5MultitouchSupport.xcodeproj project, and build the default target.
  • Add the resulting Products/M5MultitouchSupport.framework to your project.
  • Add /System/Library/PrivateFrameworks/MultitouchSupport.framework to your project.

Using Source Files

  • Drag the M5MultitouchSupport/M5MultitouchSupport folder into your project.
  • Add /System/Library/PrivateFrameworks/MultitouchSupport.framework to your project.

Usage

Using M5MultitouchSupport in your app or framework is as simple as...

#import <M5MultitouchSupport.h>

Using Blocks

[M5MultitouchManager.sharedManager addListenerWithCallback:^(M5MultitouchEvent *event) {
  NSLog(event.description);
  
  /*
  Touches: (
    "ID: 3, State: 4 (Touching), Position: [0.251363, 0.475246], Velocity: [0.009912, -0.003619], Minor Axis: 8.160000, Major Axis: 9.920000, Angle: 1.911052, Size: 0.750000",
    "ID: 6, State: 4 (Touching), Position: [0.618595, 0.839751], Velocity: [-0.007434, -0.014476], Minor Axis: 8.230000, Major Axis: 9.220000, Angle: 1.570796, Size: 0.625000",
    "ID: 8, State: 4 (Touching), Position: [0.410051, 0.792415], Velocity: [0.008673, 0.018095], Minor Axis: 7.660000, Major Axis: 8.890000, Angle: 1.570796, Size: 0.628906"
  ), Device ID: 25381376, Frame ID: 1435, Timestamp: 3827.383000
  */
}];

Note: Multitouch event processing happens on a separate thread, but your listener will be passed events on the thread it was created (or the main thread if the original thread ever stops).

Using Targets/Selectors

[M5MultitouchManager.sharedManager addListenerWithTarget:self 
                                                selector:@selector(handleMultitouchEvent:)];
- (void)handleMultitouchEvent:(M5MultitouchEvent *)event {
    NSLog(event.description);
}

Note: Only a weak reference is held to the target, and M5MultitouchManager will safely remove the listener if that reference zeroes out.

Managing Listeners

M5MultitouchListener *listener = [M5MultitouchManager.sharedManager addListenerWith...

listener.listening = NO; 
//Listener will stop receiving events until set to YES

[M5MultitouchManager.sharedManager removeListener:listener]; 
//Will stop/remove the listener altogether

Contributing to this project

If you have feature requests or bug reports, feel free to help out by sending pull requests or by creating new issues.

Credits

M5MultitouchSupport is brought to you by Mathew Huusko V and contributors to the project. If you're using M5MultitouchSupport in your project, attribution would be very appreciated.

m5multitouchsupport's People

Contributors

mhuusko5 avatar

Watchers

 avatar  avatar

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.