zimjs 15.0.13 → 15.0.15

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 +366 -267
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zimjs",
3
- "version": "15.0.13",
3
+ "version": "15.0.15",
4
4
  "type": "module",
5
5
  "main": "./src/zim.js",
6
6
  "types": "./ts-src/typings/zim",
package/src/zim.js CHANGED
@@ -2086,7 +2086,6 @@ pauseTimeLeft - if paused, get how much time is left once unpaused
2086
2086
  if (zot(zim.blurCheck)) zim.setBlurDetect();
2087
2087
  zim.pauseOnBlur.push(obj);
2088
2088
  }
2089
-
2090
2089
  function interval() {
2091
2090
  obj.startTime = Date.now();
2092
2091
  obj.interval = zim.Pick.choose(obj.time);
@@ -25163,7 +25162,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
25163
25162
  testContent();
25164
25163
  };
25165
25164
 
25166
- this.resize = function(w, h) {
25165
+ this.doResize = function(w, h) {
25167
25166
  if (zot(w)) w = width;
25168
25167
  if (zot(h)) h = height;
25169
25168
  var min = Math.max(20, corner*2);
@@ -25911,6 +25910,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
25911
25910
  };
25912
25911
  zim.extend(zim.Window, zim.Container, ["clone", "dispose"], "zimContainer", false);
25913
25912
  zim.Window.prototype.dispose = function(disposing) {return this.doDispose(null,null,disposing);};
25913
+ zim.Window.prototype.resize = function(width, height) {return this.doResize(width, height);};
25914
25914
  zimWindow = zim.Window; // used in export so we do not obscure the JS Window
25915
25915
  //-58.1
25916
25916
 
@@ -26607,10 +26607,10 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
26607
26607
  that.loop(function (obj) {
26608
26608
  if (obj.transformControls) {
26609
26609
  if (obj.transformControls.visible) obj.transformControls.hide();
26610
- if (obj.type == "Layer") {
26610
+ if (obj.type == "Layer" && obj.resizeChildren) {
26611
26611
  obj.resizeChildren();
26612
26612
  } else {
26613
- obj.transformControls.resize();
26613
+ if (obj.transformControls) obj.transformControls.resize();
26614
26614
  }
26615
26615
  }
26616
26616
  });
@@ -26686,11 +26686,13 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
26686
26686
  bar.layer = null;
26687
26687
  });
26688
26688
  }
26689
- that.transformControls.dispose();
26689
+ if (that.transformControls) that.transformControls.dispose();
26690
26690
  that.transformControls = null;
26691
26691
  if (!disposing) this.zimContainer_dispose(true);
26692
- that.titleBar.layer = null;
26693
- that.titleBar.dispose();
26692
+ if (that.titleBar) {
26693
+ that.titleBar.layer = null;
26694
+ that.titleBar.dispose();
26695
+ }
26694
26696
  that.checkBox = that.button = null;
26695
26697
  titleBar = that.titleBar = transformObject = null;
26696
26698
  return true;
@@ -27677,6 +27679,8 @@ selectionAlpha - get or set the alpha of the selection
27677
27679
  blinker - access to the blinking cursor ZIM Rectangle
27678
27680
  use this to set color or blendMode of blinker
27679
27681
  size - the font size of the Label (without px)
27682
+ use textInput.resize() if there are selection problems after setting size
27683
+ often a resize() is desired anyway so manually calling avoids double resizing
27680
27684
  font - get or set the font of the text
27681
27685
  align - get or set the horizontal alignment of the text
27682
27686
  values are LEFT and RIGHT and CENTER (experimental)
