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

Feature: enabling continuous button press #7

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

shaolin405mi16
Copy link
Contributor

Hi, this patch includes one bugfix (when returning negative value), and also a huge feature addition.

This enables "autorepeat" feature: numbers continuously up/down while pressing increment/decrement buttons. So you don't have to click/tap up/down buttons number of times anymore, in order to increase/decrease numbers plenty. To accomplish this, I changed the way negative sign and current value(s) are displayed (from ng-bind to direct DOM manipulation).

Also, since touchscreen devices (such as smartphones and tablets) cannot handle mousedown and mouseup events, I added ng-touchstart and ng-touchend directives. If you add ngTouch ( https://github.com/nglar/ngTouch ) module, autorepeat feature will be enabled on touchscreen devices as well. Without ngTouch module, these directives are simply ignored.

Hope you'll like this.

@shaolin405mi16
Copy link
Contributor Author

further commits to make usable both on PC browsers and touchscreen devices. Introduced useNgTouch option (defaults to false). Probably nice as: useNgTouch: ionic.Platform.isWebView() ? true : false.

  • if useNgTouch is set to false, mouseup / mousedown events are detected.
    • on PC browsers: auto-repeat is enabled
    • on touchscreen devices: auto-repeat is disabled
  • if useNgTouch is set to true AND ngTouch module installed, touchstart / touchend events are detected.
    • on PC browsers: don't increment/decrement at all (sigh)
    • on touchscreen devices: auto-repeat is enabled

Also, introduced a 600ms delay before autorepeat for better usability.

@mikepc
Copy link

mikepc commented Jul 21, 2016

Is this going to get merged to master?

@shaolin405mi16
Copy link
Contributor Author

@mikepc For the time being, use my forked master instead. Will get this pull request without a conflict later.

@mdridley
Copy link
Contributor

Just needs to be cleaned up and I can merge.

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

Successfully merging this pull request may close these issues.

3 participants