zimjs 17.2.3 → 17.2.5

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.
package/.gitattributes CHANGED
@@ -20,3 +20,4 @@
20
20
  *.PDF diff=astextplain
21
21
  *.rtf diff=astextplain
22
22
  *.RTF diff=astextplain
23
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zimjs",
3
- "version": "17.2.3",
3
+ "version": "17.2.5",
4
4
  "type": "module",
5
5
  "main": "./src/zim.js",
6
6
  "types": "./ts-src/typings/zim",
package/src/zim.js CHANGED
@@ -29112,6 +29112,10 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
29112
29112
  }
29113
29113
 
29114
29114
  this._enabled = true;
29115
+ var lastReadOnly;
29116
+ setTimeout(function() {
29117
+ lastReadOnly = that.readOnly;
29118
+ },50);
29115
29119
  Object.defineProperty(that, 'enabled', {
29116
29120
  get: function() {
29117
29121
  return that._enabled;
@@ -29123,6 +29127,18 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
29123
29127
  } else {
29124
29128
  setDrag();
29125
29129
  }
29130
+ if (that.blinker) {
29131
+ if (!value) {
29132
+ that.blinker.vis(false);
29133
+ that.selection.vis(false);
29134
+ lastReadOnly = that.readOnly;
29135
+ that.readOnly = true;
29136
+ } else {
29137
+ that.readOnly = lastReadOnly;
29138
+ if (!that.readOnly) that.blinker.vis(true);
29139
+ that.selection.vis(true);
29140
+ }
29141
+ }
29126
29142
  zenable(that, value);
29127
29143
  }
29128
29144
  });
@@ -31109,7 +31125,12 @@ align - get or set the horizontal alignment of the text
31109
31125
  color - gets or sets the label text color
31110
31126
  backgroundColor - gets or sets the background color
31111
31127
  readOnly - get or set the field as readOnly - also see readOnly parameter
31128
+ read only of true will allow selection and copy but not typing and cursor will be removed
31129
+ set enabled to false to not allow selection and copy
31112
31130
  enabled - default is true - set to false to disable
31131
+ setting enabled false will remember the readOnly setting when enabled is set to false
31132
+ so when set to true again it will be that remembered readOnly and will not rememember any changes to readOnly made in-between
31133
+ so any in-between readOnly changes will have to be re-applied after enabled is set back to true
31113
31134
  veeObj - an object with ZIM VEE original parameters:value allowing the ZIM VEE values to be referenced
31114
31135
  for instance, obj.prop = Pick.choose(obj.veeObj.prop); will reset the the prop to the result of the original ZIM VEE value
31115
31136
 
