zimjs 17.0.2 → 17.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/zim.js +33 -21
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zimjs",
3
- "version": "17.0.2",
3
+ "version": "17.0.3",
4
4
  "type": "module",
5
5
  "main": "./src/zim.js",
6
6
  "types": "./ts-src/typings/zim",
package/src/zim.js CHANGED
@@ -74936,46 +74936,45 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
74936
74936
  that.setMask(that.backing);
74937
74937
  peel.addTo(that);
74938
74938
  peel.c().f(zim.black).dr(0,0,0,0);
74939
- that.moving = false;
74939
+ that.moving = false;
74940
74940
 
74941
74941
  // backwards
74942
74942
  if (pages[num-1]) {
74943
- leftPage = pages[num-1].reg(0,0).rot(0).loc(0,0,that);
74943
+ leftPage = pages[num-1].reg(0,0).rot(0).loc(0,0,that).setMask(null);
74944
74944
  } else if (num > 0) {
74945
74945
  lastPage.reg(0,0).rot(0).loc(0,0,that).setMask(null);
74946
74946
  }
74947
74947
 
74948
74948
  if (pages[num-2]) {
74949
- pageFore = pages[num-2].reg(width/2,height).loc(0,height,that).rot(-90);
74949
+ pageFore = pages[num-2].reg(width/2,height).loc(0,height,that).rot(-90).setMask(null);
74950
74950
  } else {
74951
- pageFore = new zim.Rectangle(width/2,height,backgroundColor).reg(width/2,height).loc(0,height,that).rot(-90);
74951
+ pageFore = new zim.Rectangle(width/2,height,backgroundColor).reg(width/2,height).loc(0,height,that).rot(-90).setMask(null);
74952
74952
  }
74953
74953
  if (pages[num-3]) {
74954
- pagePrev = pages[num-3].rot(0).loc(0,0,that).setMask(peel);
74954
+ pagePrev = pages[num-3].reg(0,0).rot(0).loc(0,0,that).setMask(peel);
74955
74955
  } else {
74956
- pagePrev = new zim.Rectangle(width/2,height,backgroundColor).loc(0,0,that).setMask(peel);
74956
+ pagePrev = new zim.Rectangle(width/2,height,backgroundColor).reg(0,0).rot(0).loc(0,0,that).setMask(peel);
74957
74957
  }
74958
74958
 
74959
74959
  // forewards
74960
74960
  if (pages[num]) {
74961
- rightPage = pages[num].rot(0).reg(0,0).pos(0,0,zim.RIGHT,zim.TOP,that);
74961
+ rightPage = pages[num].rot(0).reg(0,0).pos(0,0,zim.RIGHT,zim.TOP,that).setMask(null);
74962
74962
  } else {
74963
74963
  // need to make a first or last page here
74964
74964
  stage.update();
74965
74965
  return;
74966
74966
  }
74967
74967
  if (pages[num+1]) {
74968
- pageBack = that.backNext = pages[num+1].reg(0,height).loc(width,height,that).rot(90);
74968
+ pageBack = that.backNext = pages[num+1].reg(0,height).loc(width,height,that).rot(90).setMask(null);
74969
74969
  } else {
74970
- pageBack = that.backNext = new zim.Rectangle(width/2,height,backgroundColor).reg(0,height).loc(width,height,that).rot(90);
74970
+ pageBack = that.backNext = new zim.Rectangle(width/2,height,backgroundColor).reg(0,height).loc(width,height,that).rot(90).setMask(null);
74971
74971
  lastPage = pageBack;
74972
74972
  }
74973
74973
  if (pages[num+2]) {
74974
- pageNext = that.backPrev = pages[num+2].rot(0).pos(0,0,zim.RIGHT,zim.TOP,that).setMask(peel);
74974
+ pageNext = that.backPrev = pages[num+2].reg(0,0).rot(0).pos(0,0,zim.RIGHT,zim.TOP,that).setMask(peel);
74975
74975
  } else {
74976
- pageNext = that.backPrev = new zim.Rectangle(width/2,height,backgroundColor).pos(0,0,zim.RIGHT,zim.TOP,that).setMask(peel);
74977
- }
74978
- stage.update();
74976
+ pageNext = that.backPrev = new zim.Rectangle(width/2,height,backgroundColor).reg(0,0).rot(0).pos(0,0,zim.RIGHT,zim.TOP,that).setMask(peel);
74977
+ }
74979
74978
  }
74980
74979
  toPage(startPage);
74981
74980
 
@@ -74984,17 +74983,30 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
74984
74983
  return that._currentPage;
74985
74984
  },
74986
74985
  set: function(num) {
74987
- offHTML();
74986
+ offHTML();
74988
74987
  if (startPage%2==1) {
74989
- num = Math.ceil(num/2)*2-1
74988
+ num = Math.floor(num/2)*2+1
74990
74989
  } else {
74991
74990
  num = Math.ceil(num/2)*2
74992
74991
  }
74993
- if (num==that.page) return;
74994
- else if (num>that.page) {
74992
+ num = zim.constrain(num, 0, that.pages.length-1);
74993
+
74994
+ that.currentW = 0;
74995
+ that.currentH = 0;
74996
+ that.lastPage = zim.constrain(that._currentPage);
74997
+
74998
+ if (num==that.page) return;
74999
+
75000
+ else if (num>that.page) {
75001
+ that.direction = "right";
75002
+ that.pageNext = pageNext.zimBookIndex;
75003
+
74995
75004
  pageBack.reg(0,0);
74996
75005
  pageNext.setMask(null);
74997
- } else {
75006
+ } else {
75007
+ that.direction = "left";
75008
+ that.pageNext = pageFore.zimBookIndex;
75009
+
74998
75010
  pageFore.reg(0,0);
74999
75011
  pagePrev.setMask(null);
75000
75012
  }
@@ -75196,7 +75208,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
75196
75208
  call:function () {
75197
75209
  zim.Ticker.remove(ticker);
75198
75210
  pageBack.reg(0,0);
75199
- pageNext.setMask(null);
75211
+ pageNext.setMask(null);
75200
75212
  toPage(that._currentPage+2);
75201
75213
  that.moving = false;
75202
75214
  turningCheck = false;
@@ -75250,7 +75262,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
75250
75262
  that.dispatchEvent("page");
75251
75263
  }
75252
75264
  });
75253
- var ticker = zim.Ticker.add(function() {
75265
+ var ticker = zim.Ticker.add(function() {
75254
75266
  peel
75255
75267
  .c()
75256
75268
  .mt(0, height)
@@ -75299,7 +75311,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
75299
75311
  if (zot(that.rollUp)) {setTimeout(function () {that.prevPage(speed);}, 10); return that;}
75300
75312
  if (that.moving) return;
75301
75313
  that.rollUp(width/2+.1, height+.1, "left", speed, "quadIn");
75302
- }
75314
+ }
75303
75315
  that.gotoPage = function(num, speed) {
75304
75316
  if (zot(that.rollUp)) {setTimeout(function () {that.gotoPage(num, speed);}, 10); return that;}
75305
75317
  num = zim.constrain(num, 0, that.pages.length-1);