zimjs 15.0.14 → 15.0.16

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 +77 -65
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zimjs",
3
- "version": "15.0.14",
3
+ "version": "15.0.16",
4
4
  "type": "module",
5
5
  "main": "./src/zim.js",
6
6
  "types": "./ts-src/typings/zim",
package/src/zim.js CHANGED
@@ -7478,8 +7478,8 @@ const show = Pick.choose(age);
7478
7478
 
7479
7479
  // below we randomize the tile colors in the first example
7480
7480
  // and make them in color order for the second example
7481
- new Tile(new Rectangle(10,10,[blue, red]), 10, 10).center(); would randomize colors
7482
- new Tile(new Rectangle(10,10,series(blue, red)), 10, 10).center(); would alternate colors
7481
+ new Tile(new Rectangle(10,10,[blue, red]), 10, 10).center(); // would randomize colors
7482
+ new Tile(new Rectangle(10,10,series(blue, red)), 10, 10).center(); // would alternate colors
7483
7483
 
7484
7484
  // here we pass an array through without processing the array:
7485
7485
  Pick.choose({noPick:[1,2,3,4,5]}); // result is [1,2,3,4,5]
@@ -27988,13 +27988,15 @@ zim.TextInput = function(width, height, placeholder, text, size, font, color, ba
27988
27988
  });
27989
27989
 
27990
27990
  if (pastText != null) {
27991
+ var hi = that.label.hiddenInput;
27992
+ if (hi.type=="number") hi.type = "text"; // number does not get selection
27991
27993
  label.focus = that.keyFocus = pastFocus;
27992
27994
  var f = zdf;
27993
27995
  if (that.stage) f = that.stage.frame;
27994
27996
  if (f.zil && label.focus) WW.removeEventListener("keydown", f.zil[0]);
27995
- if (f.zil && !label.focus) WW.addEventListener("keydown", f.zil[0]);
27996
- that.label.hiddenInput.selectionStart = pastStart;
27997
- that.label.hiddenInput.selectionEnd = pastEnd;
27997
+ if (f.zil && !label.focus) WW.addEventListener("keydown", f.zil[0]);
27998
+ hi.selectionStart = pastStart;
27999
+ hi.selectionEnd = pastEnd;
27998
28000
  that.label.positionBlinkerAndSelection();
27999
28001
  if (that.label.focus) that.label.blinker.replayTween();
28000
28002
  }
@@ -28273,12 +28275,13 @@ zim.TextInput.LabelInput = function(text, size, maxLength, password, selectionCo
28273
28275
  if (!this.focus) {
28274
28276
  this.hiddenInput.focus();
28275
28277
  // ZIM NFT 00 patch
28276
- if (inputType == "number" || inputType == "email") this.hiddenInput.type = "text";
28277
- }
28278
+ if (inputType == "email") this.hiddenInput.type = "text";
28279
+ }
28280
+ if (inputType == "number") this.hiddenInput.type = "text";
28278
28281
  var selectionIdx = this.mapPointToIndex(point);
28279
28282
  if (rtl) this.hiddenInput.setSelectionRange(le-selectionIdx, le-selectionIdx);
28280
28283
  else this.hiddenInput.setSelectionRange(selectionIdx, selectionIdx);
28281
- this.positionBlinkerAndSelection();
28284
+ this.positionBlinkerAndSelection();
28282
28285
  }
