zimjs 19.1.5 → 19.1.6

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 +343 -151
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zimjs",
3
- "version": "19.1.5",
3
+ "version": "19.1.6",
4
4
  "type": "module",
5
5
  "main": "./src/zim.js",
6
6
  "types": "./ts-src/typings/zim",
package/src/zim.js CHANGED
@@ -17681,6 +17681,7 @@ addPoint(percent, controlType) - add a point at a percent (100) of the total cur
17681
17681
  controlType can be as specified in main points parameter
17682
17682
  returns index of new point
17683
17683
  addPoints(num, controlType, startPoint, spread, dataOnly, points, even) - add num points between existing points
17684
+ accepts ZIM DUO normal parameters or configuration object literal with parameter names as propterties
17684
17685
  controlType can be as specified in main points parameter
17685
17686
  specify a startPoint to add points between the startPoint and the next point (one segment of points)
17686
17687
  spread (default false) set to true to spread points evenly around path rather than evenly between segments
@@ -19580,6 +19581,8 @@ Note the points property has been split into points and pointObjects (and there
19580
19581
  }
19581
19582
 
19582
19583
  this.addPoints = function(num, controlType, startPoint, spread, dataOnly, points, even) {
19584
+ var sig = "num, controlType, startPoint, spread, dataOnly, points, even";
19585
+ var duo; if (duo = zob(that.addPoints, arguments, sig)) return duo;
19583
19586
  if (zot(points)) points = zim.copy(that.points);
19584
19587
  var ratios = zim.copy(that.segmentRatios);
19585
19588
  var lastRatio = 0;
@@ -19869,6 +19872,7 @@ addPoint(percent, controlType) - add a point at a percent (100) of the total cur
19869
19872
  controlType can be as specified in main points parameter
19870
19873
  returns index of new point
19871
19874
  addPoints(num, controlType, startPoint, spread, dataOnly, points, even) - add num points between existing points
19875
+ accepts ZIM DUO normal parameters or configuration object literal with parameter names as propterties
19872
19876
  controlType can be as specified in main points parameter
19873
19877
  specify a startPoint to add points between the startPoint and the next point (one segment of points)
19874
19878
  spread (default false) set to true to spread points evenly around path rather than evenly between segments
@@ -21920,6 +21924,8 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
21920
21924
  }
21921
21925
 
21922
21926
  this.addPoints = function(num, controlType, startPoint, spread, dataOnly, points, even) {
21927
+ var sig = "num, controlType, startPoint, spread, dataOnly, points, even";
21928
+ var duo; if (duo = zob(that.addPoints, arguments, sig)) return duo;
21923
21929
  if (zot(points)) points = zim.copy(that.points);
21924
21930
  var ratios = zim.copy(that.segmentRatios);
21925
21931
  var lastRatio = 0;
@@ -24186,7 +24192,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
24186
24192
  fitText();
24187
24193
  }
24188
24194
 
