Skip to content

Commit

Permalink
no swipe while in detailmode
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcljx committed May 3, 2013
1 parent 0c1a2a2 commit b1b3dcf
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 2 additions & 0 deletions assets/js/script.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ class ViewModel extends ko.ViewModel
@property "swiping", false
@property "viewportWidth", document.width

@accessor "isSwipeable", -> not @detailedSubject()

@property "detailedSubject", null
@property "selectedSubject", null

Expand Down
8 changes: 5 additions & 3 deletions assets/js/touch.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,12 @@ $ ->
true

beginDrag = (e) ->
$(e.target).addClass("dragHover")
chain = $(e.target).parents().andSelf()
chain.filter(".draggable").addClass "dragHover"

dragIntent = new DragIntent e
dragIntent.isMaybeDrag = $(e.target).parents().andSelf().is(".draggable")
dragIntent.isMaybeDrag = chain.is(".draggable")
dragIntent.isMaybeSwipe = chain.is(".swipeable")

if BEAM_BY_LONGPRESS
dragIntent.timeout = setTimeout _beginDrag, 250
Expand All @@ -62,7 +64,7 @@ $ ->
if dragIntent.isMaybeTap and dragIntent.isMaybeDrag and dx > 0
dragIntent.detected = "drag"
_beginDrag()
else
else if dragIntent.isMaybeSwipe
dragIntent.detected = "swipe"
dragIntent.isMaybeTap = dragIntent.isMaybeDrag = false
$(".pages").removeClass('animated')
Expand Down
2 changes: 1 addition & 1 deletion views/index.jade
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ extends layout
block body
a.left-edge(data-bind="visible: hasPrevious, click: onPrevious")
a.right-edge(data-bind="visible: hasNext, click: onNext")
.pages.animated(data-bind="left: left, css: { editing: detailedSubject }")
.pages.animated(data-bind="left: left, css: { editing: detailedSubject, swipeable: isSwipeable }")
#subject-page.page
h1 Beam...
.page-content(data-bind="foreach: groupedSubjects")
Expand Down

0 comments on commit b1b3dcf

Please sign in to comment.