this.changePage(this.fluidbook.currentPage);
},
+ areLinksSetFromEditor: function () {
+ return this.fluidbook.settings.links.tabs !== undefined && this.fluidbook.settings.links.tabs.normal !== undefined;
+ },
+
addLinks: function (pages) {
+ if (this.areLinksSetFromEditor()) {
+ return;
+ }
this.links = [];
+
var $this = this;
var sections = [];
-
if (this.hasSections()) {
$.each(this.sections, function (id, limit) {
var sectionPages = [];
}
});
}
- console.log(page, id);
-
if (id === 'none') {
this.svg.find('[id^="o"].active').removeClass('active');
} else {
createLinks: function () {
var $this = this;
+ if (this.areLinksSetFromEditor()) {
+ this.createLinksFromEditor();
+ return;
+ }
+
var commoncss = {};
commoncss.width = (100 * (this.linkWidth / this.naturalDimensions.width)) + "%";
commoncss.left = (-100 * (this.margin / this.naturalDimensions.width)) + "%";
});
},
+ createLinksFromEditor: function () {
+ let $this = this;
+ const dims = ['left', 'top', 'width', 'height'];
+ $.each(this.fluidbook.settings.links.tabs.normal, function (k, link) {
+ var l = $(link);
+ $this.cont.append(l);
+ $.each(dims, function (k, dim) {
+ let v = parseFloat($(l).css(dim));
+ let div = $this.naturalDimensions.height;
+ if (dim === 'left' || dim === 'width') {
+ div = $this.naturalDimensions.width;
+ }
+ $(l).css(dim, (100 * (v / div) + '%'));
+ });
+ const a = $(l).find('a');
+ let href = a.attr('href');
+ href = href.replace(/^#\/page\/o(\d+)$/, function (match, tab, offset, string) {
+ return '#/page/' + $this.getTabPageNumber(tab);
+ });
+ $(a).attr('href', href);
+ $(l).addClass('tablink');
+ });
+ },
+
initStandardEvents: function () {
var $this = this;
console.log(css);
this.cont.css(css);
},
+
+ getTabPageNumber: function (tab) {
+ return this.fluidbook.settings.tabsPages[tab - 1];
+ },
};