loadLinks: function (page, side) {
let $this = this;
+ this.normalizeLinksPage();
$.each(LINKS, function (uid, link) {
if ($('#linkeditor-links [fb-uid="' + uid + '"]').length > 0) {
return;
}
- link.left = parseFloat(link.left)
- if (!$this.linkeditor.single) {
- if (page % 2 === 1 && link.page % 2 === 0 && link.left > $this.linkeditor.pw) {
- link.page++;
- link.left -= $this.linkeditor.pw;
- }
- if (side === 'right' && link.page % 2 === 1) {
- link.page--;
- link.left += $this.linkeditor.pw;
- }
- }
-
if (link.page != page) {
return;
}
- console.log(link);
$this.addLink(link, false);
});
this.updateLayers();
this.linkeditor.undo.initState();
},
+ normalizeLinksPage() {
+ let pw = this.linkeditor.pw;
+ let single = this.linkeditor.single;
+ $.each(LINKS, function (uid, link) {
+ link.left = parseFloat(link.left)
+ if (!single) {
+ if (link.page % 2 === 0 && link.left > pw) {
+ link.page++;
+ link.left -= pw;
+ }
+ if (link.page % 2 === 1) {
+ link.page--;
+ link.left += pw;
+ }
+ }
+ LINKS[uid] = link;
+ });
+ },
+
addLink: function (link, triggerChange) {
if (triggerChange === undefined) {