Skip to content

Commit

Permalink
prefix events with br_
Browse files Browse the repository at this point in the history
  • Loading branch information
jgsmith committed Sep 21, 2011
1 parent 6b4ae14 commit 31a9773
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions BookReader/Plugins/SinglePageView/SinglePageView.coffee
Expand Up @@ -21,6 +21,9 @@ class SinglePageViewPlugin

@viewContainer = $("<div class='single-page-view'></div>")

###
* leftPageEl and rightPageEl are provided for short-term dev use
###
leftPageEl = $("<div class='left-page'></div>")
rightPageEl = $("<div class='right-page'></div>")
@imageElement = $("<img />")
Expand All @@ -33,19 +36,22 @@ class SinglePageViewPlugin

@currentIndex = @bookReaderObject.getCurrentIndex()

@bookReaderObject.parentElement.bind 'indexUpdated', (data) =>
@bookReaderObject.parentElement.bind 'br_indexUpdated.SinglePageViewPlugin', (data) =>
@previousIndex = @currentIndex
@currentIndex = @bookReaderObject.getCurrentIndex()
@eventIndexUpdated()

@parentElement.bind 'left', () =>
@parentElement.bind 'br_left.SinglePageViewPlugin', () =>
if @currentIndex > 1
@bookReaderObject.jumpToIndex @currentIndex-1

parentElement.bind 'right', () =>
@parentElement.bind 'br_right.SinglePageViewPlugin', () =>
if @currentIndex < @bookReaderObject.getNumPages()
@bookReaderObject.jumpToIndex @currentIndex+1


###
* The following are for short-term dev use
###
leftPageEl.bind 'click', () =>
@parentElement.trigger 'left'

Expand Down

0 comments on commit 31a9773

Please sign in to comment.