Skip to content

Commit

Permalink
Ignore dragEnd coordinate when it differs too much from last drag event
Browse files Browse the repository at this point in the history
Ref #265
  • Loading branch information
Thibaut committed Nov 21, 2015
1 parent de1c879 commit c2a20ef
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions assets/javascripts/views/layout/resizer.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,15 @@ class app.views.Resizer extends app.View

onDrag: (event) =>
return if @lastDrag and @lastDrag > Date.now() - 50
value = event.pageX
@lastDrag = Date.now()
@resize(event.pageX, false)
@lastDragValue = value
@resize(value, false)
return

onDragEnd: (event) =>
@resize(event.pageX or (event.screenX - window.screenX), true)
value = event.pageX or (event.screenX - window.screenX)
if @lastDragValue and not (@lastDragValue - 5 < value < @lastDragValue + 5) # https://github.com/Thibaut/devdocs/issues/265
value = @lastDragValue
@resize(value, true)
return

0 comments on commit c2a20ef

Please sign in to comment.