add a delay to article meta toggle
to allow double click select its 150ms - maybe we need more. plz test. but the fewer delay we need the better cause it'll feel snappier.
This commit is contained in:
parent
e2762d63b3
commit
83b4360c36
1 changed files with 12 additions and 2 deletions
|
@ -1262,7 +1262,7 @@ class ArticleView extends App.Controller
|
|||
'click .show_toogle': 'show_toogle'
|
||||
'click [data-type=reply]': 'reply'
|
||||
'click [data-type=replyAll]': 'replyAll'
|
||||
'click .text-bubble': 'toggle_meta'
|
||||
'click .text-bubble': 'toggle_meta_with_delay'
|
||||
'click .text-bubble a': 'stopPropagation'
|
||||
|
||||
constructor: ->
|
||||
|
@ -1327,7 +1327,17 @@ class ArticleView extends App.Controller
|
|||
stopPropagation: (e) ->
|
||||
e.stopPropagation()
|
||||
|
||||
toggle_meta: (e) ->
|
||||
toggle_meta_with_delay: (e) =>
|
||||
# allow double click select
|
||||
# by adding a delay to the toggle
|
||||
|
||||
if @lastClick and +new Date - @lastClick < 150
|
||||
clearTimeout(@toggleMetaTimeout)
|
||||
else
|
||||
@toggleMetaTimeout = setTimeout(@toggle_meta, 150, e)
|
||||
@lastClick = +new Date
|
||||
|
||||
toggle_meta: (e) =>
|
||||
e.preventDefault()
|
||||
|
||||
animSpeed = 300
|
||||
|
|
Loading…
Reference in a new issue