From 9ba9fb6b09b4aac264608c076ef8cad733483fc4 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Wed, 6 Mar 2013 05:32:49 +0400 Subject: [PATCH] more work on image template pages... Signed-off-by: Alex A. Naanou --- editor.js | 5 +++-- index.html | 7 ++++--- layout.js | 24 ++++++++++++++++++++---- magazine-editor.css | 14 ++++++++++++++ magazine.css | 22 ++++++++++++++++++---- 5 files changed, 59 insertions(+), 13 deletions(-) diff --git a/editor.js b/editor.js index a9617ff..7db4e2e 100755 --- a/editor.js +++ b/editor.js @@ -220,8 +220,9 @@ function setupEditorToolbars(){ .click(function(){ // NOTE: this does the same thing as handleClick... togglePageView('on') - setCurrentPage(target) - setTransitionEasing(mag, 'cubic-bezier(0.33,0.66,0.66,1)') + // XXX for some reason this does not work... + setCurrentPage() + setTransitionEasing($('.magazien'), 'cubic-bezier(0.33,0.66,0.66,1)') }) // the toolbars... diff --git a/index.html b/index.html index bf2da32..877b2eb 100755 --- a/index.html +++ b/index.html @@ -204,6 +204,7 @@ $(document).ready(function(){ $('.viewer') .on('scrollCancelled', function(){ setCurrentPage() }) + .on('shortClick', handleCaption) .on('shortClick', handleClick) .on('longClick', handleLongClick) .on('swipeLeft', handleSwipeLeft) @@ -742,7 +743,7 @@ $(document).ready(function(){
- + @@ -752,7 +753,7 @@ $(document).ready(function(){
- + @@ -762,7 +763,7 @@ $(document).ready(function(){
- + diff --git a/layout.js b/layout.js index ac315e0..ace9087 100755 --- a/layout.js +++ b/layout.js @@ -72,10 +72,6 @@ var togglePageView = createCSSClassToggler( var toggleInlineEditorMode = createCSSClassToggler('.chrome', 'inline-editor-mode') -function toggleCaption(img){ - img.parent().find('.caption').toggleClass('hidden') -} - /************************************************** event handlers ***/ @@ -100,6 +96,26 @@ function handleClick(evt, data){ } } +// Click on caption... +function handleCaption(evt, data){ + elem = $(data.orig_event.target) + if(elem.is('.vertical-image-fit, .horizontal-image-fit') + || elem.parents('.vertical-image-fit, .horizontal-image-fit').length > 0){ + + // prevent doing anything in ribbon mode.. + if(togglePageView('?') == 'off'){ + return + } + + if(elem.hasClass('caption')){ + elem.toggleClass('hidden') + return + } + + elem.parents('.page').find('.caption').toggleClass('hidden') + } +} + // Long Click // - in full page, go to ribbon diff --git a/magazine-editor.css b/magazine-editor.css index 9b55470..8f8dca1 100755 --- a/magazine-editor.css +++ b/magazine-editor.css @@ -1,3 +1,7 @@ +/********************************************************************** +* +**********************************************************************/ + .current-page-indicator { display: none; position: absolute; @@ -188,3 +192,13 @@ } +/* allways show captions in editor's full page mode */ +.full-page-view-mode.editor .current.page.horizontal-image-fit .caption, +.full-page-view-mode.editor .current.page.vertical-image-fit .caption { + opacity: 0.8; + height: auto; +} + + + +/*********************************************************************/ diff --git a/magazine.css b/magazine.css index 7bd5b4a..6cdb644 100755 --- a/magazine.css +++ b/magazine.css @@ -787,6 +787,24 @@ div.page-number-text { overflow: hidden; } +/* XXX fin a universal way to do this... +.page.image-fit .content { + display: table-cell; + vertical-align: middle; + width: auto; + min-width: 400px; + max-width: 800px; +} +.page.image-fit .content img { + height: auto; + max-height: 100%; + width: auto; + max-width: 100%; + + cursor: hand; +} +*/ + .page.vertical-image-fit .content { width: auto; } @@ -804,10 +822,6 @@ div.page-number-text { cursor: hand; } -.page.horizontal-image-fit .caption, -.page.vertical-image-fit .caption { -} - /*********************************************************************/