2 fingers pinch gestures and thresholds for gestures#32
Closed
osleg wants to merge 9 commits intoCoffee2CodeNL:masterfrom
Closed
2 fingers pinch gestures and thresholds for gestures#32osleg wants to merge 9 commits intoCoffee2CodeNL:masterfrom
osleg wants to merge 9 commits intoCoffee2CodeNL:masterfrom
Conversation
Basic implementation enables one shot pinch gesture. That is the command from config file will run only once as soon as fingers move 50% from the initial fingers position. - Added a configurable distance variable to pinch gesture. I felt that pinch gesture is kinda tricky to execute on touchpad, so I changed a way of calculation when to trigger the command and added the distance for fingers travel to configuration. Basically a `0.5` distance feels quite ok to me, but it becomes really snappy at `0.1`.
Pinch Gesture
* Reorganized code a little bit
- Previously swipe gesture was triggered only when fingers leaving
touchpad thus threshold was useless. Moved trigger function outside
of event handling.
- Created reset functions for gestures to reset struct holding event
data to default values.
* Added swipe threshold.
- Added new config keys
* `settings.pinch.distance` - now instead of
`pinch.commands.distance` holds the value required for fingers to
travel before executing pinch gesture.
* `settings.swipe.threshold` - new key to set how long should be
swipe to execute command.
This commit introduces breaking changes due to changes in config file
format. Hopefully that's the last time.
* Config keys changed format, see readme for examples.
* Both swipe and pinch gestures now have `settings.threshold` key which can be
values 0.0 - 1.0.
Defaults:
Swipe: 1.0
Pinch: 0.25
* Both swipe and pinch now have `settings.one_shot` which, if set,
allows only one execution of command per gesture.
Defaults:
Swipe: true
Pinch: false
* Swipe gesture now has `settings.trigger_on_release` defaulting to
false. If set to true the command for swipe will be triggered when
fingers are moved from touchpad UNLESS it is also one_shot gesture and
gesture was already triggered.
Removed fork info
Collaborator
|
Can you elaborate on what you mean with continuous pinch and swipe gestures? |
Collaborator
Author
|
one time gesture is getting triggered once as soon as the swipe or pinch threshold is reached. For example pinch in gesture executing |
Owner
|
@osleg wanna merge this back into this repo? :) |
Collaborator
Author
|
Sure, do you want the entire fork? |
Owner
|
That'd be great, if you want I could add you as collaborator to this repo? :) |
Owner
|
@osleg ? |
Collaborator
Author
|
@Coffee2CodeNL sorry took me some time ^_^ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This commit introduces breaking changes due to changes in config file
format.
Added swipe threshold.
Added a configurable treshold variable to pinch gesture.
I felt that pinch gesture is kinda tricky to execute on touchpad,
so I changed a way of calculation when to trigger the command and
added the distance for fingers travel to configuration.
Basically a
0.5distance feels quite ok to me, but it becomes reallysnappy at
0.1.Reorganized code a little bit
touchpad thus threshold was useless. Moved trigger function outside
of event handling.
data to default values.
Config keys changed format, see readme for examples.
Both swipe and pinch gestures now have
settings.thresholdkey which can bevalues 0.0 - 1.0.
Defaults:
Swipe: 1.0
Pinch: 0.25
Both swipe and pinch now have
settings.one_shotwhich, if set,allows only one execution of command per gesture.
Defaults:
Swipe: true
Pinch: false
Swipe gesture now has
settings.trigger_on_releasedefaulting tofalse. If set to true the command for swipe will be triggered when
fingers are moved from touchpad UNLESS it is also one_shot gesture and
gesture was already triggered.