return $document->getPageSize($this->composition[$page][1]);
}
+ /**
+ * @param $page
+ * @return float
+ */
public function getPageWidth($page = 1)
{
- return $this->getDocumentSize($page)[0];
+ return (float)$this->getDocumentSize($page)[0];
}
+ /**
+ * @param $page
+ * @return float
+ */
public function getPageHeight($page = 1)
{
- return $this->getDocumentSize($page)[1];
+ return (float)$this->getDocumentSize($page)[1];
}
public function getFinalPath($theme = null, $version = 'online')
// Disable scroll by spacebar
$(window).on('keydown', function (e) {
if (e.keyCode == 32) {
- $("#linkeditor-main").addClass('grab');
+ if (!$this.mobileFirst) {
+ $("#linkeditor-main").addClass('grab');
+ }
return false;
} else if (e.keyCode == 18) {
$("#linkeditor-main").addClass('duplicate');
this.form.updateFormData();
},
+ getCurrentPageHeight: function () {
+ if (this.mobileFirst) {
+ return FLUIDBOOK_DATA.page_dimensions[this.currentPage][1];
+ }
+ return FLUIDBOOK_DATA.height;
+ },
+
fluidbookTo: function (dim, name, rect) {
switch (rect) {
case 'editor':
this.loader.loadPage(this.currentPage + 1, 'right');
}
$("#linkeditor-page-field input").val(this.currentPage);
+ this.resize.resize();
if (this.mobileFirst) {
this.zoom.reset();
}
- this.resize.resize();
this.loader.preloadPages();
},
loadPage: function (p, side) {
var container = $("#linkeditor-page-" + side);
$(container).attr('data-page', p);
+ if (this.linkeditor.mobileFirst) {
+ let h = FLUIDBOOK_DATA.page_dimensions[p][1];
+ $("#linkeditor-fluidbook").css('height', h);
+ $(container).css('height', h);
+ }
if (p === 0 || p > FLUIDBOOK_DATA.settings.pages) {
$(container).html('');
var $this = this;
$(window).on('resize', function () {
$this.resize();
+ setTimeout(function () {
+ $this.resize();
+ }, 100);
});
this.updateWindowDimensions();
},
this.linkeditor.editorRect = $("#linkeditor-editor").get(0).getBoundingClientRect();
var aw = this.linkeditor.canvasRect.width - 30;
var ah = this.linkeditor.canvasRect.height - 30;
- this.linkeditor.fs = Math.min(aw / this.linkeditor.fw, ah / this.linkeditor.fh);
+
+ if (this.linkeditor.mobileFirst) {
+ this.linkeditor.fs = 620 / this.linkeditor.fw;
+ } else {
+ this.linkeditor.fs = Math.min(aw / this.linkeditor.fw, ah / this.linkeditor.fh);
+ }
let left, top;
top = ((this.linkeditor.canvasRect.height * 2) - this.linkeditor.fh * this.linkeditor.fs) / 2;
} else {
left = (this.linkeditor.canvasRect.width - this.linkeditor.fw * this.linkeditor.fs) / 2;
- top = 100;
+ top = 75;
}
$("#linkeditor-fluidbook").css({left: left, top: top, transform: 'scale(' + this.linkeditor.fs + ')'});
},
normalizeZoom: function (z) {
+ if (this.linkeditor.mobileFirst) {
+ return 1;
+ }
return Math.max(0.5, Math.min(8, z));
},
setZoom: function (z, force) {
- if (!this.linkeditor.mobileFirst) {
- z = 1;
- }
let $this = this;
z = this.normalizeZoom(z);
let cw2, ch2, zh;
if (this.linkeditor.mobileFirst) {
cw2 = this.linkeditor.canvasRect.width;
- zh = parseFloat(FLUIDBOOK_DATA.pages_max_height) + 200;
+ zh = (this.linkeditor.getCurrentPageHeight() * this.linkeditor.fs) + 150;
+ console.log(zh);
} else {
cw2 = this.linkeditor.canvasRect.width * 2;
ch2 = this.linkeditor.canvasRect.height * 2;
maxHeight: zh
});
-
setTimeout(function () {
if (this.zoom === 1) {
$this.resetZoomDrag();
$fbdata['settings']['width']=$fbdata['width']=$fluidbook->getPageWidth();
$fbdata['settings']['height']=$fbdata['height']=$fluidbook->getPageHeight();
$fbdata['settings']['pages']=$fbdata['pages']=$fluidbook->getPagesNumber();
+ $fbdata['page_dimensions']=[];
$mh = 0;
for($i=1;$i<=$fbdata['pages'];$i++){
- $mh = max($mh, $fluidbook->getPageHeight($i));
+ $fbdata['page_dimensions'][$i]=[$fluidbook->getPageWidth($i),$fluidbook->getPageHeight($i)];
+ $mh = max($mh,$fbdata['page_dimensions'][$i][1]);
}
$fbdata['pages_max_height']=$mh;