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:
Felix Niklas 2015-01-13 02:19:45 +01:00
parent e2762d63b3
commit 83b4360c36

View file

@ -1262,7 +1262,7 @@ class ArticleView extends App.Controller
'click .show_toogle': 'show_toogle' 'click .show_toogle': 'show_toogle'
'click [data-type=reply]': 'reply' 'click [data-type=reply]': 'reply'
'click [data-type=replyAll]': 'replyAll' 'click [data-type=replyAll]': 'replyAll'
'click .text-bubble': 'toggle_meta' 'click .text-bubble': 'toggle_meta_with_delay'
'click .text-bubble a': 'stopPropagation' 'click .text-bubble a': 'stopPropagation'
constructor: -> constructor: ->
@ -1327,7 +1327,17 @@ class ArticleView extends App.Controller
stopPropagation: (e) -> stopPropagation: (e) ->
e.stopPropagation() 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() e.preventDefault()
animSpeed = 300 animSpeed = 300