@@ -31522,14 +31543,16 @@ zim.TextInput = function(width, height, placeholder, text, size, font, color, ba
31522
31543
 
31523
31544
  Object.defineProperty(that, 'readOnly', {
31524
31545
  get: function() {
31525
- return readOnly;
31546
+ return readOnly;
31526
31547
  },
31527
31548
  set: function(value) {
31528
31549
  readOnly = value;
31529
31550
  that.htmlTag.readOnly = readOnly;
31551
+ if (value) that.blinker.vis(false);
31552
+ else that.blinker.vis(true);
31530
31553
  }
31531
31554
  });
31532
- if (readOnly) that.htmlTag.readOnly = true;
31555
+ that.readOnly = readOnly;
31533
31556
 
31534
31557
  Object.defineProperty(that, 'focus', {
31535
31558
  get: function() {
@@ -46644,10 +46667,12 @@ loader.on("loaded", e=>{
46644
46667
  S.update();
46645
46668
  });
46646
46669
 
46647
- // and to later save for instance in a button event:
46648
- saveButton.on("click") {
46649
- loader.save(stage); // or some other container... can specify crop bounds too
46650
- }
46670
+ // if wanting a save button
46671
+ const saveButton = new Button({label:"SAVE"})
46672
+ .pos(10,10,RIGHT,BOTTOM)
46673
+ .tap(()=>{
46674
+ loader.save(S); // or some other container... can specify crop bounds too
46675
+ }
46651
46676
  END EXAMPLE
46652
46677
 
46653
46678
  EXAMPLE
@@ -46886,7 +46911,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
46886
46911
  if (accept) uploadTag.setAttribute("accept", accept);
46887
46912
  uploadTag.hidden = true;
46888
46913
  uploadTag.zimDisplay = uploadTag.style.display || "inline-block";
46889
- uploadTag.style.cssText = "border:thin solid grey; z-index:2; width:" + 0 + "px; height:" + 0 + "px; overflow:hidden; outline:none;"
46914
+ uploadTag.style.cssText = "border:thin solid grey; z-index:2; width:" + width + "px; height:" + height + "px; overflow:hidden; outline:none;"
46890
46915
  + "position:absolute; left:0px; top:0px; display:none; cursor:pointer; opacity: 0; filter: alpha(opacity=0);";
46891
46916
 
46892
46917
  this.addEventListener('mousedown', function() { // added for zim.Accessibility
@@ -47368,6 +47393,7 @@ value - get or set the text content of the TextArea
47368
47393
  text - get or set the text value
47369
47394
  focus - get or set if the TextArea tag has focus or use setFocus() to set (might need timeout 100ms before setting)
47370
47395
  readOnly - set to true to not be able to edit or to false to be able to edit (always can select)
47396
+ set enabled to false to disable selection
47371
47397
  maxLength - get or set the maximum number of characters typed - will not truncate existing characters until typed
47372
47398
  tag - the HTML textarea tag - just a regular HMTL form tag which can be styled
47373
47399
  background - access to the Rectangle() used for the background
@@ -47376,6 +47402,8 @@ background - access to the Rectangle() used for the background
47376
47402
  blendMode - how the object blends with what is underneath - such as "difference", "multiply", etc. same as CreateJS compositeOperation
47377
47403
  keyFocus - get or set the keyboard focus on the component - see also zim.KEYFOCUS
47378
47404
  will be set to true if this component is the first made or component is the last to be used
47405
+ enabled - get or set enabled of TextArea
47406
+ this will remember last readOnly so any setting of readonly in between enabled settings will have to be reapplied.
47379
47407
  frame - get or set the frame - set this if changing frames
47380
47408
 
47381
47409
  ALSO: see ZIM Container for properties such as:
@@ -47687,6 +47715,30 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
47687
47715
  }
47688
47716
  }
47689
47717
  });
47718
+
47719
+ that._enabled = true;
47720
+ var lastReadOnly = that.readOnly;
47721
+ Object.defineProperty(that, 'enabled', {
47722
+ get: function() {
47723
+ zog("here")
47724
+ return that._enabled;
47725
+ },
47726
+ set: function(value) {
47727
+ if (!value) {
47728
+ lastReadOnly = that.readOnly;
47729
+ that.readOnly = false; // needed to remove selection
47730
+ that.focus = false;
47731
+ that.tag.style.pointerEvents = "none";
47732
+ setTimeout(function() {
47733
+ that.readOnly = true;
47734
+ },50); // setting readonly brings back selection even after blur - bug in HTML
47735
+ } else {
47736
+ that.tag.style.pointerEvents = "unset"; // tried all, unset, inherent, auto, initial, revert
47737
+ that.readOnly = lastReadOnly; // does not bring selection back
47738
+ }
47739
+ zenable(that, value);
47740
+ }
47741
+ });
47690
47742
 
47691
47743
  this.resizeEvent = frame.on("resize", that.resize);
47692
47744
  this.updateEvent = frame.on("update", that.resize);
@@ -51130,7 +51182,7 @@ RETURNS obj for chaining
51130
51182
 
51131
51183
  if (e.stageX == null) return; // added for TextureActive drag in 2D view
51132
51184
 
51133
- if (slide) {
51185
+ if (slide) {
51134
51186
  dragObject.dispatchEvent("slidestart");
51135
51187
 
51136
51188
  if (dragObject.parent) {
@@ -51172,6 +51224,12 @@ RETURNS obj for chaining
51172
51224
  lastBackT = upT = 0;
51173
51225
  }
51174
51226
 
51227
+ if (Math.abs(dX) < 1 && Math.abs(dY) < 1) {
51228
+ hasMoved = false;
51229
+ dragObject.dispatchEvent("slidestop");
51230
+ zim.Ticker.remove(obj.zimDragTicker);
51231
+ }
51232
+
51175
51233
  // if (dampX) dampX.immediate(50);
51176
51234
  // if (dampY) dampY.immediate(0);
51177
51235
 
@@ -51253,7 +51311,8 @@ RETURNS obj for chaining
51253
51311
  }
51254
51312
  }
51255
51313
  });
51256
- if (miss) {
51314
+ if (miss) {
51315
+ dragObject.dropTarget = dragObject.droppedTarget = null;
51257
51316
  if (dropBack) {
51258
51317
  dragObject.animate({
51259
51318
  props:{x:dragObject.dropStartX, y:dragObject.dropStartY, scale:dragObject.dropStartS},
@@ -51362,7 +51421,7 @@ RETURNS obj for chaining
51362
51421
  o.y = desiredY;
51363
51422
  o.slideStartX = null;
51364
51423
  o.slideStartY = null;
51365
- if (hasMoved) {
51424
+ if (hasMoved) {
51366
51425
  o.dispatchEvent("slidestop");
51367
51426
  zim.Ticker.remove(obj.zimDragTicker);
51368
51427
  }
@@ -51387,7 +51446,7 @@ RETURNS obj for chaining
51387
51446
  function setUpSlide() {
51388
51447
  obj.zimDragTicker = function() {
51389
51448
  if (zot(obj.slideStartX)) return; // don't stop other things like window scrollbar from moving object
51390
-
51449
+
51391
51450
  if (!dragObject) dragObject = obj; // could be risky if intending to drag children
51392
51451
  if (obj.downCheck) {
51393
51452
  var point;
@@ -58074,7 +58133,7 @@ RETURNS the target for chaining (or null if no target is provided and run on zim
58074
58133
  // if (internal) target.percentComplete = target.pathRatio = 0;
58075
58134
 
58076
58135
  if (zot(command)) command = true;
58077
- if (target.pan == undefined) {
58136
+ if (target.pan == undefined && target.type != "Timer") { // hmmm what about other objects with paused properties...
58078
58137
  if (target.type != undefined) target.paused = true;
58079
58138
  target.animating = false;
58080
58139
  }
@@ -79163,7 +79222,6 @@ zim.Emitter = function(obj, width, height, interval, num, life, fade, shrink, wa
79163
79222
  }
79164
79223
  });
79165
79224
  }
79166
-
79167
79225
  if (
79168
79226
  cache &&
79169
79227
  !particle.emitShape &&
@@ -79275,7 +79333,7 @@ zim.Emitter = function(obj, width, height, interval, num, life, fade, shrink, wa
79275
79333
  else max = zik(life);
79276
79334
  var min;
79277
79335
  if (interval.min) min = interval.min;
79278
- else if (Array.isArray(interval)) min = zim.arrayMinmin(interval).min;
79336
+ else if (Array.isArray(interval)) min = zim.arrayMinMax(interval).min;
79279
79337
  else min = zik(interval);
79280
79338
  warm = Math.min(200, Math.round(max/min));
79281
79339
  }
@@ -79520,6 +79578,7 @@ zim.Emitter = function(obj, width, height, interval, num, life, fade, shrink, wa
79520
79578
  return that.cloneProps(new zim.Emitter(objClone, width, height, that.interval, that.num, that.life, that.fade, that.shrink, warm, that.decayTime, that.decayStart, that.trace, that.traceFadeTime, that.traceShiftX, that.traceShiftY, that.angle, that.emitterForce, that.gravity, that.wind, that.layers, that.animation, zim.copy(that.random), that.horizontal, that.vertical, that.sink, that.sinkForce, cache, that.events, startPaused, that.pool, that.poolMin, particles, focusWarm, style, that.group, inherit));
79521
79579
  };
79522
79580
 
79581
+
79523
79582
  this.dispose = function() {
79524
79583
  if (that.zimInterval) that.zimInterval.clear();
79525
79584
  if (emitterTicker) {
@@ -83743,7 +83802,10 @@ zim.VR = function(content, angle, distance, parallax, parallaxAngle, damp, paral
83743
83802
 
83744
83803
  VR
83745
83804
  zim class - extends a ZIM Container which extends a CreateJS Container
83746
- NOTE: Also see the ZIM Three Helper Module for XR controllers, movement and teleport in three.js with ZIM TextureActive (this VR() class is not related)
83805
+
83806
+ NOTE: Also see the ZIM Three Helper Module for XR controllers, movement and teleport in three.js
83807
+ with ZIM TextureActive (this VR() class is much simplified and not related to TextureActive)
83808
+ See: https://zimjs.com/three - for proper 3D
83747
83809
 
83748
83810
  DESCRIPTION
83749
83811
  Copies the content and displays a left and right channel (side-by-side) to be viewed with a VR helmet.
@@ -83790,7 +83852,8 @@ So if you have a label variable for the Label in the original content,
83790
83852
  you can access the label in the right hand channel with label.vrMatch
83791
83853
  The right channel objects also have vrMatch properties so label.vrMatch.vrMatch is the label ;-)
83792
83854
 
83793
- SEE: https://zimjs.com/vr/
83855
+ SEE: https://zimjs.com/vr.html
83856
+ SEE: https://zimjs.com/vr/sample.html
83794
83857
 
83795
83858
  NOTE: as of ZIM 5.5.0 the zim namespace is no longer required (unless zns is set to true before running zim)
83796
83859