mirror of
https://github.com/flynx/PortableMag.git
synced 2025-12-23 20:11:46 +00:00
now long-click in full view switches to ribbon and in ribbon centers a page, while short-click in full view either does the default dance or if clicked on a different page toggles that and in ribbon opens the clicked page in full view...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
9b926cfdc8
commit
aebfc2791d
@ -122,6 +122,7 @@ $(document).ready(function(){
|
|||||||
$('.viewer')
|
$('.viewer')
|
||||||
.on('scrollCancelled swipeUp swipeDown', function(){ setCurrentPage() })
|
.on('scrollCancelled swipeUp swipeDown', function(){ setCurrentPage() })
|
||||||
.on('shortClick', handleClick)
|
.on('shortClick', handleClick)
|
||||||
|
.on('longClick', handleLongClick)
|
||||||
.on('swipeLeft', handleSwipeLeft)
|
.on('swipeLeft', handleSwipeLeft)
|
||||||
.on('swipeRight', handleSwipeRight)
|
.on('swipeRight', handleSwipeRight)
|
||||||
.on('screenReleased', handleScrollRelease)
|
.on('screenReleased', handleScrollRelease)
|
||||||
|
|||||||
35
layout.js
35
layout.js
@ -61,15 +61,32 @@ var togglePageView = createCSSClassToggler(
|
|||||||
/************************************************** event handlers ***/
|
/************************************************** event handlers ***/
|
||||||
|
|
||||||
function handleClick(evt, data){
|
function handleClick(evt, data){
|
||||||
// get page target and select it if it's within a page...
|
var target = getPageNumber(data.orig_event.target)
|
||||||
var target = $(data.orig_event.target)
|
|
||||||
target = getPageNumber(
|
|
||||||
target.hasClass('page') ? target
|
|
||||||
: target.parents('.page'))
|
|
||||||
if(target != -1){
|
if(target != -1){
|
||||||
var mag = $('.magazine')
|
var mag = $('.magazine')
|
||||||
|
|
||||||
togglePageView()
|
if(togglePageView('?') == 'on'){
|
||||||
|
setTransitionDuration(mag, DEFAULT_TRANSITION_DURATION)
|
||||||
|
} else {
|
||||||
|
togglePageView('on')
|
||||||
|
}
|
||||||
|
setCurrentPage(target)
|
||||||
|
|
||||||
|
//setTransitionEasing(mag, 'ease')
|
||||||
|
setTransitionEasing(mag, 'cubic-bezier(0.33,0.66,0.66,1)')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleLongClick(evt, data){
|
||||||
|
var target = getPageNumber(data.orig_event.target)
|
||||||
|
if(target != -1){
|
||||||
|
var mag = $('.magazine')
|
||||||
|
|
||||||
|
if(togglePageView('?') == 'on'){
|
||||||
|
togglePageView('off')
|
||||||
|
} else {
|
||||||
|
setTransitionDuration(mag, DEFAULT_TRANSITION_DURATION)
|
||||||
|
}
|
||||||
setCurrentPage(target)
|
setCurrentPage(target)
|
||||||
|
|
||||||
//setTransitionEasing(mag, 'ease')
|
//setTransitionEasing(mag, 'ease')
|
||||||
@ -354,9 +371,13 @@ function getMagazineOffset(page, scale, align){
|
|||||||
|
|
||||||
|
|
||||||
function getPageNumber(page){
|
function getPageNumber(page){
|
||||||
|
page = $(page)
|
||||||
|
if(!page.hasClass('page')){
|
||||||
|
page = page.parents('.page')
|
||||||
|
}
|
||||||
// a page is given explicitly, get the next one...
|
// a page is given explicitly, get the next one...
|
||||||
if(page != null){
|
if(page != null){
|
||||||
return $('.page').index($(page))
|
return $('.page').index(page)
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the next page relative to the current...
|
// get the next page relative to the current...
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user