Skip to content
This repository has been archived by the owner on Jan 21, 2021. It is now read-only.

Commit

Permalink
Added contextmenu event.
Browse files Browse the repository at this point in the history
  • Loading branch information
Morten Bo Rønsholdt committed Oct 30, 2017
1 parent 2f39efe commit 4539346
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 3 deletions.
9 changes: 8 additions & 1 deletion dist/verso.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion kitchensink/example1.html
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
var verso = new Verso(document.querySelector('.verso'));
var events = [
'beforeNavigation', 'afterNavigation', 'attemptedNavigation',
'clicked', 'doubleClicked', 'pressed',
'clicked', 'doubleClicked', 'pressed', 'contextmenu',
'zoomedIn', 'zoomedOut',
'panStart', 'panEnd'
];
Expand Down
9 changes: 9 additions & 0 deletions lib/coffeescript/verso.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ class Verso
@hammer.on 'pinchcancel', @pinchEnd.bind @
@hammer.on 'press', @press.bind @

@scrollerEl.addEventListener 'contextmenu', @contextmenu.bind @

return

start: ->
Expand Down Expand Up @@ -474,6 +476,13 @@ class Verso

return

contextmenu: (e) ->
e.preventDefault()

@trigger 'contextmenu', @getCoordinateInfo(e.clientX, e.clientY, @getActivePageSpread())

false

singletap: (e) ->
activePageSpread = @getActivePageSpread()
coordinateInfo = @getCoordinateInfo e.center.x, e.center.y, activePageSpread
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "verso-browser",
"version": "1.0.6",
"version": "1.0.7",
"description": "A multi-paged viewer for browsers.",
"main": "dist/verso.js",
"watch": {
Expand Down

0 comments on commit 4539346

Please sign in to comment.