Add a preview mode to the slide app
This commit is contained in:
@@ -41,12 +41,20 @@ define([
|
||||
var updateFontSize = Slide.updateFontSize = function() {
|
||||
// 20vh
|
||||
// 20 * 16 / 9vw
|
||||
if ($(window).width() > 16/9*$(window).height()) {
|
||||
$content.css('font-size', '20vh');
|
||||
var wbase = 20;
|
||||
var vh = 20;
|
||||
var $elem = $(window);
|
||||
if (!Slide.shown) {
|
||||
wbase = 10;
|
||||
vh *= $content.height()/$(window).height();
|
||||
$elem = $content;
|
||||
}
|
||||
if ($elem.width() > 16/9*$elem.height()) {
|
||||
$content.css('font-size', vh+'vh');
|
||||
// $print.css('font-size', '20vh');
|
||||
return;
|
||||
}
|
||||
$content.css('font-size', (20*9/16)+'vw');
|
||||
$content.css('font-size', (wbase*9/16)+'vw');
|
||||
// $print.css('font-size', (20*9/16)+'vw');
|
||||
};
|
||||
|
||||
@@ -86,7 +94,8 @@ define([
|
||||
}
|
||||
//$content.find('.' + slideClass).hide();
|
||||
//$content.find('.' + slideClass + ':eq( ' + i + ' )').show();
|
||||
$content.css('margin-left', -(i*100)+'vw');
|
||||
//$content.css('margin-left', -(i*100)+'vw');
|
||||
$content.find('.slide-container').first().css('margin-left', -(i*100)+'%');
|
||||
updateFontSize();
|
||||
change(Slide.lastIndex, Slide.index);
|
||||
};
|
||||
@@ -134,7 +143,9 @@ define([
|
||||
};
|
||||
|
||||
Slide.update = function (content, init) {
|
||||
if (!Slide.shown && !init) { return; }
|
||||
console.log(content, init);
|
||||
updateFontSize();
|
||||
//if (!init) { return; }
|
||||
if (!content) { content = ''; }
|
||||
var old = Slide.content;
|
||||
Slide.content = content.replace(/\n\s*\-\-\-\s*\n/g, '\n\n'+separator+'\n\n');
|
||||
@@ -198,13 +209,15 @@ define([
|
||||
$modal.trigger(ev);
|
||||
});
|
||||
$modal.find('#button_right').click(function () {
|
||||
console.log('right');
|
||||
var ev = $.Event("keyup");
|
||||
ev.which = 39;
|
||||
$modal.trigger(ev);
|
||||
});
|
||||
|
||||
$pad.contents().find('.CodeMirror').keyup(function (e) { e.stopPropagation(); });
|
||||
$(ifrw).on('keyup', function (e) {
|
||||
if (!Slide.shown) { return; }
|
||||
//if (!Slide.shown) { return; }
|
||||
if (e.ctrlKey) { return; }
|
||||
switch(e.which) {
|
||||
case 33: // pageup
|
||||
|
||||
Reference in New Issue
Block a user