28283
28286
  this.onPressmove = function(e) {
28284
28287
  // ZIM NFT 01 Patch any le or rtl
@@ -28288,7 +28291,6 @@ zim.TextInput.LabelInput = function(text, size, maxLength, password, selectionCo
28288
28291
  var selectionIdx;
28289
28292
  if (rtl) selectionIdx = le-this.mapPointToIndex(point);
28290
28293
  else selectionIdx = this.mapPointToIndex(point);
28291
-
28292
28294
  if (this.hiddenInput.selectionStart === this.hiddenInput.selectionEnd) {
28293
28295
  if (this.hiddenInput.selectionStart <= selectionIdx) {
28294
28296
  this.hiddenInput.setSelectionRange(this.hiddenInput.selectionStart, selectionIdx, rtl?"backward":"forward");
@@ -28447,7 +28449,7 @@ zim.TextInput.LabelInput = function(text, size, maxLength, password, selectionCo
28447
28449
 
28448
28450
  }
28449
28451
  zim.extend(zim.TextInput.LabelInput, zim.Label, "dispose", "zimLabel", false);
28450
- //-54.2
28452
+ //-54.2
28451
28453
 
28452
28454
 
28453
28455
  /*--
@@ -37490,7 +37492,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
37490
37492
  if (tkb.label.text.length > 0) {
37491
37493
  if (tkb.na.length === 1) {
37492
37494
  if (data[4] && data[4][tkb.label.text]) tkb.label.text = data[4][tkb.label.text];
37493
- else tkb.label.text = tkb.label.text.toUpperCase();
37495
+ else tkb.label.text = layout=="turkish"?tkb.label.text.toLocaleUpperCase("tr-TR"):tkb.label.text.toUpperCase();
37494
37496
  tkb.label.centerReg(tkb).mov(0, 6);
37495
37497
  } else {
37496
37498
  tkb.label.centerReg(tkb);
@@ -37720,7 +37722,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
37720
37722
  alternativeMenu.y = - size - 5;
37721
37723
  for (var i = 0; i < thisArray.length; i++) {
37722
37724
  if (currentStatus === statuses.shift) {
37723
- thisLetter = thisArray[i].toUpperCase();
37725
+ thisLetter = layout=="turkish"?thisArray[i].toLocaleUpperCase("tr-TR"):thisArray[i].toUpperCase();
37724
37726
  } else {
37725
37727
  thisLetter = thisArray[i];
37726
37728
  }
@@ -37968,7 +37970,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
37968
37970
  makeWidthsArray();
37969
37971
  } else {
37970
37972
  if (currentStatus === statuses.shift) {
37971
- letter = letter.toUpperCase();
37973
+ letter = layout=="turkish"?letter.toLocaleUpperCase("tr-TR"):letter.toUpperCase();
37972
37974
  }
37973
37975
  if (currentLabel && that.maxLength && currentLabel.text.length >= that.maxLength) return;
37974
37976
  if (that.numbersOnly && !isFinite(Number(letter))) return;
@@ -50724,7 +50726,7 @@ RETURNS the target for chaining (or null if no target is provided and run on zim
50724
50726
  target.zimTween.startPaused = false;
50725
50727
  // if (!this.paused) this.pauseAnimate(true, id);
50726
50728
  if (!dynamic) {
50727
-
50729
+
50728
50730
  if (target.zimTweens) {
50729
50731
  zim.loop(target.zimTweens, function(id,tw,i) {
50730
50732
  var tim = target.tweenStartTime + (target.tweenEndTime - target.tweenStartTime) * value / 100;
@@ -50736,8 +50738,8 @@ RETURNS the target for chaining (or null if no target is provided and run on zim
50736
50738
  } else {
50737
50739
  nt = tim - tw.startTime;
50738
50740
  }
50739
- tw.percentComplete = Math.max(0, Math.min(100, nt/tw.duration * 100));
50740
- });
50741
+ tw.percentComplete = Math.max(0, Math.min(100, nt/tw.duration * 100));
50742
+ }, true);
50741
50743
 
50742
50744
  } else {
50743
50745
  target.zimTween.setPosition(Math.round(value*target.zimTween.duration/100));
@@ -71094,6 +71096,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
71094
71096
  tile.pointers = {};
71095
71097
  tile.on("mousedown", function (e) {
71096
71098
  if (dCheck) return;
71099
+ zog("here")
71097
71100
  dCheck = true;
71098
71101
  offOthers(e.target);
71099
71102
  that.myDownCheck = true;
@@ -71138,7 +71141,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
71138
71141
  that.upEvent = tile.on("pressup", function(e) {
71139
71142
  var id = "id"+Math.abs(e.pointerID+1);
71140
71143
  if (!tile.pointers[id]) return;
71141
- that.myDownCheck = dCheck = false;
71144
+ // that.myDownCheck = dCheck = false;
71142
71145
  doUp(e);
71143
71146
  });
71144
71147
 
@@ -71148,8 +71151,8 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
71148
71151
  if (!tile.pointers[id]) return;
71149
71152
  delete tile.pointers[id];
71150
71153
  var good = true;
71151
- onOthers();
71152
- dCheck = false;
71154
+ // dCheck = false;
71155
+ // onOthers();
71153
71156
  if (that.moveEvent) tile.off("pressmove", that.moveEvent);
71154
71157
  if (swapLock) {
71155
71158
  var cbg = e.target.boundsToGlobal();
@@ -71163,7 +71166,8 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
71163
71166
  }
71164
71167
  if (swap && good) doMove(e);
71165
71168
 
71166
- e.target.mouseEnabled = false;
71169
+ // e.target.mouseEnabled = false;
71170
+ e.target.dragPaused = true;
71167
71171
  e.target.animate({
71168
71172
  props:{x:startX, y:startY},
71169
71173
  time:.1,
@@ -71184,7 +71188,11 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
71184
71188
  if (e.target.backing) e.target.backing.shadow = null;
71185
71189
  else e.target.shadow = null;
71186
71190
  }
71187
- e.target.mouseEnabled = true;
71191
+
71192
+ that.mySownCheck = dCheck = false;
71193
+ onOthers();
71194
+ // e.target.mouseEnabled = true;
71195
+ e.target.dragPaused = false;
71188
71196
  }
71189
71197
  if (!swap) {
71190
71198
  if (that.moveEvent) tile.off("pressmove", that.moveEvent);
@@ -71226,6 +71234,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
71226
71234
  timeUnit:"seconds",
71227
71235
  call:function () {
71228
71236
  // t.mouseEnabled = true;
71237
+ if (!dCheck) t.dragPaused = false;
71229
71238
  if (swap && !that.complete && that.test()) {
71230
71239
  that.complete = true;
71231
71240
  that.dispatchEvent("complete");
@@ -71247,6 +71256,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
71247
71256
  timeUnit:"seconds",
71248
71257
  call:function () {
71249
71258
  // t.mouseEnabled = true;
71259
+ if (!dCheck) t.dragPaused = false;
71250
71260
  if (swap && !that.complete && that.test()) {
71251
71261
  that.complete = true;
71252
71262
  that.dispatchEvent("complete");
@@ -71260,12 +71270,14 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
71260
71270
 
71261
71271
  function offOthers(target) {
71262
71272
  tile.loop(function (t) {
71263
- if (t!=target) t.noMouse();
71273
+ // if (t!=target) t.noMouse();
71274
+ if (t!=target) t.dragPaused = true;
71264
71275
  });
71265
71276
  }
71266
71277
  function onOthers() {
71267
71278
  tile.loop(function (t) {
71268
- if (!t.locked) t.mouse();
71279
+ if (!t.locked && !t.animating) t.dragPaused = false;
71280
+ // if (!t.locked) t.mouse();
71269
71281
  });
71270
71282
  }
71271
71283
 
@@ -82724,7 +82736,9 @@ RETURNS - null
82724
82736
  callback(bitmap, params);
82725
82737
  DOMURL.revokeObjectURL(obu);
82726
82738
  };
82727
- var obu = DOMURL.createObjectURL(new document.Blob([svgString], {type: "image/svg+xml"}));
82739
+ var obu;
82740
+ if (document && document.Blob) obu = DOMURL.createObjectURL(new document.Blob([svgString], {type: "image/svg+xml"}));
82741
+ else obu = DOMURL.createObjectURL(new Blob([svgString], {type: "image/svg+xml"}));
82728
82742
  img.src = obu;
82729
82743
  };//-83.27
82730
82744
 
@@ -85496,7 +85510,7 @@ END EXAMPLE
85496
85510
 
85497
85511
  PARAMETERS supports DUO - parameters or single object with properties below
85498
85512
  time - (default 60) time in seconds to start the timer
85499
- step - (default 1000) step in ms to show a change in timer
85513
+ step - (default 1) step in s to show a change in timer
85500
85514
  colon - (default false) add colon and seconds eg. 1:30 instead of 90 seconds
85501
85515
  down - (default true) set to false to count up
85502
85516
  isometric - (default null) set to LEFT or RIGHT to position an isometric timer
@@ -86610,9 +86624,7 @@ const ask = new CamAsk().show(yes=>{
86610
86624
  new Pane("CAM not accepted",yellow).show();
86611
86625
  });
86612
86626
  } else { // answered no to CamAsk dialog
86613
- cam.on("error", ()=>{
86614
- new Pane("CAM not accepted",yellow).show();
86615
- });
86627
+ new Pane("CAM not accepted",yellow).show();
86616
86628
  }
86617
86629
  });
86618
86630
  END EXAMPLE
@@ -87155,10 +87167,12 @@ zim class - extends a zim.Container which extends a createjs.Container
87155
87167
 
87156
87168
  DESCRIPTION
87157
87169
  A widget with a slider that sets the alpha of the ZIM Cam or CamMotion provided.
87170
+ The initial alpha is set by setting the alpha of the Cam()
87171
+ or by using the preview parameter of CamMotion() or CamCursor().
87158
87172
 
87159
87173
  SEE: https://zimjs.com/nft/bubbling/cam.html and use right arrow to see all four examples
87160
87174
 
87161
- NOTE: make the CamAlpha in the ready event of the Cam or CamMotion
87175
+ NOTE: make the CamAlpha in the ready event of the Cam() or CamMotion()
87162
87176
 
87163
87177
  NOTE: as of ZIM 5.5.0 the zim namespace is no longer required (unless zns is set to true before running zim)
87164
87178
 
@@ -87327,11 +87341,9 @@ const ask = new CamAsk().show(yes=>{
87327
87341
  new Pane("CAM not accepted",yellow).show();
87328
87342
  });
87329
87343
  } else { // answered no to CamAsk dialog
87330
- cam.on("error", ()=>{
87331
- new Pane("CAM not accepted",yellow).show();
87332
- });
87344
+ new Pane("CAM not accepted",yellow).show();
87333
87345
  }
87334
- }
87346
+ });
87335
87347
  END EXAMPLE
87336
87348
 
87337
87349
  PARAMETERS
@@ -87706,34 +87718,34 @@ https://codepen.io/zimjs/pen/ZqNYxX
87706
87718
  } (zim || {});
87707
87719
 
87708
87720
  var globalFunctions = [
87709
- ["zog", zog],
87710
- ["zid", zid],
87711
- ["zss", zss],
87712
- ["zgo", zgo],
87713
- ["zum", zum],
87714
- ["zot", zot],
87715
- ["zop", zop],
87716
- ["zil", zil],
87717
- ["zet", zet],
87718
- ["zob", zob],
87719
- ["zik", zik],
87720
- ["zta", zta],
87721
- ["zor", zor],
87722
- ["zogg", zogg],
87723
- ["zogp", zogp],
87724
- ["zogb", zogb],
87725
- ["zogr", zogr],
87726
- ["zogy", zogy],
87727
- ["zogo", zogo],
87728
- ["zogl", zogl],
87729
- ["zogd", zogd],
87730
- ["zimplify", zimplify],
87731
- ["zimify", zimify]
87721
+ ["zog", zog],
87722
+ ["zid", zid],
87723
+ ["zss", zss],
87724
+ ["zgo", zgo],
87725
+ ["zum", zum],
87726
+ ["zot", zot],
87727
+ ["zop", zop],
87728
+ ["zil", zil],
87729
+ ["zet", zet],
87730
+ ["zob", zob],
87731
+ ["zik", zik],
87732
+ ["zta", zta],
87733
+ ["zor", zor],
87734
+ ["zogg", zogg],
87735
+ ["zogp", zogp],
87736
+ ["zogb", zogb],
87737
+ ["zogr", zogr],
87738
+ ["zogy", zogy],
87739
+ ["zogo", zogo],
87740
+ ["zogl", zogl],
87741
+ ["zogd", zogd],
87742
+ ["zimplify", zimplify],
87743
+ ["zimify", zimify]
87732
87744
  ];
87733
87745
 
87734
87746
  for (z_i = 0; z_i < globalFunctions.length; z_i++) {
87735
- var pair = globalFunctions[z_i];
87736
- WW[pair[0]] = zim[pair[0]] = pair[1];
87747
+ var pair = globalFunctions[z_i];
87748
+ WW[pair[0]] = zim[pair[0]] = pair[1];
87737
87749
  }
87738
87750
 
87739
87751
 
@@ -87781,16 +87793,16 @@ var globalsConstants = [
87781
87793
  ["DEG", zim.DEG],
87782
87794
  ["RAD", zim.RAD],
87783
87795
  ["PHI", zim.PHI],
87784
- ];
87785
-
87786
- for (z_i = 0; z_i < globalsConstants.length; z_i++) {
87796
+ ];
87797
+
87798
+ for (z_i = 0; z_i < globalsConstants.length; z_i++) {
87787
87799
  var pair = globalsConstants[z_i];
87788
87800
  WW[pair[0]] = pair[1];
87789
- }
87790
-
87791
- for (z_i = 0; z_i < zim.colors.length; z_i++) {
87801
+ }
87802
+
87803
+ for (z_i = 0; z_i < zim.colors.length; z_i++) {
87792
87804
  WW[zim.colors[z_i]] = zim.colorsHex[z_i];
87793
- }
87805
+ }
87794
87806
 
87795
87807
 
87796
87808
  WW.zim = zim;