From 0489315a40a6832af702bda741985ca5d2b9ae27 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Wed, 8 Mar 2017 21:26:37 +0300 Subject: [PATCH] now brows wrap around stops repeat... Signed-off-by: Alex A. Naanou --- ui (gen4)/lib/widget/browse.js | 19 ++++++++++++++++--- ui (gen4)/lib/widget/widget.js | 12 ++++++++---- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/ui (gen4)/lib/widget/browse.js b/ui (gen4)/lib/widget/browse.js index 76c2cd47..aa2d8385 100755 --- a/ui (gen4)/lib/widget/browse.js +++ b/ui (gen4)/lib/widget/browse.js @@ -1493,6 +1493,8 @@ var BrowserPrototype = { // first make(..) is called, but obviously this should be // as short as possible -- under 20-50ms. holdSize: 20, + + keyboardRepeatPause: 100, }, // XXX need a way to access buttons... @@ -3115,9 +3117,17 @@ var BrowserPrototype = { var all = this.filter('*') //var to = this.select('!', filtering)[action+'All'](pattern).first() var to = all.eq(all.index(this.select('!', filtering)) + (action == 'next' ? 1 : -1)) + + // stop keyboard repeat... + to.length == 1 + && this.options.keyboardRepeatPause > 0 + && this.keyboard.pauseRepeat + && this.keyboard.pauseRepeat() + // range check and overflow... if(to.length == 0){ action = action == 'next' ? 'first' : 'last' + } else { return this.select(to, filtering) } @@ -3142,14 +3152,17 @@ var BrowserPrototype = { : $(all.slice(0, all.index(from)).toArray().reverse())) .filter(function(_, e){ return $(e).offset().top != t }) + // stop keyboard repeat... + to.length == 1 + && this.options.keyboardRepeatPause > 0 + && this.keyboard.pauseRepeat + && this.keyboard.pauseRepeat() + // special case: nothing below -> select wrap | last/first... if(to.length == 0){ // select first/last... //return this.navigate(action == 'down' ? 'last' : 'first') - // XXX stop keyboard repeat... - // XXX - // wrap around.... to = this.filter('*').filter(pattern) diff --git a/ui (gen4)/lib/widget/widget.js b/ui (gen4)/lib/widget/widget.js index e807edaf..4ac82e87 100755 --- a/ui (gen4)/lib/widget/widget.js +++ b/ui (gen4)/lib/widget/widget.js @@ -62,6 +62,8 @@ var WidgetPrototype = { client: null, options: { + keyboardRepeatPause: 100, + nonPropagatedEvents: [ 'start', @@ -152,10 +154,11 @@ var WidgetPrototype = { function(){ return that.dom }) this.dom .keydown( - keyboard.makeKeyboardHandler( + keyboard.makePausableKeyboardHandler( this.keyboard, options.logKeys, - this)) + this, + function(){ return this.options.keyboardRepeatPause })) } if(this.options.nonPropagatedEvents != null){ @@ -233,10 +236,11 @@ var ContainerPrototype = { function(){ return that.dom }) this.dom .keydown( - keyboard.makeKeyboardHandler( + keyboard.makePausableKeyboardHandler( this.keyboard, options.logKeys, - this)) + this, + function(){ return this.options.keyboardRepeatPause })) } if(this.options.nonPropagatedEvents != null){