Skip to content

Feature: enabling continuous button press#7

Open
shaolin405mi16 wants to merge 12 commits intomilkcan:masterfrom
shaolin405mi16:feature/continuous-button-press
Open

Feature: enabling continuous button press#7
shaolin405mi16 wants to merge 12 commits intomilkcan:masterfrom
shaolin405mi16:feature/continuous-button-press

Conversation

@shaolin405mi16
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown

mikepc commented Jul 21, 2016

Is this going to get merged to master?

@shaolin405mi16
Copy link
Copy Markdown
Contributor Author

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

@mdridley
Copy link
Copy Markdown
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