@@ -27806,80 +27810,226 @@ zim.TextInput = function(width, height, placeholder, text, size, font, color, ba
27806
27810
  this.zimWindow_constructor(width, height, null, backgroundColor, borderColor, borderWidth, padding, corner, false, scrollBarActive, scrollBarDrag, scrollBarColor, scrollBarAlpha, scrollBarFade, scrollBarH, scrollBarV, false, null, null, false, true, shadowColor, shadowBlur, paddingH, paddingV, true, null, null, null, null, null, false, null, null, null, null, null, null, null, null, null, null, null, null, style, group, zim.copy(DS));
27807
27811
  this.type = "TextInput";
27808
27812
  var that = this;
27813
+
27814
+ var label;
27815
+ var pastText;
27816
+ var pastStart;
27817
+ var pastEnd;
27818
+ var pastFocus;
27819
+ var mask;
27820
+ var edgeLeft;
27821
+ var edgeRight;
27809
27822
 
27810
- this.placeholderLabel = new zim.Label({text:placeholder||"", size:size, color:color, font:font, shiftH:shiftH, shiftV:shiftV, valign:"top"}).alp(.5);
27811
- if (text=="") this.add(this.placeholderLabel);
27812
-
27813
- // the Window usually masks but masks to the edge and not to inside the padding
27814
- // so add a custom mask
27815
- var mask = new zim.Rectangle({width:width-padding*2, height:height-padding*2, color:zim.clear, style:false}).center(this);
27816
- this.cur("text");
27817
-
27818
- var label = this.label = new zim.TextInput.LabelInput(text, size, maxLength, password, selectionColor, selectionAlpha, cursorColor, cursorSpeed, font, color, null, null, null, align, "top", null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, shiftH, shiftV, null, null, null, null, inputType, rtl, uppercase, placeholderInstant, style, group, inherit);
27819
- this.add(label); // this is a Window - which has an add() method for adding content
27820
- label.setMask(mask);
27821
- this.htmlTag = this.label.hiddenInput
27822
- this.selection = this.label.selection
27823
- this.blinker = this.label.blinker
27824
-
27825
- if (align=="right") {
27826
- label.x = width-paddingH;
27827
- this.placeholderLabel.x = width-this.placeholderLabel.width-paddingH;
27828
- } else if (align=="center") {
27829
- label.x = width/2;
27830
- this.placeholderLabel.x = (width-this.placeholderLabel.width)/2;
27831
- }
27823
+ function makeText() {
27832
27824
 
27833
- label.ogx = label.x;
27825
+ if (label) removeText();
27834
27826
 
27835
- that.placeholderLabel.x = label.x;
27836
- that.placeholderLabel.align = align;
27827
+ that.placeholderLabel = new zim.Label({text:placeholder||"", size:size, color:color, font:font, shiftH:shiftH, shiftV:shiftV, valign:"top"}).alp(.5);
27828
+ if ((pastText == null && text=="") || pastText === "") that.add(that.placeholderLabel);
27829
+
27830
+ // the Window usually masks but masks to the edge and not to inside the padding
27831
+ // so add a custom mask
27832
+ mask = new zim.Rectangle({width:width-padding*2, height:height-padding*2, color:zim.clear, style:false}).center(that);
27833
+ that.cur("text");
27834
+
27835
+ label = that.label = new zim.TextInput.LabelInput(pastText!=null?pastText:text, size, maxLength, password, selectionColor, selectionAlpha, cursorColor, cursorSpeed, font, color, null, null, null, align, "top", null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, shiftH, shiftV, null, null, null, null, inputType, rtl, uppercase, placeholderInstant, style, group, inherit);
27836
+ that.add(label); // that is a Window - which has an add() method for adding content
27837
+ label.setMask(mask);
27838
+ that.htmlTag = that.label.hiddenInput
27839
+ that.selection = that.label.selection
27840
+ that.blinker = that.label.blinker
27837
27841
 
27838
- // the LabelInput was receiving a mousedown on its edges which is not desired
27839
- // so capture those with rectangle padding shields
27840
- // these can be used to capture a mousedown for selection swipe though
27841
- // but just start the selection at the visible letter on that side
27842
- var edgeLeft = new zim.Rectangle({width:padding, height:height, color:zim.clear, style:false}).addTo(this).expand(0);
27843
- edgeLeft.on("mousedown", function(e){
27844
- label.onMousedown(e);
27845
- e.stopImmediatePropagation();
27846
- });
27847
- edgeLeft.on("pressmove", function(e){
27848
- label.onPressmove(e);
27849
- e.stopImmediatePropagation();
27850
- });
27851
- edgeLeft.on("dblclick", function(e){
27852
- label.onDblclick(e);
27853
- e.stopImmediatePropagation();
27854
- });
27855
- var edgeRight = new zim.Rectangle({width:padding, height:height, color:zim.clear, style:false}).pos(0,0,zim.RIGHT,zim.TOP,this).expand(0)
27856
- edgeRight.on("mousedown", function(e){
27857
- label.onMousedown(e);
27858
- e.stopImmediatePropagation();
27859
- });
27860
- edgeRight.on("pressmove", function(e){
27861
- label.onPressmove(e);
27862
- e.stopImmediatePropagation();
27863
- });
27864
- edgeRight.on("dblclick", function(e){
27865
- label.onDblclick(e);
27866
- e.stopImmediatePropagation();
27867
- });
27868
27842
 
27843
+ if (align=="right") {
27844
+ label.x = width-paddingH;
27845
+ that.placeholderLabel.x = width-that.placeholderLabel.width-paddingH;
27846
+ } else if (align=="center") {
27847
+ label.x = width/2;
27848
+ that.placeholderLabel.x = (width-that.placeholderLabel.width)/2;
27849
+ }
27850
+
27851
+ label.ogx = label.x;
27852
+
27853
+ that.placeholderLabel.x = label.x;
27854
+ that.placeholderLabel.align = align;
27855
+
27856
+ // the LabelInput was receiving a mousedown on its edges which is not desired
27857
+ // so capture those with rectangle padding shields
27858
+ // these can be used to capture a mousedown for selection swipe though
27859
+ // but just start the selection at the visible letter on that side
27860
+ edgeLeft = new zim.Rectangle({width:padding, height:height, color:zim.clear, style:false}).addTo(that).expand(0);
27861
+ edgeLeft.on("mousedown", function(e){
27862
+ label.onMousedown(e);
27863
+ e.stopImmediatePropagation();
27864
+ });
27865
+ edgeLeft.on("pressmove", function(e){
27866
+ label.onPressmove(e);
27867
+ e.stopImmediatePropagation();
27868
+ });
27869
+ edgeLeft.on("dblclick", function(e){
27870
+ label.onDblclick(e);
27871
+ e.stopImmediatePropagation();
27872
+ });
27873
+ edgeRight = new zim.Rectangle({width:padding, height:height, color:zim.clear, style:false}).pos(0,0,zim.RIGHT,zim.TOP,that).expand(0)
27874
+ edgeRight.on("mousedown", function(e){
27875
+ label.onMousedown(e);
27876
+ e.stopImmediatePropagation();
27877
+ });
27878
+ edgeRight.on("pressmove", function(e){
27879
+ label.onPressmove(e);
27880
+ e.stopImmediatePropagation();
27881
+ });
27882
+ edgeRight.on("dblclick", function(e){
27883
+ label.onDblclick(e);
27884
+ e.stopImmediatePropagation();
27885
+ });
27886
+
27887
+ that.label.on("focus", function () {
27888
+ if (WW.M && keyboardShift) {
27889
+ if (that.re) that.stage.frame.off("resize", that.re);
27890
+ that.re = that.stage.frame.on("resize", function(){
27891
+ if (that.stage && h>that.stage.height/4) {
27892
+ that.stage.y = that.stage.scaleY*(that.stage.height/4-h);
27893
+ that.stage.update();
27894
+ }
27895
+ });
27896
+ var h = that.label.localToGlobal(0,0).y;
27897
+ if (that.stage && h>that.stage.height/4) {
27898
+ that.stage.y = that.stage.scaleY*(that.stage.height/4-h);
27899
+ that.stage.update();
27900
+ }
27901
+ }
27902
+ if (placeholderInstant && that.placeholderLabel.parent) {
27903
+ that.placeholderLabel.removeFrom();
27904
+ if (that.stage) that.stage.update();
27905
+ }
27906
+ that.dispatchEvent("focus");
27907
+ });
27908
+
27909
+ that.label.on("blur", function () {
27910
+ if (WW.M && keyboardShift) {
27911
+ if (that.stage) {
27912
+ if (that.re) that.stage.frame.off("resize", that.re);
27913
+ that.stage.y = sYO;
27914
+ that.stage.update();
27915
+ }
27916
+ }
27917
+ if (placeholderInstant && label.text == "" && !that.placeholderLabel.parent) {
27918
+ that.add(that.placeholderLabel);
27919
+ if (that.stage) that.stage.update();
27920
+ }
27921
+ that.dispatchEvent("blur");
27922
+ });
27923
+
27924
+ that.label.on("input", function () {
27925
+ doPlaceholder();
27926
+ // if (align=="center" && label.width < width) {
27927
+ // label.x = (width-label.width)/2;
27928
+ // }
27929
+ that.dispatchEvent("input");
27930
+ });
27931
+ that.label.on("keydown", function (e) {
27932
+ that.label.deleteKey = (e.detail == 46);
27933
+ that.dispatchEvent("keydown");
27934
+ });
27935
+ that.label.on("blinker", function () {
27936
+
27937
+ // Pettis Brandon code '23
27938
+ var thatX = that.localToGlobal(0,0).x; // Get the global X of that.
27939
+ var thatFull = thatX + width-paddingH-label.blinker.width; // Get the global coordinates of the far right corner.
27940
+ var blinker = label.blinker; // Get the blinker shorthand
27941
+ var blinkerX = blinker.localToGlobal(0,0).x; // Get the global X of the blinker.
27942
+ var labelX = label.localToGlobal(0,0).x - 1; // Get the gloabal X of the label.
27943
+ // end Pettis Brandon code '23
27944
+
27945
+ // A simple system where the cursor is kept within the box
27946
+ var x = label.x + label.blinker.x;
27947
+ var newX = zim.constrain(x, paddingH, width-paddingH-label.blinker.width);
27948
+
27949
+ if (x != newX) label.x -= x-newX;
27950
+
27951
+ // Pettis Brandon code '23
27952
+ if (align == 'left') {
27953
+ if (label.width < that.width) label.x = label.ogx; // Restore starting X to the label when width is less than container width.
27954
+ else if (thatFull < blinkerX)label.x -= x-newX; // Move label while typing.
27955
+ else if (label.oldWidth == label.width){
27956
+ label.x -= x-newX; // If label is the same width move label where the cursor position is.
27957
+ } else if (label.oldWidth > label.width){
27958
+ if (that.label.deleteKey != true) label.x += Math.abs(blinker.oldX - blinkerX) + label.blinker.width + paddingH; // If we are removing characters try to keep curor in the same spot.
27959
+ }
27960
+ } else if (align == 'right') {
27961
+ if (label.width < that.width) label.x = label.ogx; // Restore starting X to the label when width is less than container width.
27962
+ else if (thatFull < blinkerX)label.x -= x-newX; // Move label while typing.
27963
+ else if (label.oldWidth == label.width){
27964
+ label.x -= x-newX; // If label is the same width move label where the cursor position is.
27965
+ } else if (label.oldWidth > label.width){ // If we are removing characters try to keep curor in the same spot.
27966
+ if (that.label.deleteKey == true) {
27967
+ if (blinkerX < (labelX - that.width)) label.x -= Math.abs(blinker.oldX - blinkerX) + label.blinker.width + paddingH;
27968
+ }
27969
+ }
27970
+ } else if (align == 'center') {
27971
+ if (label.width < that.width) label.x = label.ogx; // Restore starting X to the label when width is less than container width
27972
+ else if (thatFull < blinkerX) label.x -= x-newX; // Move label while typing.
27973
+ else if (label.oldWidth == label.width){
27974
+ label.x -= x-newX; // If label is the same width move label where the cursor position is.
27975
+ } else if (label.oldWidth > label.width){
27976
+ if (thatFull > blinkerX) {
27977
+ var centerX = thatX + (that.width*.5);
27978
+ if (that.label.deleteKey != true) label.x += label.blinker.width + paddingH; // Test if using the backspace key
27979
+ else label.x -= label.blinker.width + paddingH; // Test if using the delete key
27980
+ }
27981
+ }
27982
+ }
27983
+ label.oldWidth = label.width; // Get previous label width.
27984
+ blinker.oldX = blinkerX; // get previous blinker global x.
27985
+ // end Pettis Brandon code '23
27986
+
27987
+ if (that.stage) that.stage.update();
27988
+ });
27989
+
27990
+ if (pastText != null) {
27991
+ label.focus = that.keyFocus = pastFocus;
27992
+ var f = zdf;
27993
+ if (that.stage) f = that.stage.frame;
27994
+ 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;
27998
+ that.label.positionBlinkerAndSelection();
27999
+ if (that.label.focus) that.label.blinker.replayTween();
28000
+ }
28001
+
28002
+ }
28003
+ makeText();
28004
+
28005
+ function removeText() {
28006
+ if (that.re) that.stage.frame.off("resize", that.re);
28007
+ that.remove(label);
28008
+ pastText = label.text;
28009
+ pastFocus = label.focus;
28010
+ pastStart = that.label.hiddenInput.selectionStart;
28011
+ pastEnd = that.label.hiddenInput.selectionEnd;
28012
+ that.placeholderLabel.dispose();
28013
+ that.label.dispose();
28014
+ edgeLeft.dispose();
28015
+ edgeRight.dispose();
28016
+ }
28017
+
27869
28018
  var lastText = label.text;
27870
- this.on("mousedown", function (e) {
28019
+ that.on("mousedown", function (e) {
27871
28020
  label.onMousedown(e);
27872
28021
  lastText = label.text;
27873
28022
  });
27874
- this.on("pressmove", function(e){
28023
+ that.on("pressmove", function(e){
27875
28024
  label.onPressmove(e);
27876
28025
  e.stopImmediatePropagation();
27877
28026
  });
27878
- this.on("dblclick", function(e){
28027
+ that.on("dblclick", function(e){
27879
28028
  label.onDblclick(e);
27880
28029
  e.stopImmediatePropagation();
27881
- });
27882
- this.added(function (stage) {
28030
+ });
28031
+
28032
+ that.added(function (stage) {
27883
28033
  stage.on("stagemousedown", function (e) {
27884
28034
  if (!that.hitTestPoint(e.stageX, e.stageY)) {
27885
28035
  label.focus = false;
@@ -27889,43 +28039,7 @@ zim.TextInput = function(width, height, placeholder, text, size, font, color, ba
27889
28039
  });
27890
28040
  });
27891
28041
  var sYO = that.stage?stage.y:0;
27892
-
27893
- this.label.on("focus", function () {
27894
- if (WW.M && keyboardShift) {
27895
- if (that.re) that.stage.frame.off("resize", that.re);
27896
- that.re = that.stage.frame.on("resize", function(){
27897
- if (that.stage && h>that.stage.height/4) {
27898
- that.stage.y = that.stage.scaleY*(that.stage.height/4-h);
27899
- that.stage.update();
27900
- }
27901
- });
27902
- var h = that.label.localToGlobal(0,0).y;
27903
- if (that.stage && h>that.stage.height/4) {
27904
- that.stage.y = that.stage.scaleY*(that.stage.height/4-h);
27905
- that.stage.update();
27906
- }
27907
- }
27908
- if (placeholderInstant && that.placeholderLabel.parent) {
27909
- that.placeholderLabel.removeFrom();
27910
- if (that.stage) that.stage.update();
27911
- }
27912
- that.dispatchEvent("focus");
27913
- });
27914
28042
 
27915
- this.label.on("blur", function () {
27916
- if (WW.M && keyboardShift) {
27917
- if (that.stage) {
27918
- if (that.re) that.stage.frame.off("resize", that.re);
27919
- that.stage.y = sYO;
27920
- that.stage.update();
27921
- }
27922
- }
27923
- if (placeholderInstant && label.text == "" && !that.placeholderLabel.parent) {
27924
- that.add(that.placeholderLabel);
27925
- if (that.stage) that.stage.update();
27926
- }
27927
- that.dispatchEvent("blur");
27928
- });
27929
28043
  function doPlaceholder() {
27930
28044
  if (label.text != "" && that.placeholderLabel.parent) {
27931
28045
  that.placeholderLabel.removeFrom();
@@ -27936,72 +28050,6 @@ zim.TextInput = function(width, height, placeholder, text, size, font, color, ba
27936
28050
  if (that.stage) that.stage.update();
27937
28051
  }
27938
28052
  }
27939
- this.label.on("input", function () {
27940
- doPlaceholder();
27941
- // if (align=="center" && label.width < width) {
27942
- // label.x = (width-label.width)/2;
27943
- // }
27944
- that.dispatchEvent("input");
27945
- });
27946
- this.label.on("keydown", function (e) {
27947
- this.label.deleteKey = (e.detail == 46);
27948
- that.dispatchEvent("keydown");
27949
- });
27950
- this.label.on("blinker", function () {
27951
-
27952
- // Pettis Brandon code '23
27953
- var thatX = that.localToGlobal(0,0).x; // Get the global X of that.
27954
- var thatFull = thatX + width-paddingH-label.blinker.width; // Get the global coordinates of the far right corner.
27955
- var blinker = label.blinker; // Get the blinker shorthand
27956
- var blinkerX = blinker.localToGlobal(0,0).x; // Get the global X of the blinker.
27957
- var labelX = label.localToGlobal(0,0).x - 1; // Get the gloabal X of the label.
27958
- // end Pettis Brandon code '23
27959
-
27960
- // A simple system where the cursor is kept within the box
27961
- var x = label.x + label.blinker.x;
27962
- var newX = zim.constrain(x, paddingH, width-paddingH-label.blinker.width);
27963
-
27964
- if (x != newX) label.x -= x-newX;
27965
-
27966
- // Pettis Brandon code '23
27967
- if (align == 'left') {
27968
- if (label.width < that.width) label.x = label.ogx; // Restore starting X to the label when width is less than container width.
27969
- else if (thatFull < blinkerX)label.x -= x-newX; // Move label while typing.
27970
- else if (label.oldWidth == label.width){
27971
- label.x -= x-newX; // If label is the same width move label where the cursor position is.
27972
- } else if (label.oldWidth > label.width){
27973
- if (this.label.deleteKey != true) label.x += Math.abs(blinker.oldX - blinkerX) + label.blinker.width + paddingH; // If we are removing characters try to keep curor in the same spot.
27974
- }
27975
- } else if (align == 'right') {
27976
- if (label.width < that.width) label.x = label.ogx; // Restore starting X to the label when width is less than container width.
27977
- else if (thatFull < blinkerX)label.x -= x-newX; // Move label while typing.
27978
- else if (label.oldWidth == label.width){
27979
- label.x -= x-newX; // If label is the same width move label where the cursor position is.
27980
- } else if (label.oldWidth > label.width){ // If we are removing characters try to keep curor in the same spot.
27981
- if (this.label.deleteKey == true) {
27982
- if (blinkerX < (labelX - that.width)) label.x -= Math.abs(blinker.oldX - blinkerX) + label.blinker.width + paddingH;
27983
- }
27984
- }
27985
- } else if (align == 'center') {
27986
- if (label.width < that.width) label.x = label.ogx; // Restore starting X to the label when width is less than container width
27987
- else if (thatFull < blinkerX) label.x -= x-newX; // Move label while typing.
27988
- else if (label.oldWidth == label.width){
27989
- label.x -= x-newX; // If label is the same width move label where the cursor position is.
27990
- } else if (label.oldWidth > label.width){
27991
- if (thatFull > blinkerX) {
27992
- var centerX = thatX + (that.width*.5);
27993
- if (this.label.deleteKey != true) label.x += label.blinker.width + paddingH; // Test if using the backspace key
27994
- else label.x -= label.blinker.width + paddingH; // Test if using the delete key
27995
- }
27996
- }
27997
- }
27998
- label.oldWidth = label.width; // Get previous label width.
27999
- blinker.oldX = blinkerX; // get previous blinker global x.
28000
- // end Pettis Brandon code '23
28001
-
28002
-
28003
- if (that.stage) that.stage.update();
28004
- });
28005
28053
 
28006
28054
  Object.defineProperty(that, 'text', {
28007
28055
  get: function() {
@@ -28039,8 +28087,6 @@ zim.TextInput = function(width, height, placeholder, text, size, font, color, ba
28039
28087
  });
28040
28088
  if (readOnly) that.readOnly = true;
28041
28089
 
28042
-
28043
-
28044
28090
  Object.defineProperty(that, 'focus', {
28045
28091
  get: function() {
28046
28092
  return label.focus;
@@ -28065,7 +28111,10 @@ zim.TextInput = function(width, height, placeholder, text, size, font, color, ba
28065
28111
  return label.size;
28066
28112
  },
28067
28113
  set: function(value) {
28114
+ size = value;
28115
+ // makeText();
28068
28116
  label.size = value;
28117
+ if (this.placeholderLabel) this.placeholderLabel.size = value;
28069
28118
  label.hiddenInput.style.fontSize = value + "px";
28070
28119
  if ((!zim.OPTIMIZE&&(zns||!WW.OPTIMIZE)) && that.stage) that.stage.update();
28071
28120
  }
@@ -28108,12 +28157,22 @@ zim.TextInput = function(width, height, placeholder, text, size, font, color, ba
28108
28157
  }
28109
28158
  });
28110
28159
 
28160
+ this.resize = function(w, h) {
28161
+ width = w||width;
28162
+ height = h||height;
28163
+ that.zimWindow_resize(width, height);
28164
+ // mask.siz(width-padding*2, height-padding*2).center(this);
28165
+ // label.setMask(mask);
28166
+ makeText();
28167
+ return that;
28168
+ }
28169
+
28111
28170
  if (style!==false) zim.styleTransforms(this, DS);
28112
28171
  this.clone = function(exact) {
28113
28172
  return that.cloneProps(new zim.TextInput(exact||!zim.isPick(oa[0])?width:oa[0], exact||!zim.isPick(oa[1])?height:oa[1], exact||!zim.isPick(oa[2])?placeholder:oa[2], exact||!zim.isPick(oa[3])?text:oa[3], size, font, exact||!zim.isPick(oa[4])?color:oa[4], exact||!zim.isPick(oa[5])?backgroundColor:oa[5], exact||!zim.isPick(oa[6])?borderColor:oa[6], borderWidth, maxLength, password, selectionColor, selectionAlpha, cursorColor, cursorSpeed, shadowColor, shadowBlur, align, corner, padding, paddingH, paddingV, shiftH, shiftV, scrollBarActive, scrollBarDrag, scrollBarColor, scrollBarAlpha, scrollBarFade, scrollBarH, scrollBarV, readOnly, inputType, rtl, uppercase, placeholderInstant, keyboardShift, style, this.group, inherit));
28114
28173
  };
28115
28174
  };
28116
- zim.extend(zim.TextInput, zim.Window, "clone", "zimWindow", false);
28175
+ zim.extend(zim.TextInput, zim.Window, ["clone","resize"], "zimWindow", false);
28117
28176
 
28118
28177
  // by Cajoek, 2021 - with thanks!
28119
28178
  zim.TextInput.LabelInput = function(text, size, maxLength, password, selectionColor, selectionAlpha, blinkerColor, blinkerSpeed, font, color, rollColor, shadowColor, shadowBlur, align, valign, bold, italic, variant, lineWidth, lineHeight, backing, outlineColor, outlineWidth, backgroundColor, backgroundBorderColor, backgroundBorderWidth, corner, backgroundDashed, padding, paddingH, paddingV, shiftH, shiftV, rollPersist, labelWidth, labelHeight, splitWords, inputType, rtl, uppercase, style, group, inherit) {
@@ -28133,7 +28192,7 @@ zim.TextInput.LabelInput = function(text, size, maxLength, password, selectionCo
28133
28192
  if (inputType == "text" && password) inputType = "password";
28134
28193
  this.hiddenInput.type = inputType;
28135
28194
  if (inputType == "number") {
28136
- this.hiddenInput.pattern = "[^(0-9).\-+*/%$]*";
28195
+ this.hiddenInput.pattern = "[^(0-9).\-+*\/%$]*";
28137
28196
  this.hiddenInput.inputmode = "numeric";
28138
28197
  }
28139
28198
 
@@ -28183,7 +28242,7 @@ zim.TextInput.LabelInput = function(text, size, maxLength, password, selectionCo
28183
28242
  if (uppercase) this.hiddenInput.value = this.hiddenInput.value.toUpperCase();
28184
28243
  var newText = this.hiddenInput.value;
28185
28244
  if (inputType=="number") {
28186
- newText = newText.replace(/[^(0-9).\-+*/%$]*/g,"");
28245
+ newText = newText.replace(/[^(0-9).\-+*\/%$]*/g,"");
28187
28246
  this.hiddenInput.value = newText;
28188
28247
  }
28189
28248
  this.text = this.hiddenInput.type=="password"?newText.replace(/./g, '*'):newText;
@@ -28200,9 +28259,9 @@ zim.TextInput.LabelInput = function(text, size, maxLength, password, selectionCo
28200
28259
  var that = this;
28201
28260
  this.onKeydown = function(e) {
28202
28261
  this.deleteKey = (e.code=="Backspace"||e.code=="Delete");
28203
- this.blinker.replayTween();
28262
+ this.blinker.replayTween();
28204
28263
  setTimeout(function() {
28205
- let keyevt = new CustomEvent("keydown", {detail: e.keyCode}); // need to capture keycode on dispatch
28264
+ var keyevt = new CustomEvent("keydown", {detail: e.keyCode}); // need to capture keycode on dispatch
28206
28265
  that.positionBlinkerAndSelection.call(that);
28207
28266
  that.dispatchEvent(keyevt);
28208
28267
  }, 10);
@@ -28343,17 +28402,17 @@ zim.TextInput.LabelInput = function(text, size, maxLength, password, selectionCo
28343
28402
  var frame;
28344
28403
  this.added(function(stage) {
28345
28404
  frame = stage.frame;
28346
- that.hiddenInput.addEventListener("focus", that.onFocus.bind(that));
28347
- that.hiddenInput.addEventListener("blur", that.onBlur.bind(that));
28405
+ that.zfe = that.hiddenInput.addEventListener("focus", that.onFocus.bind(that));
28406
+ that.zbe = that.hiddenInput.addEventListener("blur", that.onBlur.bind(that));
28348
28407
  });
28349
- this.hiddenInput.addEventListener("input", this.onInput.bind(this));
28350
- this.hiddenInput.addEventListener("select", this.onSelect.bind(this));
28351
- this.hiddenInput.addEventListener("keydown", this.onKeydown.bind(this));
28408
+ that.zie = this.hiddenInput.addEventListener("input", this.onInput.bind(this));
28409
+ that.zse = this.hiddenInput.addEventListener("select", this.onSelect.bind(this));
28410
+ that.zke = this.hiddenInput.addEventListener("keydown", this.onKeydown.bind(this));
28352
28411
  document.body.appendChild(this.hiddenInput);
28353
28412
 
28354
- this.on("mousedown", this.onMousedown.bind(this));
28355
- this.on("pressmove", this.onPressmove.bind(this));
28356
- this.on("dblclick", this.onDblclick.bind(this));
28413
+ that.zme = this.on("mousedown", this.onMousedown.bind(this));
28414
+ that.zpe = this.on("pressmove", this.onPressmove.bind(this));
28415
+ that.zde = this.on("dblclick", this.onDblclick.bind(this));
28357
28416
 
28358
28417
  this.cur("text");
28359
28418
  this.blinker = new zim.Rectangle({width:2, height:1, color:blinkerColor, style:false}).animate({
@@ -28372,13 +28431,27 @@ zim.TextInput.LabelInput = function(text, size, maxLength, password, selectionCo
28372
28431
  this.textHeight = null;
28373
28432
  this.measureText();
28374
28433
 
28434
+ // added ZIM 015
28435
+ this.dispose = function() {
28436
+ if (this.hiddenInput) return;
28437
+ this.hiddenInput.removeEventListener("focus", that.zfe);
28438
+ this.hiddenInput.removeEventListener("blur", that.zbe);
28439
+ this.hiddenInput.removeEventListener("input", that.zie);
28440
+ this.hiddenInput.removeEventListener("select", that.zse);
28441
+ this.hiddenInput.removeEventListener("keydown", that.zke);
28442
+ this.hiddenInput.remove();
28443
+ this.hiddenInput = null;
28444
+ // all events directly on this will be removed in the label dispose with removeAllEventListeners()
28445
+ this.zimLabel_dispose(true);
28446
+ }
28447
+
28375
28448
  }
28376
- zim.extend(zim.TextInput.LabelInput, zim.Label, null, "zimLabel", false);
28449
+ zim.extend(zim.TextInput.LabelInput, zim.Label, "dispose", "zimLabel", false);
28377
28450
  //-54.2
28378
28451
 
28379
28452
 
28380
28453
  /*--
28381
- zim.List = function(width, height, list, viewNum, vertical, currentSelected, align, valign, labelAlign, labelValign, labelIndent, labelIndentH, labelIndentV, indent, spacing, backgroundColor, rollBackgroundColor, downBackgroundColor, selectedBackgroundColor, selectedRollBackgroundColor, backdropColor, color, rollColor, downColor, selectedColor, selectedRollColor, borderColor, borderWidth, padding, corner, swipe, scrollBarActive, scrollBarDrag, scrollBarColor, scrollBarAlpha, scrollBarFade, scrollBarH, scrollBarV, slide, slideFactor, slideSnap, slideSnapDamp, shadowColor, shadowBlur, paddingH, paddingV, scrollWheel, damp, titleBar, titleBarColor, titleBarBackgroundColor, titleBarHeight, draggable, boundary, onTop, close, closeColor, collapse, collapseColor, collapsed, excludeCustomTap, organizer, checkBox, pulldown, clone, cancelCurrentDrag, selectedIndex, noScale, pulldownToggle, optimize, keyEnabled, resizeHandle, resizeBoundary, resizeVisible, continuous, style, group, inherit)
28454
+ zim.List = function(width, height, list, viewNum, vertical, currentSelected, align, valign, labelAlign, labelValign, labelIndent, labelIndentH, labelIndentV, indent, spacing, backgroundColor, rollBackgroundColor, downBackgroundColor, selectedBackgroundColor, selectedRollBackgroundColor, backdropColor, color, rollColor, downColor, selectedColor, selectedRollColor, borderColor, borderWidth, padding, corner, swipe, scrollBarActive, scrollBarDrag, scrollBarColor, scrollBarAlpha, scrollBarFade, scrollBarH, scrollBarV, scrollBarOverlay, slide, slideFactor, slideSnap, slideSnapDamp, shadowColor, shadowBlur, paddingH, paddingV, scrollWheel, damp, titleBar, titleBarColor, titleBarBackgroundColor, titleBarHeight, draggable, boundary, onTop, close, closeColor, collapse, collapseColor, collapsed, excludeCustomTap, organizer, checkBox, pulldown, clone, cancelCurrentDrag, selectedIndex, noScale, pulldownToggle, optimize, keyEnabled, resizeHandle, resizeBoundary, resizeVisible, continuous, style, group, inherit)
28382
28455
 
28383
28456
  List
28384
28457
  zim class - extends a zim.Window which extends a zim.Container which extends a createjs.Container
@@ -28636,6 +28709,8 @@ Each may have a label, min, max, starting val, steps, etc.
28636
28709
  Each has a call parameter for the function to call when the component changes
28637
28710
  There are alternatively obj and property parameters
28638
28711
  Setting these will change the property of the obj to the value of the component
28712
+ Each will be given a call property of the call function
28713
+ This can be changed dynamically if desired.
28639
28714
 
28640
28715
  List.slider(label, min, max, val, call, step, obj, property, paddingLeft, paddingRight, factor, offset, backgroundColor)
28641
28716
  A static method (use it like List.slider("fps", 0, 60, 20, doFps)) to make a slider List item
@@ -29661,6 +29736,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
29661
29736
  var c = new zim.Container(620, 100);
29662
29737
  c.type = "ListItem";
29663
29738
  c.listItem = "Slider";
29739
+ c.call = call;
29664
29740
  if (zot(paddingLeft)) paddingLeft = 20;
29665
29741
  if (zot(paddingRight)) paddingRight = 30;
29666
29742
  if (zot(factor)) factor = 1;
@@ -29678,7 +29754,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
29678
29754
  }).sca(1.5).center(c).mov(20).change(function () {
29679
29755
  c.stepper.currentValue = offset + Math.round(c.slider.currentValue*factor*1000)/1000;
29680
29756
  if (obj && property) obj[property] = c.slider.currentValue;
29681
- if (call && typeof call == 'function') {(call)(c.slider.currentValue, c.parent);}
29757
+ if (c.call && typeof c.call == 'function') {(c.call)(c.slider.currentValue, c.parent);}
29682
29758
  if (c.slider.stage) c.slider.stage.update();
29683
29759
  });
29684
29760
  if (!zot(val)) c.slider.currentValue = val;
@@ -29691,10 +29767,10 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
29691
29767
  max:offset+max*factor,
29692
29768
  step:step
29693
29769
  }).center(c).pos(paddingRight,null,true).change(function () {
29694
- // c.slider.currentValue = c.stepper.currentValue/(factor?factor:1)-offset;
29695
- // if (obj && property) obj[property] = c.slider.currentValue;
29696
- // if (call && typeof call == 'function') {(call)(c.slider.currentValue, c.parent);}
29697
- // if (c.stepper.stage) c.stepper.stage.update();
29770
+ c.slider.currentValue = c.stepper.currentValue/(factor?factor:1)-offset;
29771
+ if (obj && property) obj[property] = c.slider.currentValue;
29772
+ if (c.call && typeof c.call == 'function') {(c.call)(c.slider.currentValue, c.parent);}
29773
+ if (c.stepper.stage) c.stepper.stage.update();
29698
29774
  });
29699
29775
  if (!zot(val)) c.stepper.currentValue = offset+val*factor;
29700
29776
 
@@ -29707,6 +29783,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
29707
29783
  var c = new zim.Container(620, 100);
29708
29784
  c.type = "ListItem";
29709
29785
  c.listItem = "CheckBox";
29786
+ c.call = call;
29710
29787
  if (zot(paddingLeft)) paddingLeft = 20;
29711
29788
  if (zot(paddingRight)) paddingRight = 30;
29712
29789
  zim.List.makeBase(c, label, paddingLeft, backgroundColor);
@@ -29715,7 +29792,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
29715
29792
  label:""
29716
29793
  }).sca(1.2).center(c).pos(256+paddingRight,null,true).change(function () {
29717
29794
  if (obj && property) obj[property] = c.checkBox.checked;
29718
- if (call && typeof call == 'function') {(call)(c.checkBox.checked, c.parent);}
29795
+ if (c.call && typeof c.call == 'function') {(c.call)(c.checkBox.checked, c.parent);}
29719
29796
  if (c.checkBox.stage) c.checkBox.stage.update();
29720
29797
  });
29721
29798
  return c;
@@ -29727,6 +29804,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
29727
29804
  var c = new zim.Container(620, 100);
29728
29805
  c.type = "ListItem";
29729
29806
  c.listItem = "ColorPicker";
29807
+ c.call = call;
29730
29808
  if (zot(paddingLeft)) paddingLeft = 20;
29731
29809
  if (zot(paddingRight)) paddingRight = 30;
29732
29810
  zim.List.makeBase(c, label, paddingLeft, backgroundColor);
@@ -29749,7 +29827,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
29749
29827
  c.colorLabel.text = c.swatch.color.toUpperCase();
29750
29828
  c.colorPicker.hide();
29751
29829
  if (obj && property) obj[property] = c.colorPicker.selectedColor;
29752
- if (call && typeof call == 'function') {(call)(c.colorPicker.selectedColor, c.parent);}
29830
+ if (c.call && typeof c.call == 'function') {(c.call)(c.colorPicker.selectedColor, c.parent);}
29753
29831
  if (stage) stage.update();
29754
29832
  });
29755
29833
  return c;
@@ -37412,7 +37490,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
37412
37490
  if (tkb.label.text.length > 0) {
37413
37491
  if (tkb.na.length === 1) {
37414
37492
  if (data[4] && data[4][tkb.label.text]) tkb.label.text = data[4][tkb.label.text];
37415
- else tkb.label.text = tkb.label.text.toUpperCase();
37493
+ else tkb.label.text = layout=="turkish"?tkb.label.text.toLocaleUpperCase("tr-TR"):tkb.label.text.toUpperCase();
37416
37494
  tkb.label.centerReg(tkb).mov(0, 6);
37417
37495
  } else {
37418
37496
  tkb.label.centerReg(tkb);
@@ -37642,7 +37720,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
37642
37720
  alternativeMenu.y = - size - 5;
37643
37721
  for (var i = 0; i < thisArray.length; i++) {
37644
37722
  if (currentStatus === statuses.shift) {
37645
- thisLetter = thisArray[i].toUpperCase();
37723
+ thisLetter = layout=="turkish"?thisArray[i].toLocaleUpperCase("tr-TR"):thisArray[i].toUpperCase();
37646
37724
  } else {
37647
37725
  thisLetter = thisArray[i];
37648
37726
  }
@@ -37890,7 +37968,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
37890
37968
  makeWidthsArray();
37891
37969
  } else {
37892
37970
  if (currentStatus === statuses.shift) {
37893
- letter = letter.toUpperCase();
37971
+ letter = layout=="turkish"?letter.toLocaleUpperCase("tr-TR"):letter.toUpperCase();
37894
37972
  }
37895
37973
  if (currentLabel && that.maxLength && currentLabel.text.length >= that.maxLength) return;
37896
37974
  if (that.numbersOnly && !isFinite(Number(letter))) return;
@@ -44959,7 +45037,7 @@ const boundary = new Boundary(0,0,W,H).contract(radius);
44959
45037
  circle.drag(boundary); // drag within stage
44960
45038
 
44961
45039
  // or by passing the stage (or a Container as a boundary)
44962
- circle.drag(stage); // drag within stage
45040
+ circle.drag(S); // drag within stage
44963
45041
  END EXAMPLE
44964
45042
 
44965
45043
  EXAMPLE
@@ -45922,7 +46000,7 @@ END EXAMPLE
45922
46000
  EXAMPLE
45923
46001
  const rect = new Rectangle(100, 100, blue, dark)
45924
46002
  .pos(0,70,CENTER)
45925
- .drag(stage);
46003
+ .drag(S);
45926
46004
 
45927
46005
  new Slider({min:0, max:W-100, currentValue:rect.x})
45928
46006
  .pos(0,100,CENTER,BOTTOM)
@@ -46469,6 +46547,7 @@ zim.transform = function(obj, move, stretchX, stretchY, scale, rotate, allowTogg
46469
46547
  if (zot(events)) events = false;
46470
46548
  if (obj.type == "Tag" || obj.type == "TextArea" || obj.type == "Loader") events = true;
46471
46549
 
46550
+ obj.zimMCO = obj.mouseChildren;
46472
46551
  obj.mouseChildren = false;
46473
46552
  var con = obj.getConcatenatedMatrix().decompose();
46474
46553
 
@@ -47333,6 +47412,7 @@ zim.transform = function(obj, move, stretchX, stretchY, scale, rotate, allowTogg
47333
47412
  disable:function() {
47334
47413
  controls.mouseChildren = false;
47335
47414
  controls.mouseEnabled = false;
47415
+ obj.mouseChildren = obj.zimMCO;
47336
47416
  if (move) {
47337
47417
  obj.noDrag();
47338
47418
  obj.off("pressmove", pressmoveEvent);
@@ -47341,6 +47421,7 @@ zim.transform = function(obj, move, stretchX, stretchY, scale, rotate, allowTogg
47341
47421
  enable:function() {
47342
47422
  controls.mouseChildren = true;
47343
47423
  controls.mouseEnabled = true;
47424
+ obj.mouseChildren = false;
47344
47425
  if (move) {
47345
47426
  obj.drag({overCursor:"pointer", dragCursor:"pointer", onTop:false, removeTweens:false});
47346
47427
  pressmoveEvent = obj.on("pressmove", pressmoveEvent);
@@ -47428,6 +47509,7 @@ zim.transform = function(obj, move, stretchX, stretchY, scale, rotate, allowTogg
47428
47509
  dispose:function() {
47429
47510
  obj.transformControls.hide();
47430
47511
  allowToggle = false;
47512
+ obj.mouseChildren = obj.zimMCO;
47431
47513
  if (move) {
47432
47514
  obj.noDrag();
47433
47515
  obj.off("pressmove", pressmoveEvent);
@@ -49521,6 +49603,8 @@ clean - (default true) set to false to not delete animation ids etc. at end of a
49521
49603
  Note... once tween has waited, percentComplete does not include wait period
49522
49604
  So clean cannot be used to restart an animation with a wait after the animation has waited
49523
49605
  Use the replayTween() method of the target to restart the latest animation on a target
49606
+ NOTE: clean will be set to true if loop is true (even if loopCount is set)
49607
+ So to scrub after a loopCount of 2 then remake the animate() in the call callback with a pauseAnimate()
49524
49608
  obj - (depreciated) the old version of props - kept for backwards compatibility
49525
49609
  seriesWait - (internal) used internally to hold setting relative values in correct series order
49526
49610
  sequenceWait - (internal) used internally to tie sequence in to the animation chain for pauseAnimate and stopAnimate
@@ -49868,7 +49952,7 @@ RETURNS the target for chaining (or null if no target is provided and run on zim
49868
49952
 
49869
49953
  var tween;
49870
49954
  var idSet;
49871
- var providedID;
49955
+ var providedID;
49872
49956
 
49873
49957
  // ANIMATION SERIES HANDLING
49874
49958
  // if an array is passed in to animate() as the obj
@@ -49907,6 +49991,24 @@ RETURNS the target for chaining (or null if no target is provided and run on zim
49907
49991
  if (zot(o.time)) o.time = t;
49908
49992
  w += (o.wait?o.wait:0);
49909
49993
  duration = o.time;
49994
+
49995
+ if (animateCall) {
49996
+ if (o.animateCall) {
49997
+ -function() {
49998
+ var originalCall = o.animateCall;
49999
+ var originalParams = o.animateParams;
50000
+ var generalCall = animateCall;
50001
+ var generalParams = animateParams;
50002
+ o.animateCall = function(target) {
50003
+ originalCall(originalParams||target);
50004
+ generalCall(generalParams||target);
50005
+ }
50006
+ }();
50007
+ } else {
50008
+ o.animateCall = animateCall;
50009
+ o.animateParams = animateParams;
50010
+ }
50011
+ }
49910
50012
 
49911
50013
  durationRewind = (zot(o.rewindTime)?duration:o.rewindTime);
49912
50014
  if (o.rewind) duration = duration + durationRewind + (o.rewindWait?o.rewindWait:0);
@@ -49952,7 +50054,8 @@ RETURNS the target for chaining (or null if no target is provided and run on zim
49952
50054
  pauseOnBlur:o.pauseOnBlur,
49953
50055
  easeAmount:o.easeAmount, easeFrequency:o.easeFrequency,
49954
50056
  override:false,
49955
- id:id
50057
+ id:id,
50058
+ clean:(loop||o.loop)?true:clean // need to clean if looping
49956
50059
  };
49957
50060
  if (i == obj.length-1) {
49958
50061
  endSeries(currentObj);
@@ -49966,14 +50069,14 @@ RETURNS the target for chaining (or null if no target is provided and run on zim
49966
50069
  var savedCall = currentObj.call;
49967
50070
  var savedParams = currentObj.params;
49968
50071
  if (cjsProps.loop && (!cjsProps.count || currentCount < cjsProps.count)) {
49969
- currentObj.call = function() {
50072
+ currentObj.call = function() {
49970
50073
  if (savedCall && typeof savedCall == 'function') {(savedCall)(savedParams||target);}
49971
50074
  if (cjsProps.loopCall && typeof cjsProps.loopCall == 'function') {(cjsProps.loopCall)(cjsProps.loopParams||target);}
49972
50075
  if (cjsProps.loopWait) {
49973
50076
  if (zot(target.zimTweens)) target.zimTweens = {};
49974
50077
  tween = target.zimTweens[id] = target.zimTween = createjs.Tween.get(target, {override:cjsProps.override}).wait(cjsProps.loopWait, true).call(goNext);
49975
50078
  tween.timeScale = target.futureRate;
49976
- } else {
50079
+ } else {
49977
50080
  goNext();
49978
50081
  }
49979
50082
  function goNext() {
@@ -50159,7 +50262,7 @@ RETURNS the target for chaining (or null if no target is provided and run on zim
50159
50262
 
50160
50263
  if (zot(target)) return;
50161
50264
  if (!target.tweenStates) target.tweenStates = {all:true};
50162
-
50265
+
50163
50266
  var fromCheck = false;
50164
50267
 
50165
50268
 
@@ -50307,7 +50410,6 @@ RETURNS the target for chaining (or null if no target is provided and run on zim
50307
50410
  target.resetTween(false);
50308
50411
  return target;
50309
50412
  };
50310
-
50311
50413
  if (obj.path || dynamic) {
50312
50414
  // can't risk turning percentComplete off when animation ends as only one per all animations
50313
50415
  // instead, evaluate how percentComplete is set when starting an animation
@@ -50487,7 +50589,7 @@ RETURNS the target for chaining (or null if no target is provided and run on zim
50487
50589
  relativeAdjust();
50488
50590
  if (from && !fromCheck) obj = getFroms(target, obj, set, true);
50489
50591
  }
50490
-
50592
+
50491
50593
  function relativeAdjust() {
50492
50594
  var newStart;
50493
50595
  if (!target.zimLastObj) target.zimLastObj = {};
@@ -50531,11 +50633,12 @@ RETURNS the target for chaining (or null if no target is provided and run on zim
50531
50633
  // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
50532
50634
 
50533
50635
  // PERCENT COMPLETE SETUP
50534
- if (target.getBounds && zot(target.percentCompleteCheck)) {
50636
+ // if (target.getBounds && zot(target.percentCompleteCheck)) {
50637
+ if (zot(target.percentCompleteCheck)) {
50535
50638
  target.percentCompleteCheck = true;
50536
50639
  target._percentComplete = 0;
50537
50640
  Object.defineProperty(target, 'percentComplete', {
50538
- get: function() {
50641
+ get: function() {
50539
50642
  if (target.paused) return target._percentComplete;
50540
50643
  if (target.tweenStartTime && target.tweenEndTime) {
50541
50644
  // return if paused and however long is paused gets added to target.tweenStartTime and target.tweenEndTime
@@ -50552,7 +50655,7 @@ RETURNS the target for chaining (or null if no target is provided and run on zim
50552
50655
  nt = dn - target.tweenStartTime;
50553
50656
  }
50554
50657
  var v = Math.max(0, Math.min(100, nt / (target.tweenEndTime - target.tweenStartTime) * 100));
50555
- target._percentComplete = v;
50658
+ target._percentComplete = v;
50556
50659
  return v;
50557
50660
  } else {
50558
50661
  return 0;
@@ -50566,10 +50669,12 @@ RETURNS the target for chaining (or null if no target is provided and run on zim
50566
50669
  } else {
50567
50670
  // to handle being set prior to a subsequent animation
50568
50671
  this.requestedPercentComplete = value;
50569
- }
50672
+ }
50570
50673
  target._percentComplete = value;
50674
+ if (animateCall && typeof animateCall == "function") animateCall(animateParams||target);
50571
50675
  }
50572
50676
  });
50677
+
50573
50678
 
50574
50679
  Object.defineProperty(target, 'percentCompleteNoAngle', {
50575
50680
  get: function() {
@@ -50615,32 +50720,12 @@ RETURNS the target for chaining (or null if no target is provided and run on zim
50615
50720
  configurable: true // not sure why we need to?
50616
50721
  });
50617
50722
 
50618
-
50619
- // if (target.paused) return target._percentComplete;
50620
- // if (target.tweenStartTime && target.tweenEndTime) {
50621
- // // return if paused and however long is paused gets added to target.tweenStartTime and target.tweenEndTime
50622
- // // but then how does this affect the timeline?
50623
- // // maybe target.percentComplete is always based on time and it ignores pause
50624
- // // whereas tween.percentComplete is based on the animation
50625
- // // maybe target.percentComplete should be percentTime
50626
- // var dn = Date.now();
50627
- // var nt;
50628
- // // loop is based on latest tween set
50629
- // if (cjsProps.loop && dn > target.tweenEndTime) {
50630
- // nt = (dn - target.tweenStartTime) % (target.tweenEndTime - target.tweenStartTime);
50631
- // } else {
50632
- // nt = dn - target.tweenStartTime;
50633
- // }
50634
- // var v = Math.max(0, Math.min(100, nt / (target.tweenEndTime - target.tweenStartTime) * 100));
50635
- // target._percentComplete = v;
50636
- // return v;
50637
-
50638
-
50639
50723
  function setPercent(value, setAngle) {
50640
- target.zimTween.startPaused = false;
50724
+ target.zimTween.startPaused = false;
50641
50725
  // if (!this.paused) this.pauseAnimate(true, id);
50642
50726
  if (!dynamic) {
50643
- if (target.zimTweens) {
50727
+
50728
+ if (target.zimTweens) {
50644
50729
  zim.loop(target.zimTweens, function(id,tw,i) {
50645
50730
  var tim = target.tweenStartTime + (target.tweenEndTime - target.tweenStartTime) * value / 100;
50646
50731
  var nt;
@@ -50650,9 +50735,10 @@ RETURNS the target for chaining (or null if no target is provided and run on zim
50650
50735
  nt = (tim - tw.startTime) % tw.duration;
50651
50736
  } else {
50652
50737
  nt = tim - tw.startTime;
50653
- }
50738
+ }
50654
50739
  tw.percentComplete = Math.max(0, Math.min(100, nt/tw.duration * 100));
50655
- });
50740
+ });
50741
+
50656
50742
  } else {
50657
50743
  target.zimTween.setPosition(Math.round(value*target.zimTween.duration/100));
50658
50744
  }
@@ -50855,7 +50941,7 @@ RETURNS the target for chaining (or null if no target is provided and run on zim
50855
50941
  // 10.6.0 patch to turn move target along path if not animating
50856
50942
  target.zimAnimatePathDown = pathObject.on("mousedown", function() {pathDownCheck=true; if (target.paused==true) mouseCheck = true;});
50857
50943
  target.zimAnimatePathUp = pathObject.on("pressup", function() {mouseCheck = false;});
50858
-
50944
+
50859
50945
 
50860
50946
  target.zimAnimateDragDown = target.on("mousedown", function (e) {
50861
50947
  stage = e.target.stage;
@@ -51024,9 +51110,9 @@ RETURNS the target for chaining (or null if no target is provided and run on zim
51024
51110
 
51025
51111
  // FLIP SETUP
51026
51112
  var startFlip = target.scaleX,
51027
- startFlipVertical = target.scaleY,
51028
- pathFlip = obj.flip != undefined ? obj.flip : false,
51029
- pathFlipVertical = obj.flipVertical != undefined ? obj.flipVertical : false;
51113
+ startFlipVertical = target.scaleY,
51114
+ pathFlip = obj.flip != undefined ? obj.flip : false,
51115
+ pathFlipVertical = obj.flipVertical != undefined ? obj.flipVertical : false;
51030
51116
 
51031
51117
  var lastX=target.x;
51032
51118
  var lastY=target.y;
@@ -51340,7 +51426,7 @@ RETURNS the target for chaining (or null if no target is provided and run on zim
51340
51426
  }
51341
51427
 
51342
51428
  function preTween1(lastTween) {
51343
- prepareRelative2();
51429
+ prepareRelative2();
51344
51430
  if (wait>0) {
51345
51431
  target.waiting = true;
51346
51432
  tween = target.zimTweens[id] = target.zimTween = createjs.Tween.get(target, {override:cjsProps.override}).wait(wait, true).call(function(){
@@ -51480,10 +51566,9 @@ RETURNS the target for chaining (or null if no target is provided and run on zim
51480
51566
 
51481
51567
  } else { // NOT REWIND TWEENS
51482
51568
 
51483
-
51484
51569
  if (seriesWait > 0 || sequenceWait > 0 || wait > 0) { // do not want wait as part of future loops (use loopWait)
51485
51570
 
51486
- if (seriesWait > 0 || sequenceWait > 0) {
51571
+ if (seriesWait > 0 || sequenceWait > 0) {
51487
51572
  target.waiting = true;
51488
51573
  tween = target.zimTweens[id] = target.zimTween = createjs.Tween.get(target, {override:cjsProps.override})
51489
51574
  .wait(seriesWait>0?seriesWait:0, true)
@@ -51801,7 +51886,9 @@ RETURNS the target for chaining (or null if no target is provided and run on zim
51801
51886
  if (target.seriesCalls) target.seriesCalls.shift();
51802
51887
  if (target.seriesParams) target.seriesParams.shift();
51803
51888
  if (target.paused && target.type != "Sprite") {
51804
- if (call && typeof call == 'function') {(call)(params);}
51889
+ // ZIM 015 - not sure why we want to call this when paused
51890
+ // as it activates the animation if in series
51891
+ // if (call && typeof call == 'function') {(call)(params);}
51805
51892
  return;
51806
51893
  }
51807
51894
  if (cjsProps.loop) {
@@ -51824,8 +51911,18 @@ RETURNS the target for chaining (or null if no target is provided and run on zim
51824
51911
  return;
51825
51912
  }
51826
51913
  }
51914
+
51915
+ // ZIM 015 - this was the first thing we tried to scrub a series with percentComplete
51916
+ // there were lots of other things too to make it work.
51917
+ // Leaving the seriesTween test in here... but probably not doing much
51827
51918
  if (clean) endTween(id);
51828
- else target.pauseAnimate(true, id);
51919
+ else {
51920
+ if (target.seriesTweens) {
51921
+ if (target.seriesTweens.length == 0) target.pauseAnimate(true, id);
51922
+ } else {
51923
+ target.pauseAnimate(true, id);
51924
+ }
51925
+ }
51829
51926
 
51830
51927
  // calling sequenceCall in loop as well so don't call here if looping - ZIM Cat 03
51831
51928
  if (!cjsProps.loop && sequenceCall && typeof sequenceCall == 'function') {
@@ -51975,29 +52072,20 @@ RETURNS the target for chaining (or null if no target is provided and run on zim
51975
52072
  }();
51976
52073
  }
51977
52074
  function pauseTicker(id, paused) {
52075
+
51978
52076
  var tween = target.zimTweens[id];
51979
52077
  tween.paused = paused;
51980
- if (paused == tween.zimPaused) return;
52078
+ if (paused == tween.zimPaused) return;
51981
52079
  tween.zimPaused = paused;
51982
- if (paused) {
51983
- target.zimPauseTime=Date.now();
52080
+
52081
+ if (paused) {
51984
52082
  if (tween.zimTicker) tween.zimAnimateTimeout = setTimeout(function(){zim.Ticker.remove(tween.zimTicker);},200);
51985
52083
  // if (target.zimZoomTicker) zim.Ticker.remove(target.zimZoomTicker);
51986
- } else {
52084
+ } else {
51987
52085
  tween.startPaused = false;
51988
- clearTimeout(tween.zimAnimateTimeout);
51989
- if (target.zimPauseTime) {
51990
- var nt = Date.now();
51991
- target.tweenStartTime+=(nt-target.zimPauseTime);
51992
- target.tweenEndTime+=(nt-target.zimPauseTime);
51993
- if (target.zimTweens) {
51994
- zim.loop(target.zimTweens, function(id,tw,i) {
51995
- tw.startTime+=(nt-target.zimPauseTime);
51996
- });
51997
- }
51998
- }
52086
+ clearTimeout(tween.zimAnimateTimeout);
51999
52087
  if (tween.zimTicker) tween.zimTicker = zim.Ticker.add(tween.zimTicker, stage);
52000
- if (target.zimZoomTicker) target.zimZoomTicker = zim.Ticker.add(target.zimZoomTicker, stage);
52088
+ // if (target.zimZoomTicker) target.zimZoomTicker = zim.Ticker.add(target.zimZoomTicker, stage);
52001
52089
  }
52002
52090
  }
52003
52091
  function expandIds(ids) {
@@ -52093,7 +52181,8 @@ RETURNS the target for chaining (or null if no target is provided and run on zim
52093
52181
  return target;
52094
52182
  };
52095
52183
  target.stopAnimate.real = true; // record this as real method instead of empty method
52096
- target.pauseAnimate = function(paused, ids, include, ignoreDynamic) {
52184
+ target.pauseAnimate = function(paused, ids, include, ignoreDynamic) {
52185
+ if (paused!==false) target.percentComplete; // run the percentComplete before setting pause
52097
52186
  var id;
52098
52187
  if (ids=="pauseOnBlur") {
52099
52188
  ids = null;
@@ -72245,7 +72334,7 @@ warm - (default null) set true to make particles ahead of time to look like the
72245
72334
  decayTime - (default 1) time in seconds to fade and / or shrink the particle - ends animation at the life time unless decayStart is set
72246
72335
  decayStart - (default null) time in seconds to start the decayTime otherwise decay (fade and shrink) ends at the end of life time
72247
72336
  trace - (default false) Boolean set to true to leave trails by caching each particle with source-over composite operation
72248
- traceFadeTime - (default decayTime) time in ms to fade out traced particle to 0 alpha at the end of the particle life time
72337
+ traceFadeTime - (default decayTime) time in s to fade out traced particle to 0 alpha at the end of the particle life time
72249
72338
  traceShiftX - (default 0) x amount to shift the cache rectangle for the traced particle
72250
72339
  traceShiftY - (default 0) y amount to shift the cache rectangle for the traced particle
72251
72340
  the particle starts centered in the width and height of the Emitter container
@@ -75634,7 +75723,11 @@ dispatches a "ready" event when the sound source is connected and the calculate(
75634
75723
  var audio,source;
75635
75724
  if (input.playbackResource) {
75636
75725
  audio = input.playbackResource; // a playing zim.asset("somesound").play()
75637
- source = audioContext.createMediaElementSource(audio);
75726
+ if (audio.mediaSourceNode) {
75727
+ source = audio.mediaSourceNode;
75728
+ } else {
75729
+ source = audioContext.createMediaElementSource(audio);
75730
+ }
75638
75731
  } else {
75639
75732
  audio = input; // a playing <audio> tag zid("soundTagID").play()
75640
75733
  source = audioContext.createMediaElementSource(audio);
@@ -78325,6 +78418,7 @@ shiftKey - true if the shift key is being pressed otherwise false
78325
78418
  loadFailObj - the object that shows if images are broken - will be given a type property of "EmptyAsset"
78326
78419
  startTime - datestamp of when frame was made - used internally
78327
78420
  retina - read-only Boolean as to whether stage (as opposed to the canvas) was scaled for pixelDensity during Frame creation
78421
+ reloaded - read-only Boolean as to whether page has been reloaded - uses window.performance.getEntriesByType
78328
78422
 
78329
78423
  ALSO see F, S, W, H, M global variables which reference the default frame, its stage and width and height, and if on mobile
78330
78424
 
@@ -78428,6 +78522,8 @@ zim.Frame = function(scaling, width, height, color, outerColor, ready, assets, p
78428
78522
  var D=Date;
78429
78523
  this.startTime = new D().getTime();
78430
78524
 
78525
+ F.reloaded = (WW.performance && WW.performance.getEntriesByType && WW.performance.getEntriesByType("navigation")[0].type === "reload")
78526
+
78431
78527
  if (zot(canvasCheck)) canvasCheck = true;
78432
78528
  var canvasSupported = !!WW.HTMLCanvasElement;
78433
78529
  if (!canvasSupported && canvasCheck) { // no canvas support
@@ -82628,7 +82724,9 @@ RETURNS - null
82628
82724
  callback(bitmap, params);
82629
82725
  DOMURL.revokeObjectURL(obu);
82630
82726
  };
82631
- var obu = DOMURL.createObjectURL(new document.Blob([svgString], {type: "image/svg+xml"}));
82727
+ var obu;
82728
+ if (document && document.Blob) obu = DOMURL.createObjectURL(new document.Blob([svgString], {type: "image/svg+xml"}));
82729
+ else obu = DOMURL.createObjectURL(new Blob([svgString], {type: "image/svg+xml"}));
82632
82730
  img.src = obu;
82633
82731
  };//-83.27
82634
82732
 
@@ -85147,6 +85245,7 @@ setColor(tile, color) - set the color of a tile
85147
85245
  for setting items on the board use add() method
85148
85246
  for setting items off the board or for setting the info
85149
85247
  use board.info[j][j] = {data:data, color:color, items:[item, item, etc.]}
85248
+ setIcon(tile, icon) - set the icon for the tile - also see icons parameter
85150
85249
  clearInfo(filter**) - clear all the info or a filtered set - see **FILTER at top of METHODS
85151
85250
  clearData(filter**) - clear all the info data or a filtered set - see **FILTER at top of METHODS
85152
85251
  clearColors(filter**) - clear all the colors (to default color) or a filtered set - see **FILTER at top of METHODS
@@ -85399,7 +85498,7 @@ END EXAMPLE
85399
85498
 
85400
85499
  PARAMETERS supports DUO - parameters or single object with properties below
85401
85500
  time - (default 60) time in seconds to start the timer
85402
- step - (default 1000) step in ms to show a change in timer
85501
+ step - (default 1) step in s to show a change in timer
85403
85502
  colon - (default false) add colon and seconds eg. 1:30 instead of 90 seconds
85404
85503
  down - (default true) set to false to count up
85405
85504
  isometric - (default null) set to LEFT or RIGHT to position an isometric timer
@@ -86197,7 +86296,8 @@ Socket
86197
86296
  zim class extends a zim EventDispatcher (with the normal event object replaced by a data param)
86198
86297
  ** MUST import socket.io.js with a script tag - SEE link at top of Docs for socket.io.js under ZIM works with...
86199
86298
  ** MUST import zim_socket - see https://zimjs.com/es6.html#MODULES
86200
- ** MUST have a NodeJS server running zimserver.js with SocketIO on server (and client as mentioned)
86299
+ ** MUST request a ZIM Socket Server ID or have a NodeJS server running zimserver.js with SocketIO on server (and client as mentioned)
86300
+ ** MUST test on a server to avoid CORS errors
86201
86301
  See: https://zimjs.com/es6.html#MODULES
86202
86302
 
86203
86303
  OVERVIEW
@@ -86250,7 +86350,7 @@ const socket = new Socket(zimSocketURL, "sharedball");
86250
86350
  // There is also a history of any data stored in history - like for a chat.
86251
86351
 
86252
86352
  socket.on("ready", ()=>{
86253
- const ball = new Circle(100, red).drag(stage);
86353
+ const ball = new Circle(100, red).drag(S);
86254
86354
 
86255
86355
  // We will get the lastest x and y of the ball
86256
86356
  // all latest values are automatically loaded by Socket to start
@@ -87638,7 +87738,6 @@ for (z_i = 0; z_i < globalFunctions.length; z_i++) {
87638
87738
  WW[pair[0]] = zim[pair[0]] = pair[1];
87639
87739
  }
87640
87740
 
87641
-
87642
87741
  // these are global regardless
87643
87742
  var globalsConstants = [
87644
87743
  ["FIT", zim.FIT],