24189
- function fitText() {
24195
+ function fitText() {
24190
24196
  that.size = maxSize?maxSize:200;
24191
24197
  var count = 0;
24192
24198
  while(lineHeight < lH / 2 && (that.height > lH || that.width > lW)) {
@@ -32858,7 +32864,7 @@ borderColor - |ZIM VEE| (default null) the background stroke color
32858
32864
  borderWidth - (default null) thickness of the background border
32859
32865
  maxLength - (default null) set to limit the number of characters in the field
32860
32866
  password - (default false) set to true to show **** for text to hide password
32861
- this will be replaced by inputType in upcoming versions of ZIM
32867
+ see also inputType
32862
32868
  selectionColor - (default color) the selection color of the text
32863
32869
  selectionAlpha - (default .2) the alpha of the selection color
32864
32870
  cursorColor - (default color) the blinking cursor in the text
@@ -32888,7 +32894,7 @@ scrollBarV - (default true) if scrolling in vertical is needed then show scrollB
32888
32894
  readOnly - (default false) set to true for field to be readOnly - also see readOnly property
32889
32895
  inputType - (default "text") set to "text", "number", "password", "email"
32890
32896
  number has 0-9 . + - / * % $ available
32891
- this will replace the password parameter in upcoming versions of ZIM
32897
+ see also password for password setting
32892
32898
  rtl - (default ZIM DIR) the direction of the text. Also set "rtl" in the HTML tag dir parameter for RTL
32893
32899
  uppercase - (default false) set to true to force uppercase letters
32894
32900
  placeholderInstant - (default true) set to false to not remove the placeholder as soon as the cursor is in the field
@@ -33264,7 +33270,7 @@ zim.TextInput = function(width, height, placeholder, text, size, font, color, ba
33264
33270
  blinker.oldX = blinkerX; // get previous blinker global x.
33265
33271
  // end Pettis Brandon code '23
33266
33272
 
33267
- if (that.stage) that.stage.update();
33273
+ if ((!zim.OPTIMIZE&&(zns||!WW.OPTIMIZE)) && that.stage) that.stage.update();
33268
33274
  }, null, null, null, null, mID);
33269
33275
 
33270
33276
  if (pastText != null) {
@@ -33327,11 +33333,11 @@ zim.TextInput = function(width, height, placeholder, text, size, font, color, ba
33327
33333
  function doPlaceholder() {
33328
33334
  if (label.text != "" && that.placeholderLabel.parent) {
33329
33335
  that.placeholderLabel.removeFrom();
33330
- if (that.stage) that.stage.update();
33336
+ if ((!zim.OPTIMIZE&&(zns||!WW.OPTIMIZE)) && that.stage) that.stage.update();
33331
33337
  }
33332
33338
  if (label.text == "" && !that.placeholderLabel.parent) {
33333
33339
  that.add(that.placeholderLabel);
33334
- if (that.stage) that.stage.update();
33340
+ if ((!zim.OPTIMIZE&&(zns||!WW.OPTIMIZE)) && that.stage) that.stage.update();
33335
33341
  }
33336
33342
  }
33337
33343
 
@@ -33492,7 +33498,7 @@ zim.TextInput.LabelInput = function(text, size, maxLength, password, selectionCo
33492
33498
  this.hiddenInput.autocorrect = "off";
33493
33499
  this.hiddenInput.autocomplete = "off";
33494
33500
  this.hiddenInput.spellcheck = false;
33495
- this.hiddenInput.style.position = "absolute";
33501
+ this.hiddenInput.style.position = "fixed"; // changed from "absolute" in ZIM 019 to fix iOS bug
33496
33502
  this.hiddenInput.style.overflow = "hidden";
33497
33503
  this.hiddenInput.style.touchAction = "none";
33498
33504
 
@@ -33506,6 +33512,9 @@ zim.TextInput.LabelInput = function(text, size, maxLength, password, selectionCo
33506
33512
 
33507
33513
  this.hiddenInput.style.left = "-99999px";
33508
33514
  this.hiddenInput.style.top = "-99999px";
33515
+ // this.hiddenInput.style.left = "10px";
33516
+ // this.hiddenInput.style.top = "10px";
33517
+
33509
33518
  this.hiddenInput.style.zIndex = -999;
33510
33519
  this.hiddenInput.style.opacity = 0;
33511
33520
  this.hiddenInput.style.width = "1px";
@@ -33523,6 +33532,7 @@ zim.TextInput.LabelInput = function(text, size, maxLength, password, selectionCo
33523
33532
  this.selection.alp(0.2);
33524
33533
  this.positionBlinkerAndSelection();
33525
33534
  this.dispatchEvent("focus");
33535
+ if (that.stage) that.stage.update();
33526
33536
  }
33527
33537
  this.onBlur = function() {
33528
33538
  if (this.stage) frame = this.stage.frame;
@@ -33532,6 +33542,7 @@ zim.TextInput.LabelInput = function(text, size, maxLength, password, selectionCo
33532
33542
  this.selection.alp(0.0);
33533
33543
  this.hiddenInput.type = inputType; // ZIM NFT 00 patch
33534
33544
  this.dispatchEvent("blur");
33545
+ if (that.stage) that.stage.update();
33535
33546
  }
33536
33547
  this.onInput = function(e, noEvent) {
33537
33548
  if (uppercase) this.hiddenInput.value = this.hiddenInput.value.toUpperCase();
@@ -33552,6 +33563,7 @@ zim.TextInput.LabelInput = function(text, size, maxLength, password, selectionCo
33552
33563
  if (this.focus) {
33553
33564
  this.blinker.replayTween();
33554
33565
  }
33566
+ if (that.stage) that.stage.update();
33555
33567
  }
33556
33568
  this.onKeydown = function(e) {
33557
33569
  this.deleteKey = (e.code=="Backspace"||e.code=="Delete");
@@ -33561,6 +33573,7 @@ zim.TextInput.LabelInput = function(text, size, maxLength, password, selectionCo
33561
33573
  that.positionBlinkerAndSelection.call(that);
33562
33574
  // that.dispatchEvent(keyevt);
33563
33575
  that.dispatchEvent(e);
33576
+ if (that.stage) that.stage.update();
33564
33577
  }, 10);
33565
33578
  }
33566
33579
  this.onMousedown = function(e) {
@@ -33576,7 +33589,8 @@ zim.TextInput.LabelInput = function(text, size, maxLength, password, selectionCo
33576
33589
  var selectionIdx = this.mapPointToIndex(point);
33577
33590
  if (rtl) this.hiddenInput.setSelectionRange(le-selectionIdx, le-selectionIdx);
33578
33591
  else this.hiddenInput.setSelectionRange(selectionIdx, selectionIdx);
33579
- this.positionBlinkerAndSelection();
33592
+ this.positionBlinkerAndSelection();
33593
+ if (that.stage) that.stage.update();
33580
33594
  }
33581
33595
  this.onPressmove = function(e) {
33582
33596
  // ZIM NFT 01 Patch any le or rtl
@@ -33598,18 +33612,20 @@ zim.TextInput.LabelInput = function(text, size, maxLength, password, selectionCo
33598
33612
  } else {
33599
33613
  this.hiddenInput.setSelectionRange(selectionIdx, this.hiddenInput.selectionEnd, rtl?"forward":"backward");
33600
33614
  }
33601
- }
33602
-
33615
+ }
33603
33616
  this.positionBlinkerAndSelection();
33617
+ if (that.stage) that.stage.update();
33604
33618
  }
33605
33619
  this.onDblclick = function() {
33606
33620
  this.hiddenInput.select();
33607
33621
  this.positionBlinkerAndSelection();
33622
+ if (that.stage) that.stage.update();
33608
33623
  }
33609
33624
  this.hiddenInput.addEventListener("paste", function() {
33610
33625
  setTimeout(function() {
33611
33626
  that.hiddenInput.setSelectionRange(that.hiddenInput.selectionStart, that.hiddenInput.selectionEnd, rtl?"forward":"backward");
33612
33627
  // setTimeout(function() {that.positionBlinkerAndSelection()}, 50);
33628
+ if (that.stage) that.stage.update();
33613
33629
  }, 50);
33614
33630
  });
33615
33631
  this.positionBlinkerAndSelection = function() {
@@ -33645,7 +33661,7 @@ zim.TextInput.LabelInput = function(text, size, maxLength, password, selectionCo
33645
33661
  this.blinker.pos(this.textWidthArray[xIdx] + paddingH - 1 + ((align=="right" && this.text == "")?this.width:(align=="center" && this.text == "")?this.width/2:0) + shiftH, paddingV+shiftV);
33646
33662
  this.dispatchEvent("blinker");
33647
33663
  }
33648
- if (this.stage) this.stage.update();
33664
+ // if ((!zim.OPTIMIZE&&(zns||!WW.OPTIMIZE)) && this.stage) this.stage.update();
33649
33665
  }
33650
33666
  this.eventPositionGlobalToLocal = function(e) {
33651
33667
  var point = this.globalToLocal(e.stageX / zim.scaX, e.stageY / zim.scaY);
@@ -33691,6 +33707,7 @@ zim.TextInput.LabelInput = function(text, size, maxLength, password, selectionCo
33691
33707
  if (uppercase) text = text.toUpperCase();
33692
33708
  this.hiddenInput.value = text;
33693
33709
  this.onInput(null, noEvent);
33710
+ if ((!zim.OPTIMIZE&&(zns||!WW.OPTIMIZE)) && that.stage) that.stage.update();
33694
33711
  }
33695
33712
  Object.defineProperty(this, 'focus', {
33696
33713
  get: function() {
@@ -33704,7 +33721,9 @@ zim.TextInput.LabelInput = function(text, size, maxLength, password, selectionCo
33704
33721
  this.positionBlinkerAndSelection();
33705
33722
  } else {
33706
33723
  that.hiddenInput.blur();
33707
- }
33724
+ if (that.stage) that.stage.update();
33725
+ }
33726
+ if ((!zim.OPTIMIZE&&(zns||!WW.OPTIMIZE)) && that.stage) that.stage.update();
33708
33727
  }
33709
33728
  });
33710
33729
 
@@ -36035,25 +36054,25 @@ NOTE: as of ZIM 5.5.0 the zim namespace is no longer required (unless zns is set
36035
36054
 
36036
36055
  EXAMPLE
36037
36056
  const stepper = new Stepper()
36038
- .center()
36039
- .change(()=>{
36040
- label.text = stepper.value;
36041
- S.update();
36042
- });
36057
+ .center()
36058
+ .change(()=>{
36059
+ label.text = stepper.value;
36060
+ S.update();
36061
+ });
36043
36062
  const label = new Label({
36044
- align:CENTER,
36045
- text: stepper.value
36063
+ align:CENTER,
36064
+ text: stepper.value
36046
36065
  }).reg(CENTER).pos(0,100,CENTER,BOT);
36047
36066
  // press and drag too
36048
36067
 
36049
36068
  // Steppers can be words too
36050
36069
  const stepper2 = new Stepper({
36051
- list:["Roger", "Wilma","Sandy","Paul"],
36052
- width:200,
36053
- continuous:true
36070
+ list:["Roger", "Wilma","Sandy","Paul"],
36071
+ width:200,
36072
+ continuous:true
36054
36073
  }).pos(0,130,CENTER,CENTER).change(()=>{
36055
- label.text = stepper2.value;
36056
- S.update();
36074
+ label.text = stepper2.value;
36075
+ S.update();
36057
36076
  });
36058
36077
  END EXAMPLE
36059
36078
 
@@ -36133,6 +36152,7 @@ containerPrev, containerNext - access to the zim Container that holds the arrows
36133
36152
  arrowPrev, arrowNext - access to the zim Triangle objects
36134
36153
  arrowPrev2, arrowNext2 - access to the zim Triangle objects for arrows2
36135
36154
  min, max - only for number mode at the moment - currently, do not change the max to be less than the min
36155
+ step - get or set the main step of the Stepper (double check it is working, consider experimental, ZIM 019 patch)
36136
36156
  label - access to the Label
36137
36157
  textBox - access to the text box backing shape
36138
36158
  continuous - does the stepper loop
@@ -36156,7 +36176,11 @@ and S.update() in change event to see component change its graphics
36156
36176
 
36157
36177
  EVENTS
36158
36178
  dispatches a "change" event when changed by pressing an arrow or a keyboard arrow
36159
- (but not when setting index or value properties)
36179
+ but not when setting index or value properties
36180
+ dispatches a "keychange" event when changed by pressing a key that changes the value
36181
+ note the change from keys are also dispatched under "change"
36182
+ but sometimes if updating data, a pressup and a keychange combo is better
36183
+ as change from pressing and dragging can be at the framerate
36160
36184
 
36161
36185
  ALSO: see the CreateJS Easel Docs for Container events such as:
36162
36186
  added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmove, pressup, removed, rollout, rollover
@@ -36229,44 +36253,47 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
36229
36253
  var numVal;
36230
36254
  var numDir = 1;
36231
36255
  var decimals;
36232
- if (stepperType == "number") {
36233
- min = Number(min);
36234
- max = Number(max);
36235
- if (isNaN(min)) min = 0;
36236
- if (isNaN(max)) max = 100;
36237
- if (max < min) {
36238
- numDir = -1;
36239
- var temp = max; // one day ES6
36240
- max = min;
36241
- min = temp;
36242
- numVal = max;
36256
+ function setup() {
36257
+ if (stepperType == "number") {
36258
+ min = Number(min);
36259
+ max = Number(max);
36260
+ if (isNaN(min)) min = 0;
36261
+ if (isNaN(max)) max = 100;
36262
+ if (max < min) {
36263
+ numDir = -1;
36264
+ var temp = max; // one day ES6
36265
+ max = min;
36266
+ min = temp;
36267
+ numVal = max;
36268
+ } else {
36269
+ numVal = min;
36270
+ }
36271
+ that.min = min;
36272
+ that.max = max;
36273
+ if (0 > min && 0 < max) numVal = 0;
36274
+ step = Math.abs(step);
36275
+ decimals = Math.max(getDecimals(step), getDecimals(step2));
36276
+ } else if (stepperType == "letter") {
36277
+ list = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("");
36278
+ if (typeof min != "string") min = "A";
36279
+ if (typeof max != "string") max = "Z";
36280
+ min = min.substr(0,1).toUpperCase();
36281
+ max = max.substr(0,1).toUpperCase();
36282
+ var startLetter = list.indexOf(min);
36283
+ if (startLetter < 0) {min = "A"; startLetter = 0;}
36284
+ var endLetter = list.indexOf(max);
36285
+ if (endLetter < 0) {max = "Z"; endLetter = list.length;}
36286
+ if (endLetter < startLetter) {
36287
+ list.reverse();
36288
+ startLetter = list.length-1-startLetter;
36289
+ endLetter = list.length-1-endLetter;
36290
+ }
36291
+ list = list.splice(startLetter, endLetter-startLetter+1);
36243
36292
  } else {
36244
- numVal = min;
36245
- }
36246
- this.min = min;
36247
- this.max = max;
36248
- if (0 > min && 0 < max) numVal = 0;
36249
- step = Math.abs(step);
36250
- decimals = Math.max(getDecimals(step), getDecimals(step2));
36251
- } else if (stepperType == "letter") {
36252
- list = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("");
36253
- if (typeof min != "string") min = "A";
36254
- if (typeof max != "string") max = "Z";
36255
- min = min.substr(0,1).toUpperCase();
36256
- max = max.substr(0,1).toUpperCase();
36257
- var startLetter = list.indexOf(min);
36258
- if (startLetter < 0) {min = "A"; startLetter = 0;}
36259
- var endLetter = list.indexOf(max);
36260
- if (endLetter < 0) {max = "Z"; endLetter = list.length;}
36261
- if (endLetter < startLetter) {
36262
- list.reverse();
36263
- startLetter = list.length-1-startLetter;
36264
- endLetter = list.length-1-endLetter;
36265
- }
36266
- list = list.splice(startLetter, endLetter-startLetter+1);
36267
- } else {
36268
- stepperType = "list";
36293
+ stepperType = "list";
36294
+ }
36269
36295
  }
36296
+ setup();
36270
36297
 
36271
36298
  function getDecimals(num) {
36272
36299
  var decimals = String(num).split(".")[1];
@@ -36279,18 +36306,18 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
36279
36306
  var rawY = 0;
36280
36307
 
36281
36308
  if (draggable) {
36282
- this.on("mousedown", function(e) {
36309
+ that.on("mousedown", function(e) {
36283
36310
  if (that.zimAccessibility && that.zimAccessibility.aria) return;
36284
- this.stage.mouseMoveOutside = true;
36311
+ that.stage.mouseMoveOutside = true;
36285
36312
  rawX = e.rawX/zim.scaX;
36286
36313
  rawY = e.rawY/zim.scaY;
36287
- rawEvent = this.stage.on("stagemousemove", function(e){
36314
+ rawEvent = that.stage.on("stagemousemove", function(e){
36288
36315
  rawX = e.rawX/zim.scaX;
36289
36316
  rawY = e.rawY/zim.scaY;
36290
36317
  }, null, null, null, null, mID);
36291
36318
  }, null, true, null, null, mID);
36292
36319
  }
36293
- this.label = label;
36320
+ that.label = label;
36294
36321
  label.mouseChildren = false;
36295
36322
  label.mouseEnabled = false;
36296
36323
 
@@ -36473,6 +36500,8 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
36473
36500
  }
36474
36501
  doStep(dragDir);
36475
36502
  doHold();
36503
+ // optimize takes away update on changing label so add it here
36504
+ if (that.stage && (zim.OPTIMIZE||WW.OPTIMIZE)) that.stage.update();
36476
36505
  }, dragInput);
36477
36506
  }
36478
36507
  doHold();
@@ -36711,6 +36740,41 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
36711
36740
  }
36712
36741
  });
36713
36742
 
36743
+ // version of value that does not update stage
36744
+ Object.defineProperty(this, 'valueLite', {
36745
+ get: function() {
36746
+ if (stepperType=="number") {
36747
+ return Number(numVal);
36748
+ } else {
36749
+ return list[index];
36750
+ }
36751
+ },
36752
+ set: function(value) {
36753
+ if(zot(value)) return;
36754
+ if (stepperType=="number") {
36755
+ value = Number(value);
36756
+ if (that.max > that.min) {
36757
+ if (value > that.max || value < that.min) return;
36758
+ } else {
36759
+ if (value < that.max || value > that.min) return;
36760
+ }
36761
+ var newIndex = that.stepperArray.indexOf(value);
36762
+ if (newIndex < 0) return;
36763
+ index = newIndex;
36764
+ numVal = Number(that.stepperArray[index]);
36765
+ setLabel(numVal, numVal, false); // false to not update stage
36766
+ } else {
36767
+ if (list.indexOf(value) > -1) {
36768
+ value = list.indexOf(value);
36769
+ } else {return;}
36770
+ if (value == that.index) return;
36771
+ index=value;
36772
+ setLabel(list[index], index, false); // false to not update stage
36773
+ }
36774
+ }
36775
+ });
36776
+
36777
+
36714
36778
  Object.defineProperty(this, 'currentValue', {
36715
36779
  get: function() {
36716
36780
  return this.value;
@@ -36746,6 +36810,18 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
36746
36810
  }
36747
36811
  });
36748
36812
 
36813
+ Object.defineProperty(this, 'step', {
36814
+ get: function() {
36815
+ return step;
36816
+ },
36817
+ set: function(value) {
36818
+ if (value == 0) value = 1;
36819
+ step = step2 = actualStep = value;
36820
+ var v = that.value;
36821
+ setup();
36822
+ that.value = zim.decimals(zim.constrain(that.min + Math.round((v - that.min) / step+.00001) * step, that.min, that.max), 5);
36823
+ }
36824
+ });
36749
36825
 
36750
36826
  this._enabled = true;
36751
36827
  Object.defineProperty(that, 'enabled', {
@@ -36825,8 +36901,9 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
36825
36901
  }
36826
36902
  }
36827
36903
 
36828
- function setLabel(text, n) {
36904
+ function setLabel(text, n, update) {
36829
36905
  index = n;
36906
+ if (zot(update)) update = true;
36830
36907
  if (display) {
36831
36908
  if (stepperType == "number") {
36832
36909
  if (text != 0 && decimals > 0) {
@@ -36839,9 +36916,9 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
36839
36916
  // label.y = box.y+(box.getBounds().height-label.getBounds().height)/2;
36840
36917
  }
36841
36918
  if (arrows) setArrows();
36842
- if (next && ((!zim.OPTIMIZE&&(zns||!WW.OPTIMIZE)) && next.stage)) {
36919
+ if (update && next && ((!zim.OPTIMIZE&&(zns||!WW.OPTIMIZE)) && next.stage)) {
36843
36920
  next.stage.update();
36844
- } else if (label && ((!zim.OPTIMIZE&&(zns||!WW.OPTIMIZE)) && label.stage)) {
36921
+ } else if (update && label && ((!zim.OPTIMIZE&&(zns||!WW.OPTIMIZE)) && label.stage)) {
36845
36922
  label.stage.update();
36846
36923
  }
36847
36924
  if (that.zimAccessibility) that.zimAccessibility.changeTitle(that, null, true);
@@ -36888,14 +36965,22 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
36888
36965
  } else {
36889
36966
  actualStep = step2;
36890
36967
  }
36968
+ var lastV = that.value;
36891
36969
  doStep(1);
36970
+ if (that.value != lastV) {
36971
+ that.dispatchEvent("keychange");
36972
+ }
36892
36973
  } else if (k == backwardVertical || k == backwardHorizontal) {
36893
36974
  if ((vertical && k == backwardVertical) || (!vertical && k == backwardHorizontal)) {
36894
36975
  actualStep = step;
36895
36976
  } else {
36896
36977
  actualStep = step2;
36897
36978
  }
36979
+ var lastV = that.value
36898
36980
  doStep(-1);
36981
+ if (that.value != lastV) {
36982
+ that.dispatchEvent("keychange");
36983
+ }
36899
36984
  }
36900
36985
  }
36901
36986
  }
@@ -36923,7 +37008,10 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
36923
37008
  other = true;
36924
37009
  } else if (k==173 || k==189) {
36925
37010
  that.value = that.value * -1;
36926
- if (that.value != lastValue) that.dispatchEvent("change");
37011
+ if (that.value != lastValue) {
37012
+ that.dispatchEvent("change");
37013
+ that.dispatchEvent("keychange");
37014
+ }
36927
37015
  lastValue = that.value;
36928
37016
  negativeCheck = !negativeCheck;
36929
37017
  } else if (k == 46) { // delete
@@ -36947,14 +37035,20 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
36947
37035
  if (num < min || num > max) return;
36948
37036
 
36949
37037
  that.value = num;
36950
- if (that.value != lastValue) that.dispatchEvent("change");
37038
+ if (that.value != lastValue) {
37039
+ that.dispatchEvent("change");
37040
+ that.dispatchEvent("keychange");
37041
+ }
36951
37042
  lastValue = that.value;
36952
37043
 
36953
37044
  } else {
36954
37045
  keyRestartCheck = true;
36955
37046
  lastKeyNum = "";
36956
37047
  that.value = String.fromCharCode(e.keyCode);
36957
- if (that.value != lastValue) that.dispatchEvent("change");
37048
+ if (that.value != lastValue) {
37049
+ that.dispatchEvent("change");
37050
+ that.dispatchEvent("keychange");
37051
+ }
36958
37052
  lastValue = that.value;
36959
37053
  }
36960
37054
  }
@@ -72833,7 +72927,33 @@ It tiles all TextureActive objects across the ZIM stage (and beyond to the right
72833
72927
  It adds a slider and swiper to view the objects.
72834
72928
  It adds a key (default t) and toggle() method to toggle between the three.js canvas and the ZIM canvas.
72835
72929
 
72836
- SEE the TextureActive and TextureActives examples
72930
+ EXAMPLE
72931
+ // Do not use TextureActiveManager directly
72932
+ // Make sure to import the three module
72933
+
72934
+ const panel = new TextureActive(W,H);
72935
+ const circle = new Circle(100,red).center(panel).drag();
72936
+
72937
+ const three = new Three({
72938
+ width:window.innerWidth,
72939
+ height:window.innerHeight,
72940
+ cameraPosition:new THREE.Vector3(0,0,500),
72941
+ textureActive:true
72942
+ });
72943
+
72944
+ const renderer = three.renderer;
72945
+ const scene = three.scene;
72946
+ const camera = three.camera;
72947
+
72948
+ const controls = new OrbitControls(camera, three.canvas);
72949
+
72950
+ const textureActives = new TextureActives(panel, THREE, three, renderer, scene, camera, controls);
72951
+ // turn off T key to toggle between ZIM and three.js
72952
+ textureActives.manager.toggleKey = -1;
72953
+
72954
+ const canvasWindow = three.makePanel(panel, textureActives);
72955
+ scene.add(canvasWindow);
72956
+ END EXAMPLE
72837
72957
 
72838
72958
  PARAMETERS
72839
72959
  stage (default the ZIMDefaultFrame's stage) the stage to operate on - provided internally
@@ -77395,6 +77515,15 @@ circle.contact(obj=>{
77395
77515
  });
77396
77516
  END EXAMPLE
77397
77517
 
77518
+ EXAMPLE
77519
+ // Can join objects together with different types of joins (distance, weld, revolute)
77520
+ STYLE = {corner:10};
77521
+ const bar1 = new Rectangle(100,20).reg(CENTER).loc(100,600).addPhysics();
77522
+ const bar2 = new Rectangle(100,20).reg(CENTER).loc(200,600).addPhysics();
77523
+ // revolute only needs one point - choose end middle of bar1 (remember reg is in center)
77524
+ physics.join(bar1, bar2, new Point(bar1.x+bar1.width/2, bar1.y), null, -90, 90, "revolute");
77525
+ END EXAMPLE
77526
+
77398
77527
  EXAMPLE
77399
77528
  // control a ball with a DPad - better than keys for mobile
77400
77529
  const physics = new Physics(0);
@@ -77576,6 +77705,7 @@ addPhysics(dynamic, contract, shape, friction, linear, angular, density, bouncin
77576
77705
  friction - (default .8) - how sticky will the body act - set to 0 to slide.
77577
77706
  linear - (default .5) - linear damping which slows the movement - set to 0 for no damping
77578
77707
  angular - (default .5) - angular damping which slows the rotation - set to 0 for no damping
77708
+ also can use obj.body.SetFixedRotation(true) to stop the physics body from rotating
77579
77709
  density - (default 1) - the density that can affect what happens with collisions
77580
77710
  bounciness - (default 0) - how bouncy the object is - 0 is not bouncy 4 is crazy bouncy
77581
77711
  maskBits - (default null) - used with categoryBits to determine which bodies will collide with which other bodies
@@ -77614,8 +77744,9 @@ torque(amount) - add a turning force over time on the object
77614
77744
  just applying the torque once will hardly do anything - use an spin() for that
77615
77745
  setLinearVelocity(x, y) - set the linear velocity - this overrides current forces
77616
77746
  so might look unnatural as setLinearVelocity(0,0) will stop the object moving
77617
- setAngularVelocity(amount) - set the angular velocity - this overrids current forces
77747
+ setAngularVelocity(amount) - set the angular velocity - this overrides current forces
77618
77748
  so might look unnatural as setAngularVelocity(0) will stop the object spinning
77749
+ Also can use obj.body.SetFixedRotation(true) to stop the physics body from rotating
77619
77750
  sleep() - puts object to sleep so no physics calculations are done
77620
77751
  wake() - wakes up object from sleep so physics calculations are done
77621
77752
  follow(damp, dampY, leftOffset, rightOffset, upOffset, downOffset, offsetDamp, offsetDampY, horizontal, vertical, borderLock, borderOriginal)
@@ -77718,7 +77849,7 @@ zimObj - the ZIM Object that the body is mapped to
77718
77849
  x - deprecated - please use the BODY's loc(x, y) method - note: zimObj.body.loc() is not the same as the zimObj.loc() method
77719
77850
  y - deprecated - please use the BODY's loc(x, y) method - note: zimObj.body.loc() is not the same as the zimObj.loc() method
77720
77851
  rotation - the rotation of the body (degrees) - setting this will also rotate the ZIM DisplayObject
77721
- Also see obj.body.SetFixedRotation() to stop the physics body from rotating https://zimjs.com/zapp/print/Z_C6SBW
77852
+ Also can use obj.body.SetFixedRotation(true) to stop the physics body from rotating https://zimjs.com/zapp/print/Z_C6SBW
77722
77853
  And the counter rotation technique here: https://zimjs.com/data/
77723
77854
 
77724
77855
  GLOBAL VARIABLES
@@ -90626,7 +90757,6 @@ loadFailObj - (default result of F.makeCircles) object that shows if asset() doe
90626
90757
  This will be given a type property of "EmptyAsset"
90627
90758
  Set the loadFailObj property below to null to set no object - but this will yield errors unless each resulting asset() is tested
90628
90759
  Set to new Container() to show nothing (but avoid errors) - or new Rectangle(10, 10) to show little black square, etc.
90629
- sensors - (default false) set to true to capture Frame devicemotion and deviceorientation events - see Events
90630
90760
  retina - (default true) scales stage to use pixelDensity (sharper when scaling up) and supports Adobe Animate export
90631
90761
  may need to set mouse event targets to e.stageX/zim.scaX and e.stageY.zim.scaY
90632
90762
  except for using S.getObjectUnderPoint()
@@ -91026,7 +91156,7 @@ EVENTS
91026
91156
  note - when changing scale, it is better to multiply by a factor rather than add to the scale
91027
91157
  eg. circle.scale = constrain(circle.scale*(sign(e.deltaY)>0?.75:1.25), .5, 5);
91028
91158
  "deviceorientation" - turned on when using ZIM PermissionAsk()
91029
- fired as device orientation changes:
91159
+ fired as device orientation changes - use for tilt or compass
91030
91160
  eventObject.rotation.x (beta in HTML specs) holds rotation about the x axis between -180 and 180 (tipped forward or backward)
91031
91161
  eventObject.rotation.y (gamma in HTML specs) holds rotation about the y axis between -90 and 90 (tipped left or right)
91032
91162
  eventObject.rotation.z (alpha in HTML specs) holds rotation about the z axis 0-360 clockwise (relative to orientation when app loads)
@@ -91040,7 +91170,8 @@ EVENTS
91040
91170
  S.update();
91041
91171
  });
91042
91172
  "devicemotion" - turned on when using ZIM PermissionAsk()
91043
- fired on moving mobile device - like a tilt or shake - eventObject.acceleration holds x, y and z properties of motion
91173
+ tracks device accelerometer to capture shake
91174
+ eventObject.acceleration holds x, y and z properties of motion
91044
91175
  eg.
91045
91176
  var label = new Label().center();
91046
91177
  // Note: MUST USE PermissionAsk()
@@ -95255,53 +95386,91 @@ END EXAMPLE
95255
95386
  //-83.867
95256
95387
 
95257
95388
  /*--
95258
- Tilt - device motion and orientation events
95389
+ Tilt - device orientation event
95259
95390
 
95260
95391
  Tilt
95261
- "devicemotion" and "deviceorientation" Frame events
95392
+ "deviceorientation" Frame event
95262
95393
 
95263
95394
  DESCRIPTION
95264
- The Frame has a "devicemotion" event to capture device tilt
95265
- and a "deviceorientation" to capture device rotation (like a compass)
95395
+ The Frame has a "deviceorientation" event to capture tilt or device rotation (like a compass)
95396
+ and a "devicemotion" event to capture shaking the device with the accelerometer.
95397
+
95398
+ SEE: Shake - for the "devicemotion" event for accelerometer motion
95266
95399
 
95267
95400
  SEE: the PermissionAsk() class which will handle asking for permissions on devices.
95268
95401
 
95269
95402
  EXAMPLE
95270
- // TILT
95403
+ // TILT OR COMPASS - https://zimjs.com/zapp/Z_Q5UYS
95271
95404
  // for capturing tilt on device (rotation about an axis)
95272
- // be on a mobile device
95405
+ // be on a mobile device or a device with sensors
95273
95406
  new PermissionAsk(yes=>{
95274
- if (yes) {
95407
+ if (yes) { // the user answered yes to PermissionAsk
95275
95408
  // all code goes in here
95276
- const label = new Label().loc(20,20);
95409
+ new Label("Tilt the device to move circle").alp(.3).pos(0,30,CENTER);
95410
+ const circle = new Circle().center();
95411
+ const amount = .5;
95412
+ const compass = new Line(60, 4, light, "arrow").rot(90).centerReg(circle); // point up
95277
95413
  F.on("deviceorientation", e=>{
95278
- label.text = "x: " + Math.round(e.rotation.x)
95279
- +"\ny: " + Math.round(e.rotation.y)
95280
- +"\nz: " + Math.round(e.rotation.z);
95414
+ // for tilt
95415
+ circle.mov(e.rotation.y*amount, e.rotation.x*amount);
95416
+ circle.x = constrain(circle.x, 0, W);
95417
+ circle.y = constrain(circle.y, 0, H);
95418
+ // for compass use e.rotation.z
95419
+ // which has 0 angle at device start rotation (not necessarily North)
95420
+ compass.rot(90-e.rotation.z); // rotate opposite device rotation
95281
95421
  S.update();
95282
95422
  });
95283
- } else {
95423
+ } else { // the user answered no to PermissionAsk
95284
95424
  new Pane("SENSOR not available",yellow).show();
95285
95425
  }
95286
95426
  });
95287
95427
  END EXAMPLE
95288
95428
 
95429
+ EVENTS
95430
+ "deviceorientation" - for tilt
95431
+ fired as device orientation changes:
95432
+ eventObject.rotation.x (beta in HTML specs) holds rotation about the x axis between -180 and 180 (tipped forward or backward)
95433
+ eventObject.rotation.y (gamma in HTML specs) holds rotation about the y axis between -90 and 90 (tipped left or right)
95434
+ eventObject.rotation.z (alpha in HTML specs) holds rotation about the z axis 0-360 clockwise (relative to orientation when app loads)
95435
+ note rotation.z is 360-alpha compared to the HTML 5 specs
95436
+ note also that beta, gamma and alpha from the HTML 5 specs are also provided
95437
+ --*///+83.86
95438
+ // Device motion and orientation events are available as Frame events
95439
+ //-83.86
95440
+
95441
+ /*--
95442
+ Shake - device motion event
95443
+
95444
+ Shake
95445
+ "devicemotion" Frame event
95446
+
95447
+ DESCRIPTION
95448
+ The Frame has a "devicemotion" event to capture shaking the device with the accelerometer.
95449
+
95450
+ SEE: Tilt - for the "deviceorientation" event for tilt or compass
95451
+
95452
+ SEE: the PermissionAsk() class which will handle asking for permissions on devices.
95453
+
95289
95454
  EXAMPLE
95290
- // SHAKE
95291
- // for capturing shaking motion on device (acceleration about an access)
95292
- // be on a mobile device
95455
+ // SHAKE - https://zimjs.com/zapp/Z_XF8JM
95456
+ // for capturing shaking motion on device (acceleration about an axis)
95457
+ // be on a mobile device or a device with sensors
95293
95458
  new PermissionAsk(init, "devicemotion");
95294
95459
  function init(yes) {
95295
- if (yes) { // the user answers yes to the PermissionAsk
95460
+ if (yes) { // the user answered yes to PermissionAsk
95461
+ // all code goes in here
95462
+ new Label("Shake the device").center();
95463
+ S.update();
95296
95464
  let id;
95297
95465
  F.on("devicemotion", e=>{
95466
+ // for shake
95298
95467
  if (
95299
95468
  Math.abs(e.acceleration.x) > 5 ||
95300
95469
  Math.abs(e.acceleration.y) > 5 ||
95301
95470
  Math.abs(e.acceleration.z) > 5
95302
95471
  ) {
95303
- if (F.color != red) {
95304
- F.color = red;
95472
+ if (F.color != green) {
95473
+ F.color = green;
95305
95474
  S.update();
95306
95475
  }
95307
95476
  if (id) id.clear();
@@ -95311,25 +95480,18 @@ function init(yes) {
95311
95480
  });
95312
95481
  }
95313
95482
  });
95314
- } else { // the user answered no to PermissionAsk dialog
95315
- new Pane("SENSOR not available",yellow).show()
95483
+ } else { // the user answered no to PermissionAsk
95484
+ new Pane("SENSOR not available",yellow).show();
95316
95485
  }
95317
95486
  }
95318
95487
  END EXAMPLE
95319
95488
 
95320
95489
  EVENTS
95321
- "deviceorientation" - for tilt
95322
- fired as device orientation changes:
95323
- eventObject.rotation.x (beta in HTML specs) holds rotation about the x axis between -180 and 180 (tipped forward or backward)
95324
- eventObject.rotation.y (gamma in HTML specs) holds rotation about the y axis between -90 and 90 (tipped left or right)
95325
- eventObject.rotation.z (alpha in HTML specs) holds rotation about the z axis 0-360 clockwise (relative to orientation when app loads)
95326
- note rotation.z is 360-alpha compared to the HTML 5 specs
95327
- note also that beta, gamma and alpha from the HTML 5 specs are also provided
95328
95490
  "devicemotion" - for shake
95329
95491
  fired on moving mobile device - like a shake - eventObject.acceleration holds x, y and z properties of motion
95330
- --*///+83.86
95492
+ --*///+83.87
95331
95493
  // Device motion and orientation events are available as Frame events
95332
- //-83.86
95494
+ //-83.87
95333
95495
 
95334
95496
  /*--
95335
95497
  zim.PermissionAsk = function(callback, permissionType, color, backgroundColor, style, group, inherit)
@@ -95338,7 +95500,7 @@ PermissionAsk
95338
95500
  zim class - extends a zim.Pane which extends a zim.Container
95339
95501
 
95340
95502
  DESCRIPTION
95341
- A circular confirmation widget to ask the user if they want a permission on mobile.
95503
+ A circular confirmation widget to ask the user if they want a permission on devices.
95342
95504
  For some iOS permissions, the app needs to be interactive with first before permission can be asked!
95343
95505
 
95344
95506
  Also adds Frame deviceorientation and devicemotion events for a matching permissionType.
@@ -95351,19 +95513,26 @@ NOTE: as of ZIM 5.5.0 the zim namespace is no longer required (unless zns is set
95351
95513
 
95352
95514
  EXAMPLE
95353
95515
  // DEVICE ORIENTATION - gives angle of device in all 3 dimensions
95516
+ // See https://zimjs.com/zapp/Z_Q5UYS
95354
95517
  // Note: this is NOT an orientation event to see if phone is portrait or landscape (see Frame orientation event)
95355
-
95356
95518
  new PermissionAsk(yes=>{
95357
- if (yes) {
95519
+ if (yes) { // the user answered yes to PermissionAsk
95358
95520
  // all code goes in here
95359
- const label = new Label().loc(20,20);
95521
+ new Label("Tilt the device to move circle").alp(.3).pos(0,30,CENTER);
95522
+ const circle = new Circle().center();
95523
+ const amount = .5;
95524
+ const compass = new Line(60, 4, light, "arrow").rot(90).centerReg(circle); // point up
95360
95525
  F.on("deviceorientation", e=>{
95361
- label.text = "x: " + Math.round(e.rotation.x)
95362
- +"\ny: " + Math.round(e.rotation.y)
95363
- +"\nz: " + Math.round(e.rotation.z);
95526
+ // for tilt
95527
+ circle.mov(e.rotation.y*amount, e.rotation.x*amount);
95528
+ circle.x = constrain(circle.x, 0, W);
95529
+ circle.y = constrain(circle.y, 0, H);
95530
+ // for compass use e.rotation.z
95531
+ // which has 0 angle at device start rotation (not necessarily North)
95532
+ compass.rot(90-e.rotation.z); // rotate opposite device rotation
95364
95533
  S.update();
95365
95534
  });
95366
- } else {
95535
+ } else { // the user answered no to PermissionAsk
95367
95536
  new Pane("SENSOR not available",yellow).show();
95368
95537
  }
95369
95538
  });
@@ -95371,19 +95540,23 @@ END EXAMPLE
95371
95540
 
95372
95541
  EXAMPLE
95373
95542
  // DEVICE MOTION - gives accelerometer values in all 3 dimensions
95374
-
95543
+ // See https://zimjs.com/zapp/Z_XF8JM
95375
95544
  new PermissionAsk(init, "devicemotion");
95376
95545
  function init(yes) {
95377
- if (yes) { // the user answers yes to the PermissionAsk
95546
+ if (yes) { // the user answered yes to PermissionAsk
95547
+ // all code goes in here
95548
+ new Label("Shake the device").center();
95549
+ S.update();
95378
95550
  let id;
95379
- F.on("devicemotion", e=>{
95551
+ F.on("devicemotion", e=>{
95552
+ // for shake
95380
95553
  if (
95381
95554
  Math.abs(e.acceleration.x) > 5 ||
95382
95555
  Math.abs(e.acceleration.y) > 5 ||
95383
95556
  Math.abs(e.acceleration.z) > 5
95384
95557
  ) {
95385
- if (F.color != red) {
95386
- F.color = red;
95558
+ if (F.color != green) {
95559
+ F.color = green;
95387
95560
  S.update();
95388
95561
  }
95389
95562
  if (id) id.clear();
@@ -95393,13 +95566,14 @@ function init(yes) {
95393
95566
  });
95394
95567
  }
95395
95568
  });
95396
- } else { // the user answered no to PermissionAsk dialog
95397
- new Pane("SENSOR not available",yellow).show()
95569
+ } else { // the user answered no to PermissionAsk
95570
+ new Pane("SENSOR not available",yellow).show();
95398
95571
  }
95399
95572
  }
95400
95573
  END EXAMPLE
95401
95574
 
95402
95575
  EXAMPLE
95576
+ // CAM
95403
95577
  // on iOS, the app must be interacted with before using mic or cam
95404
95578
  // goes right to permissions on computer and android
95405
95579
  // pops up a PermissionAsk Pane on iOS then if yes, goes to permissions on iOS
@@ -95411,6 +95585,7 @@ function init(val) {
95411
95585
  END EXAMPLE
95412
95586
 
95413
95587
  EXAMPLE
95588
+ // MIC
95414
95589
  // on iOS, the app must be interacted with before using mic or cam
95415
95590
  // this goes right to permissions on computer and android
95416
95591
  // but pops up a PermissionAsk Pane on iOS then if yes, goes to permissions on iOS
@@ -95429,6 +95604,17 @@ callback - the function to callback when permission is accepted
95429
95604
  for iOS the PermissionAsk Pane will be shown and the system permissions
95430
95605
  in all cases, the callback will be called on result
95431
95606
  the parameter given to the callback will be true (sensors) or a media stream (mic / cam) or false if not accepted
95607
+ the callback will receive an error number as its second parameter
95608
+ 1 - device orientation fail
95609
+ 2 - device motion fail
95610
+ 3 - test timeout fail
95611
+ 4 - mic or miccam fail
95612
+ 5 - mediaDevices or getUserMedia fail
95613
+ 6 - native request permission denied by user
95614
+ 7 - request permission fail
95615
+ 8 - ZIM interface request permission denied by user (NO chosen)
95616
+ 9 - mic or miccam fail (no ZIM interface)
95617
+ 10 - mediaDevices or getUserMedia fail (no ZIM interface)
95432
95618
  permissionType - (default "deviceorientation") the string deviceorientation, devicemotion, mic, cam, or miccam
95433
95619
  color - (default zim.dark) the font and border color of the widget
95434
95620
  backgroundColor - (default zim.lighter) the backgroundColor of the widget
@@ -95487,8 +95673,7 @@ alpha, cursor, shadow, name, mouseChildren, mouseEnabled, parent, numChildren, e
95487
95673
 
95488
95674
  var that = this;
95489
95675
 
95490
- Style.addGroup("PermissionAsk", {
95491
- width:100,
95676
+ Style.addGroup("PermissionAsk", {
95492
95677
  color:color,
95493
95678
  rollColor:backgroundColor,
95494
95679
  corner:10,
@@ -95500,10 +95685,10 @@ alpha, cursor, shadow, name, mouseChildren, mouseEnabled, parent, numChildren, e
95500
95685
  });
95501
95686
  var pt = permissionType;
95502
95687
  var okay = false;
95503
- that.yes = new zim.Button({label:"YES", group:"PermissionAsk"}).sca(.65).pos(0,30,CENTER,TOP,this);
95688
+ that.yes = new zim.Button({label:"YES", width:100, group:"PermissionAsk"}).sca(.65).pos(0,30,CENTER,TOP,this);
95504
95689
  var words = {deviceorientation:"sensors", devicemotion:"sensors", mic:"mic", cam:"cam", miccam:"mic/cam"};
95505
95690
  that.label = new zim.Label("Use " + (words[pt]?words[pt]:"feature") + "?", 30, null, color, null, null, null, "center").sca(.9).centerReg(this);
95506
- that.no = new zim.Button({label:"NO", group:"PermissionAsk"}).sca(.65).pos(0,30,CENTER,BOTTOM,this);
95691
+ that.no = new zim.Button({label:"NO", width:100, group:"PermissionAsk"}).sca(.65).pos(0,30,CENTER,BOTTOM,this);
95507
95692
 
95508
95693
  new zim.Circle(110, zim.clear, color, 1).center(this).alp(.8);
95509
95694
  new zim.Circle(120, zim.clear, color, 1).center(this).alp(.5);
@@ -95522,9 +95707,9 @@ alpha, cursor, shadow, name, mouseChildren, mouseEnabled, parent, numChildren, e
95522
95707
  callback(stream);
95523
95708
  })
95524
95709
  .catch(function(err) {
95525
- callback(false);
95710
+ callback(false, 9);
95526
95711
  });
95527
- } else callback(false);
95712
+ } else callback(false, 10);
95528
95713
  return;
95529
95714
  }
95530
95715
 
@@ -95538,19 +95723,19 @@ alpha, cursor, shadow, name, mouseChildren, mouseEnabled, parent, numChildren, e
95538
95723
  function testMe(e) {
95539
95724
  if (okay) return;
95540
95725
  if (permissionType=="deviceorientation") {
95541
- if (e.alpha==null || (e.alpha==0&&e.beta==0&&e.gamma==0)) callback(false);
95726
+ if (e.alpha==null || (e.alpha==0&&e.beta==0&&e.gamma==0)) callback(false, 1);
95542
95727
  else setEvents();
95543
95728
  } else {
95544
95729
  // if (!e.acceleration || e.acceleration.x==null || (e.acceleration.x==0&&e.acceleration.y==0&&e.acceleration.z==0)) callback(false);
95545
- if (!e.acceleration || e.acceleration.x==null) callback(false);
95730
+ if (!e.acceleration || e.acceleration.x==null) callback(false, 2);
95546
95731
  else setEvents();
95547
95732
  }
95548
95733
  called = true;
95549
95734
  WW.removeEventListener(permissionType, testMe);
95550
95735
  }
95551
95736
  setTimeout(function(){
95552
- if (!called) callback(false);
95553
- }, 100);
95737
+ if (!called) callback(false, 3);
95738
+ }, 5000);
95554
95739
  }
95555
95740
 
95556
95741
  var lastZ = 0;
@@ -95599,9 +95784,9 @@ alpha, cursor, shadow, name, mouseChildren, mouseEnabled, parent, numChildren, e
95599
95784
  callback(stream);
95600
95785
  })
95601
95786
  .catch(function(err) {
95602
- callback(false);
95787
+ callback(false, 4);
95603
95788
  });
95604
- } else callback(false);
95789
+ } else callback(false, 5);
95605
95790
  } else {
95606
95791
  var s = DeviceMotionEvent;
95607
95792
  if (pt != "devicemotion") s = DeviceOrientationEvent;
@@ -95610,13 +95795,13 @@ alpha, cursor, shadow, name, mouseChildren, mouseEnabled, parent, numChildren, e
95610
95795
  setEvents();
95611
95796
  okay = true;
95612
95797
  }
95613
- else callback(false);
95798
+ else callback(false, 6);
95614
95799
  }).catch(function(e){
95615
- callback(false);
95800
+ callback(false, 7);
95616
95801
  });
95617
95802
  }
95618
95803
  } else {
95619
- callback(false);
95804
+ callback(false, 8);
95620
95805
  }
95621
95806
  }
95622
95807
 
@@ -96303,13 +96488,13 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
96303
96488
  var controls = new zim.Container(w*.6,w*.25);
96304
96489
  var conLev = new zim.Label({text:"LEVEL", shiftV:4}).alp(.8).sca(objTitle.scale);
96305
96490
  var conLevI = new zim.Label({text:"Depth", shiftV:4, italic:true}).alp(.5).sca(objTitle.scale);
96306
- var conLevS = new zim.Stepper({shadowColor:-1, bgColor:grey, color:lighter, value:settings.level, arrowScale:.6, group:"noMonitor"}).scaleTo(controls,40).change(function() {
96491
+ var conLevS = new zim.Stepper({arrows:true, shadowColor:-1, bgColor:grey, color:lighter, value:settings.level, arrowScale:.6, group:"noMonitor"}).scaleTo(controls,40).change(function() {
96307
96492
  settings.level = conLevS.value;
96308
96493
  updateSettings();
96309
96494
  });
96310
96495
  var conSpe = new zim.Label({text:"BATCH", shiftV:4}).alp(.8).sca(objTitle.scale);
96311
96496
  var conSpeI = new zim.Label({text:"Seconds", shiftV:4, italic:true}).alp(.5).sca(objTitle.scale);
96312
- var conBatS = new zim.Stepper({min:.1, max:3, step:.1, value:settings.time, shadowColor:-1, bgColor:grey, color:lighter, arrowScale:.6, group:"noMonitor"}).sca(conLevS.scale).change(function() {
96497
+ var conBatS = new zim.Stepper({arrows:true, min:.1, max:3, step:.1, value:settings.time, shadowColor:-1, bgColor:grey, color:lighter, arrowScale:.6, group:"noMonitor"}).sca(conLevS.scale).change(function() {
96313
96498
  settings.time = conBatS.value;
96314
96499
  updateSettings();
96315
96500
  });;
@@ -97132,6 +97317,8 @@ const content = makeContent({
97132
97317
  END EXAMPLE
97133
97318
 
97134
97319
  PARAMETERS
97320
+ ** supports VEE - parameters marked with ZIM VEE mean a zim Pick() object or Pick Literal can be passed
97321
+ Pick Literal formats: [1,3,2] - random; {min:10, max:20} - range; series(1,2,3) - order, function(){return result;} - function
97135
97322
  content - the content to make - using one of three formats:
97136
97323
  a string or number to add a ZIM Label (also see color parameter and property)
97137
97324
  a ZIM DisplayObject such as a Circle or a Container with more objects, etc.
@@ -97142,10 +97329,10 @@ content - the content to make - using one of three formats:
97142
97329
  buttons - an array of ZIM Button objects or configuration objects {} as follows:
97143
97330
  {label, color, rollColor, backgroundColor, rollBackgroundColor, call}
97144
97331
  with call being a callback function for when the button is pressed
97145
- buttonScale - the scale for the buttons
97332
+ buttonScale - |ZIM VEE| the scale for the buttons
97146
97333
  color - the color of the message
97147
- spacingH - horizontal space between the buttons (default 20xbuttonScale)
97148
- spacingV - vertical space between the content areas (default 20)
97334
+ spacingH - |ZIM VEE| horizontal space between the buttons (default 20xbuttonScale) starts with expected spaces, last space is set at left and right
97335
+ spacingV - |ZIM VEE| vertical space between the content areas (default 20) starts with space from top ends with space from bottom
97149
97336
  scrollBar - set to true if a default scrollBar is present in Window or a number if custom
97150
97337
  align - default CENTER, or use LEFT or RIGHT
97151
97338
  maxWidth - (default null) pass in a maximum width to keep scale the content to
@@ -97180,14 +97367,15 @@ RETURNS - a Label if a string or number is passed as content, a Container if a c
97180
97367
 
97181
97368
  if (!data.align) data.align = "center";
97182
97369
  obj = new zim.Container();
97183
- var spacer = new Container(10,spacingV).addTo(obj);
97184
- if (data.header) data.header.pos(0,spacingV,"left","top",obj);
97185
- if (data.message) var label = new zim.Label({text:data.message, color:zot(data.color)?color:data.color, align:data.align}).reg(LEFT,TOP).loc(0,obj.height+(data.header?spacingV:0),obj);
97186
- if (data.display) data.display.pos(0,-data.display.height-(data.header||data.message?spacingV:0),"left","bottom",obj);
97370
+ var s1 = zik(spacingV);
97371
+ var spacer = new Container(10,s1).addTo(obj);
97372
+ if (data.header) data.header.pos(0,s1,"left","top",obj);
97373
+ if (data.message) var label = new zim.Label({text:data.message, color:zot(data.color)?color:data.color, align:data.align}).reg(LEFT,TOP).loc(0,obj.height+(data.header?zik(spacingV):0),obj);
97374
+ if (data.display) data.display.pos(0,-data.display.height-(data.header||data.message?zik(spacingV):0),"left","bottom",obj);
97187
97375
  if (data.buttons) {
97188
97376
  if (!Array.isArray(data.buttons)) data.buttons = [data.buttons];
97189
97377
  var ideal = data.length*100;
97190
- var buts = new zim.Container().loc(0,obj.height+(data.header||data.message||data.display?spacingV:0),obj);
97378
+ var buts = new zim.Container().loc(0,obj.height+(data.header||data.message||data.display?zik(spacingV):0),obj);
97191
97379
  for (var bb=0; bb<data.buttons.length; bb++) {
97192
97380
  var bd = data.buttons[bb];
97193
97381
  var call = bd.call||function(){};
@@ -97204,8 +97392,12 @@ RETURNS - a Label if a string or number is passed as content, a Container if a c
97204
97392
  bd.button = bd;
97205
97393
  }
97206
97394
  bd.button.call = call;
97207
- bd.button.sca(data.buttonScale).loc((bb==0?0:buts.width+spacingH),0,buts).tap(function(e){e.target.call(e.target)});
97208
- }
97395
+ bd.button.sca(zik(data.buttonScale)).loc((bb==0?0:buts.width+zik(spacingH)),0,buts).tap(function(e){e.target.call(e.target)});
97396
+ }
97397
+ for (var bb=0; bb<data.buttons.length; bb++) {
97398
+ var bd = data.buttons[bb];
97399
+ bd.button.y = (buts.height - bd.button.height) / 2;
97400
+ }
97209
97401
  }
97210
97402
  var bb = obj.getBounds();
97211
97403
  obj.setBounds(bb.x, bb.y, bb.width, bb.height);
@@ -97218,8 +97410,9 @@ RETURNS - a Label if a string or number is passed as content, a Container if a c
97218
97410
  o.pos(0,null,"right");
97219
97411
  }
97220
97412
  }
97221
- if (maxWidth && typeof maxWidth == "number") obj.width = Math.min(obj.width, maxWidth-spacingH*2-(data.scrollBar===true?12:data.scrollBar>0?data.scrollBar:0));
97222
- new zim.Container(10,spacingV).pos(0,-spacer.height,"center","bottom",obj).bot();
97413
+ if (maxWidth && typeof maxWidth == "number") obj.width = Math.min(obj.width, maxWidth-zik(spacingH)*2-(data.scrollBar===true?12:data.scrollBar>0?data.scrollBar:0));
97414
+ var s2 = zik(spacingV);
97415
+ new zim.Container(10,s2).pos(0,-s2,"center","bottom",obj).bot();
97223
97416
 
97224
97417
  obj.setBounds(null); // make spacer in bottom adjust bounds
97225
97418
 
@@ -103373,4 +103566,3 @@ export let Style = zim.Style;
103373
103566
  export let assets = zim.assets;
103374
103567
  export let assetIDs = zim.assetIDs;
103375
103568
  export let ZIMON = zim.ZIMON;
103376
-