zimjs 18.1.9 → 18.2.1

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 +166 -64
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zimjs",
3
- "version": "18.1.9",
3
+ "version": "18.2.1",
4
4
  "type": "module",
5
5
  "main": "./src/zim.js",
6
6
  "types": "./ts-src/typings/zim",
package/src/zim.js CHANGED
@@ -55919,7 +55919,9 @@ hitTestPoint
55919
55919
  zim DisplayObject method
55920
55920
 
55921
55921
  DESCRIPTION
55922
- See if shape of obj is hitting the global point x and y on the stage.
55922
+ Tests if shape of obj is hitting the global point x and y on the stage.
55923
+
55924
+ NOTE: https://zimjs.com/tips.html#HITTEST for tips on Hit Tests
55923
55925
 
55924
55926
  EXAMPLE
55925
55927
  const circle = new Circle().loc(100,100).drag();
@@ -55970,7 +55972,9 @@ hitTestReg
55970
55972
  zim DisplayObject method
55971
55973
 
55972
55974
  DESCRIPTION
55973
- See if the shape shape of an object is hitting the registration point of object (other).
55975
+ Tests if the shape shape of an object is hitting the registration point of object (other).
55976
+
55977
+ NOTE: https://zimjs.com/tips.html#HITTEST for tips on Hit Tests
55974
55978
 
55975
55979
  EXAMPLE
55976
55980
  const circle = new Circle(50, red).center().drag();
@@ -56020,6 +56024,8 @@ The rectangle is based on the position, registration and bounds of object (other
56020
56024
  num is how many points on the edge of the rectangle we test - default is 0.
56021
56025
  The four corners are always tested as well as the very middle of the rectangle.
56022
56026
 
56027
+ NOTE: https://zimjs.com/tips.html#HITTEST for tips on Hit Tests
56028
+
56023
56029
  EXAMPLE
56024
56030
  const circle = new Circle(50, red).center().drag();
56025
56031
  const rect = new Rectangle(100, 100, blue).loc(100,100);
@@ -56115,7 +56121,9 @@ zim DisplayObject method
56115
56121
  DESCRIPTION
56116
56122
  Uses an equation to see if the bounds of a rectangular object is hitting a point x, y.
56117
56123
  This is faster than hitTests on shapes - so will have the speed of hitTestBounds, hitTestCircles and hitTestGrid.
56118
- A margin parameter is provided to tweak the hitTest
56124
+ A margin parameter is provided to tweak the hitTest.
56125
+
56126
+ NOTE: https://zimjs.com/tips.html#HITTEST for tips on Hit Tests
56119
56127
 
56120
56128
  EXAMPLE
56121
56129
  const rect = new Rectangle(50, 50, red).center().drag();
@@ -56158,9 +56166,11 @@ zim DisplayObject method
56158
56166
  DESCRIPTION
56159
56167
  See if the shape of an object is hitting points on a circle of another object.
56160
56168
  The circle is based on the position, registration and bounds of object (other).
56161
- num is how many points around the circle we test - default is 8
56169
+ num is how many points around the circle we test - default is 8.
56162
56170
  Also checks center of circle hitting.
56163
56171
 
56172
+ NOTE: https://zimjs.com/tips.html#HITTEST for tips on Hit Tests
56173
+
56164
56174
  EXAMPLE
56165
56175
  var circle = new Circle(50, red).center().drag();
56166
56176
  var triangle = new Triangle(100, 100, 100, blue).loc(100,100);
@@ -56241,9 +56251,11 @@ DO NOT use with a rotated rectangle object - for that use hitTestRect() or hitTe
56241
56251
  This is faster than hitTests on shapes - so will have the speed of hitTestBounds, hitTestCircles and hitTestGrid.
56242
56252
  The circle is based on a the object radius if there is one
56243
56253
  and if no radius then the average of the width and height divided by two.
56244
- A margin parameter is provided to tweak the hitTest
56245
- The rect is based on the bounds of the second object projected globally as a rectangle
56246
- If the second object bounds are rotated, the global bounds will be bigger to keep parallel to the axes
56254
+ A margin parameter is provided to tweak the hitTest.
56255
+ The rect is based on the bounds of the second object projected globally as a rectangle.
56256
+ If the second object bounds are rotated, the global bounds will be bigger to keep parallel to the axes.
56257
+
56258
+ NOTE: https://zimjs.com/tips.html#HITTEST for tips on Hit Tests
56247
56259
 
56248
56260
  EXAMPLE
56249
56261
  const ball = new Circle(50, red).center().drag();
@@ -56306,7 +56318,9 @@ Uses an equation to see if a circlular object is hitting a point x, y.
56306
56318
  This is faster than hitTests on shapes - so will have the speed of hitTestBounds, hitTestCircles and hitTestGrid.
56307
56319
  The circle is based on a the object radius if there is one
56308
56320
  and if no radius then the average of the width and height divided by two.
56309
- A margin parameter is provided to tweak the hitTest
56321
+ A margin parameter is provided to tweak the hitTest.
56322
+
56323
+ NOTE: https://zimjs.com/tips.html#HITTEST for tips on Hit Tests
56310
56324
 
56311
56325
  EXAMPLE
56312
56326
  const ball = new Circle(50, red).center().drag();
@@ -56358,7 +56372,9 @@ Uses an equation to see if two circles are intersecting.
56358
56372
  This is faster than hitTests on shapes - so will have the speed of hitTestBounds and hitTestGrid.
56359
56373
  The circles are based on the bounds of the two objects - it does not matter on which object the method is placed.
56360
56374
  If the bounds are not square then half the average length of the sides is used as the radius.
56361
- A margin parameter is provided to tweak the hitTest
56375
+ A margin parameter is provided to tweak the hitTest.
56376
+
56377
+ NOTE: https://zimjs.com/tips.html#HITTEST for tips on Hit Tests
56362
56378
 
56363
56379
  EXAMPLE
56364
56380
  const ball = new Circle(50, red).center().drag();
@@ -56415,6 +56431,8 @@ See if obj.getBounds() is hitting other.getBounds().
56415
56431
  Margin can be adjusted to tweak the hitTest.
56416
56432
  Pass in a boundsShape shape if you want a demonstration of where the bounds are.
56417
56433
 
56434
+ NOTE: https://zimjs.com/tips.html#HITTEST for tips on Hit Tests
56435
+
56418
56436
  EXAMPLE
56419
56437
  const circle = new Circle(50, red).center().drag();
56420
56438
  const rect = new Rectangle(100, 100, blue).loc(100,100);
@@ -56472,9 +56490,12 @@ zim DisplayObject method
56472
56490
 
56473
56491
  DESCRIPTION
56474
56492
  See if the shape of an object is hitting points on a path of a Squiggle or Blob.
56475
- num is how many points between each point on the path we test - default is 2
56493
+ num is how many points between each point on the path we test - default is 2.
56494
+
56476
56495
  SEE: https://zimjs.com/hittestpath.html
56477
56496
 
56497
+ NOTE: https://zimjs.com/tips.html#HITTEST for tips on Hit Tests
56498
+
56478
56499
  EXAMPLE
56479
56500
  const path = new Blob().center();
56480
56501
  const circle = new Circle(50, purple).pos(100,100).drag();
@@ -56557,6 +56578,8 @@ Converts an x and y point to an index in a grid.
56557
56578
  If you have a grid of rectangles, for instance, use this to find out which rectangle is beneath the cursor.
56558
56579
  This technique will work faster than any of the other hit tests.
56559
56580
 
56581
+ NOTE: https://zimjs.com/tips.html#HITTEST for tips on Hit Tests
56582
+
56560
56583
  EXAMPLE
56561
56584
  const tile = new Tile(new Rectangle(100,100),5,4,10,10).center();
56562
56585
  const circle = new Circle(10,green).pos(10,10).drag();
@@ -56989,6 +57012,7 @@ props - the object literal holding properties and values to animate
56989
57012
  then this will be the last of the series to run
56990
57013
  Note: color cannot be animated in a series - rather animate in a call function to accomplish a series of color changes
56991
57014
  Note: a sequence cannot be seriesed and a series cannot be sequenced
57015
+ Note: series with dot properties (like rotation.x for threejs) could have problems with from and set
56992
57016
  time - |ZIM VEE| (default 1) the time for the tween in seconds (also see ZIM TIME constant)
56993
57017
  see also the rate parameter and property to dynamically change the time the animation takes (its speed)
56994
57018
  ease - |ZIM VEE| (default "quadInOut") the equation type for easing ("bounceOut", "elasticIn", "backInOut", "linear", etc)
@@ -57090,7 +57114,6 @@ protect - (default false) protects animation from being interrupted before finis
57090
57114
  override - (default true) subesequent tweens of any type on object cancel all earlier tweens on object
57091
57115
  set to false to allow multiple tweens of same object
57092
57116
  from - |ZIM VEE| (default false) set to true to animate from obj properties to the current properties set on target
57093
- note that from is not supported with dot properties such as "rotation.x" with threejs (a difficult bug)
57094
57117
  set - |ZIM VEE| (default null) an object of properties to set on the target to start (but after the wait time)
57095
57118
  id - (default null) set to String to use with pauseAnimate(state, id) and stopAnimate(id) - thanks Sean Berwick for typo catch
57096
57119
  series animate gets only one overall id - so no id per animation object
@@ -57364,7 +57387,7 @@ RETURNS the target for chaining (or null if no target is provided and run on zim
57364
57387
 
57365
57388
  // handle setting value with dot property format
57366
57389
  // (target, "rotation.x", 200) for instance
57367
- function setValue(what, prop, val) {
57390
+ function setValue(what, prop, val) {
57368
57391
  if (prop.substr(0,1) == ".") {
57369
57392
  var dots = prop.split(".");
57370
57393
  var lastdot = what;
@@ -57403,8 +57426,7 @@ RETURNS the target for chaining (or null if no target is provided and run on zim
57403
57426
  // PREPARE ZIK RANDOM VALUES PASSED IN AS ARRAY OR RAND OBJECT {min, max, integer, negative}
57404
57427
  var extraTypes = ["extra", "zoom", "speed", "layer", "fade"];
57405
57428
  var extraLookup = {zoom:target.type=="Pen"?"size":"scale", speed:"percentSpeed", layer:"layer", fade:"alpha"};
57406
-
57407
-
57429
+
57408
57430
  if (target instanceof Array) {
57409
57431
  if (sequenceReverse) target.reverse();
57410
57432
 
@@ -57705,7 +57727,7 @@ RETURNS the target for chaining (or null if no target is provided and run on zim
57705
57727
  }
57706
57728
 
57707
57729
  if (o.from) {
57708
- var firstFrom = froms.at(o.target);
57730
+ var firstFrom = froms.at(o.target);
57709
57731
  if (firstFrom) {
57710
57732
  if (o.set) {
57711
57733
  // all properties from obj go to set
@@ -58161,11 +58183,12 @@ RETURNS the target for chaining (or null if no target is provided and run on zim
58161
58183
  target.zimLastObj[i] = rewind?target.zimTweenOriginals[i]:obj[i];
58162
58184
  }
58163
58185
  }
58164
-
58186
+
58165
58187
  function relativeSetAdjust() {
58166
58188
  var newStart;
58167
58189
  for (i in set) {
58168
58190
  if (typeof set[i] == "string" && i != "transform") {
58191
+
58169
58192
  if (i.substring && i.substring(0,1)==".") {
58170
58193
  if (set[i].substr(0,1)=="+"||set[i].substr(0,1)=="-") continue;
58171
58194
  } else {
@@ -58353,14 +58376,13 @@ RETURNS the target for chaining (or null if no target is provided and run on zim
58353
58376
  delete obj.path;
58354
58377
  obj.pathRatio = 1; // this is what we are animating to
58355
58378
  }
58356
-
58357
- // !!!!! fix for dot values
58358
-
58379
+
58359
58380
  // PREPARE START VALUES - now that pathRatio is set
58360
58381
  // moved to prepareRelative
58361
58382
  // if (from) obj = getFroms(target, obj, set, true);
58362
58383
  var startObj = {} // for later getStart()
58363
58384
  function getFroms(target, obj, set, update) {
58385
+
58364
58386
  fromCheck = true;
58365
58387
  // animating based on pathRatio - but API is percentComplete
58366
58388
  // with from set, this causes problems - so add pathRatio equal to percentComplete to set
@@ -58373,9 +58395,17 @@ RETURNS the target for chaining (or null if no target is provided and run on zim
58373
58395
  if (set && !zot(set[i])) {
58374
58396
  newObj[i] = set[i];
58375
58397
  } else {
58376
- newObj[i] = target[i];
58398
+ if (i.match(/\./)) { // handle dot props like threejs - patched ZIM 018
58399
+ var bunch = i.split(/\./g);
58400
+ newObj[i] = target[bunch[1]][bunch[2]];
58401
+ } else {
58402
+ newObj[i] = target[i];
58403
+ }
58377
58404
  }
58378
- if (update) target[i] = obj[i];
58405
+ if (update) {
58406
+ if (i.match(/\./)) target[bunch[1]][bunch[2]] = obj[i];
58407
+ else target[i] = obj[i];
58408
+ }
58379
58409
  }
58380
58410
  return newObj;
58381
58411
  }
@@ -59090,9 +59120,9 @@ RETURNS the target for chaining (or null if no target is provided and run on zim
59090
59120
  if (!startTest) {
59091
59121
  obj2 = getStart();
59092
59122
  startTest = true;
59093
- }
59094
-
59095
- if (target.set && !from) target.set(set);
59123
+ }
59124
+ checkSets();
59125
+ // if (target.set && !from) target.set(set);
59096
59126
  tween = target.zimTweens[id] = target.zimTween = createjs.Tween.get(target, cjsProps)
59097
59127
  .call(doStartCall)
59098
59128
  .to(obj, t, finalEase)
@@ -59147,7 +59177,9 @@ RETURNS the target for chaining (or null if no target is provided and run on zim
59147
59177
  }
59148
59178
  }
59149
59179
  function tween2(lastTween) {
59150
- if (target.set && !from) {target.set(set);}
59180
+
59181
+ checkSets();
59182
+ // if (target.set && !from) {target.set(set);}
59151
59183
  tween = target.zimTweens[id] = target.zimTween = createjs.Tween.get(target, cjsProps)
59152
59184
  .call(doStartCall)
59153
59185
  .to(obj, t, finalEase)
@@ -59242,6 +59274,26 @@ RETURNS the target for chaining (or null if no target is provided and run on zim
59242
59274
  }
59243
59275
  }
59244
59276
 
59277
+ function checkSets() {
59278
+ if (!from) {
59279
+ if (set) {
59280
+ if (target.set) {
59281
+ target.set(set);
59282
+ } else {
59283
+ if (target)
59284
+ for (i in set) {
59285
+ if (i.match(/\./)) { // handle dot props like threejs - patched ZIM 018
59286
+ var bunch = i.split(/\./g);
59287
+ target[bunch[0]][bunch[1]] = set[i];
59288
+ } else {
59289
+ target[i] = set[i];
59290
+ }
59291
+ }
59292
+ }
59293
+ }
59294
+ }
59295
+ }
59296
+
59245
59297
  function transferIds(lastTween, tween) {
59246
59298
  tween.zimIdSet = lastTween.zimIdSet; // know we need this one - not sure about the rest 10.4.0
59247
59299
  tween.zimObj = lastTween.zimObj;
@@ -74075,7 +74127,7 @@ dispatches a "swipestop" event when swipeup has happened and value has stopped c
74075
74127
  //-69.5
74076
74128
 
74077
74129
  /*--
74078
- zim.MotionController = function(target, type, speed, axis, boundary, map, diagonal, damp, flip, orient, constant, firstPerson, turnSpeed, moveThreshold, stickThreshold, container, localBoundary, mouseMoveOutside, mousedownIncludes, minPercentSpeed, maxPercentSpeed, dampKeyup, rotate, mouseOutside, tileObj, penDown, offTime)
74130
+ zim.MotionController = function(target, type, speed, axis, boundary, map, diagonal, damp, flip, orient, constant, firstPerson, turnSpeed, moveThreshold, stickThreshold, container, localBoundary, mouseMoveOutside, mousedownIncludes, minPercentSpeed, maxPercentSpeed, dampKeyup, rotate, mouseOutside, tileObj, penDown, offTime, startAngle)
74079
74131
 
74080
74132
  MotionController
74081
74133
  zim class - extends a createjs EventDispatcher
@@ -74269,7 +74321,7 @@ METHODS
74269
74321
  pause(state, time) - state defaults to true and pauses the motionController (sets speed to 0)
74270
74322
  set state to false to unpause the motionController (sets speed to speed before pausing)
74271
74323
  set the time (default 0) to the seconds to take while slowing the motionController to 0 speed (also see ZIM TIME constant)
74272
- immediate(x, y) - set the damping immediately to this value to avoid damping to value - returns object for chaining
74324
+ immediate(x, y, rotation) - set the damping immediately to this value to avoid damping to value - returns object for chaining
74273
74325
  convert(x, y) - for manual mode, pass in x and y and damping and rotation will be calculated
74274
74326
  dispose() - remove listeners and Ticker, Swiper and GamePad, where applicable
74275
74327
 
@@ -74313,8 +74365,8 @@ dispatches a "mousedown" event if type is "mousedown" or "pressmove"
74313
74365
  dispatches a "pressing" event if type is "pressmove" - note, this dispatches even if not moving
74314
74366
  dispatches a "moving" event if target is moving and "startmoving" and "stopmoving" events
74315
74367
  --*///+69.7
74316
- zim.MotionController = function(target, type, speed, axis, boundary, map, diagonal, damp, flip, orient, constant, firstPerson, turnSpeed, moveThreshold, stickThreshold, container, localBoundary, mouseMoveOutside, mousedownIncludes, minPercentSpeed, maxPercentSpeed, dampKeyup, rotate, mouseOutside, tileObj, penDown, offTime) {
74317
- var sig = "target, type, speed, axis, boundary, map, diagonal, damp, flip, orient, constant, firstPerson, turnSpeed, moveThreshold, stickThreshold, container, localBoundary, mouseMoveOutside, mousedownIncludes, minPercentSpeed, maxPercentSpeed, dampKeyup, rotate, mouseOutside, tileObj, penDown, offTime";
74368
+ zim.MotionController = function(target, type, speed, axis, boundary, map, diagonal, damp, flip, orient, constant, firstPerson, turnSpeed, moveThreshold, stickThreshold, container, localBoundary, mouseMoveOutside, mousedownIncludes, minPercentSpeed, maxPercentSpeed, dampKeyup, rotate, mouseOutside, tileObj, penDown, offTime, startAngle) {
74369
+ var sig = "target, type, speed, axis, boundary, map, diagonal, damp, flip, orient, constant, firstPerson, turnSpeed, moveThreshold, stickThreshold, container, localBoundary, mouseMoveOutside, mousedownIncludes, minPercentSpeed, maxPercentSpeed, dampKeyup, rotate, mouseOutside, tileObj, penDown, offTime, startAngle";
74318
74370
  var duo; if (duo = zob(zim.MotionController, arguments, sig, this)) return duo;
74319
74371
  z_d("69.7");
74320
74372
 
@@ -74431,6 +74483,7 @@ dispatches a "moving" event if target is moving and "startmoving" and "stopmovin
74431
74483
  if (container && container.backing) this.mousedownIncludes.push(container.backing);
74432
74484
  // this.mousedownExcludes = mousedownExcludes;
74433
74485
  if (zot(dampKeyup)) dampKeyup = .3;
74486
+ if (zot(startAngle)) startAngle = 0;
74434
74487
 
74435
74488
  if (boundary && boundary.type!="Blob") {
74436
74489
  target.x = zim.constrain(target.x, boundary.x, boundary.x+boundary.width);
@@ -74824,6 +74877,7 @@ dispatches a "moving" event if target is moving and "startmoving" and "stopmovin
74824
74877
  speedY = trig.speedY;
74825
74878
 
74826
74879
  if (!rotate) return;
74880
+
74827
74881
  if (!zot(trig.angle)) that.rotation = trig.angle+target.zimMCStartAngle;
74828
74882
  if (zot(that.rotation)) {
74829
74883
  that.rotation = that.target.rotation;
@@ -74845,6 +74899,7 @@ dispatches a "moving" event if target is moving and "startmoving" and "stopmovin
74845
74899
  that.dampR.immediate(oldR); // required otherwise damping equation has mind of its own
74846
74900
  that.target.rotation = oldR; // make sure to set this again as we may have changed oldR for proper rotational direction when damped
74847
74901
  that.rotation = newR;
74902
+
74848
74903
  }
74849
74904
  function normalizeAngle(a) {
74850
74905
  return (a % 360 + 360) % 360;
@@ -74906,7 +74961,7 @@ dispatches a "moving" event if target is moving and "startmoving" and "stopmovin
74906
74961
 
74907
74962
  function makeKeyInterval() {
74908
74963
 
74909
- that.keyInterval = interval(time, function() {
74964
+ that.keyInterval = interval(time, function() {
74910
74965
  if (down && down[0]==0&&down[1]==0&&down[2]==0&down[3]==0) {
74911
74966
  that.keyInterval.clear();
74912
74967
  that.keyInterval = null;
@@ -74982,7 +75037,7 @@ dispatches a "moving" event if target is moving and "startmoving" and "stopmovin
74982
75037
  var mainTicker = zim.Ticker.add(function() {
74983
75038
  if (tileObj) return;
74984
75039
  if (target.draggingCheck) return;
74985
- if (type == "manual") calculate();
75040
+ if (type == "manual" && !dPad) calculate();
74986
75041
  if (that.boundary && that.boundary.type!="Blob") {
74987
75042
  that.x = zim.constrain(that.x, that.boundary.x, that.boundary.x+that.boundary.width);
74988
75043
  that.y = zim.constrain(that.y, that.boundary.y, that.boundary.y+that.boundary.height);
@@ -86847,7 +86902,7 @@ loadAssets(assets, path, progress, xhr, time, loadTimeout, outputAudioSprite, cr
86847
86902
  note: this means the Bitmap will be interactive everywhere - not just in opaque areas
86848
86903
  note: loading images this way will not count as progress (bytes loaded ratio) in the progress event but do count for fileloaded and complete events
86849
86904
  asset can be a ZIM multi-asset object {assets:[], path:"dir/", loadTimeout:1, maxNum:num, noCORSonImage:true}
86850
- where the array can hold multiple files that will have the provided properties applied
86905
+ where the array can hold multiple files that will have the provided properties applied
86851
86906
  this is handy for loading assets from multiple directories (added in ZIM Cat 02 - thanks Netanela for the prompting)
86852
86907
  eg.
86853
86908
  [
@@ -86892,6 +86947,8 @@ loadAssets(assets, path, progress, xhr, time, loadTimeout, outputAudioSprite, cr
86892
86947
  ]
86893
86948
  }}
86894
86949
  See also previewAudioSprite() method in the META section of docs.
86950
+ DO NOT put an audioSprite in a multi-assets object if there is another path defined - we hope to fix for ZIM 019
86951
+ Instead, make the path for the audioSprite be the main path and put the other path in the multi-assets object
86895
86952
  path - pass in an optional path String that gets prepended to the asset
86896
86953
  when accessing the asset with the asset() method you do NOT include the path
86897
86954
  assets with an absolute URL (http[s]://etc.) will ignore path
@@ -88002,6 +88059,7 @@ zim.Frame = function(scaling, width, height, color, outerColor, ready, assets, p
88002
88059
  // 018 TRYING TO FIX CREATEJS ERROR IF SOUND LOADED AGAIN - BUT BREAKS LAZY LOAD
88003
88060
  // var emptyAssets = false;
88004
88061
 
88062
+
88005
88063
  for (i=0; i<assets.length; i++) {
88006
88064
  a = assets[i];
88007
88065
  // if (zim.assets[a]) {
@@ -88033,7 +88091,13 @@ zim.Frame = function(scaling, width, height, color, outerColor, ready, assets, p
88033
88091
  fonts.push(aj);
88034
88092
  } else if (zim.assetIDs[aj]) {
88035
88093
  assetMulti.push({id:a.path+aj, src:a.path+aj, path:null, loadTimeout:a.loadTimeout, maxNum:a.maxNum, noCORSonImage:a.noCORSonImage});
88036
- } else {
88094
+ } else if (aj.audioSprite) {
88095
+ // ZIM 018 attempted patch for audioSprite not working in multi-assets object
88096
+ // tried passing path but it substitutes it somewhere with the default path - boo
88097
+ // so tried what was used with assetIDs above and it still does it.
88098
+ // assetMulti.push({id:a.path+aj.src, src:a.path+aj.src, path:null, audioSprite:aj.audioSprite, data:aj.data, loadTimeout:a.loadTimeout, maxNum:a.maxNum, noCORSonImage:a.noCORSonImage});
88099
+ assetMulti.push({id:aj.src, src:aj.src, path:aj.path, audioSprite:aj.audioSprite, data:aj.data, loadTimeout:a.loadTimeout, maxNum:a.maxNum, noCORSonImage:a.noCORSonImage});
88100
+ } else {
88037
88101
  assetMulti.push({id:aj, src:aj, path:a.path, loadTimeout:a.loadTimeout, maxNum:a.maxNum, noCORSonImage:a.noCORSonImage});
88038
88102
  }
88039
88103
  }
@@ -88067,7 +88131,7 @@ zim.Frame = function(scaling, width, height, color, outerColor, ready, assets, p
88067
88131
  replacement.push({id:r[0], startTime:Math.round(r[1]*1000), duration:Math.round((r[2]-r[1])*1000)});
88068
88132
  }
88069
88133
  delete(obj.audioSprite); // the ZIM data
88070
- obj.data = {audioSprite:replacement}; // the CreateJS data
88134
+ obj.data = {audioSprite:replacement}; // the CreateJS data
88071
88135
  manifest.push(obj);
88072
88136
  } else if (a.data && a.data.audioSprite) { // CreateJS AudioSprite
88073
88137
  obj = zim.copy(a);
@@ -88091,13 +88155,13 @@ zim.Frame = function(scaling, width, height, color, outerColor, ready, assets, p
88091
88155
  found = url.match(/(.*?)([^/])\/[^/]/);
88092
88156
  url = found[1]+found[2];
88093
88157
  a.src = url+a.path+a.src;
88094
- } else {
88095
- var pname = WW.location.pathname;
88158
+ } else {
88159
+ var pname = WW.location.pathname;
88096
88160
  url = WW.location.href;
88097
88161
  var fileOnly = url.split(pname)[0] + pname;
88098
88162
  found = fileOnly.match(/(.*)\//);
88099
88163
  a.path = a.path.replace(/^\.\//,"");
88100
- var goBack = a.path.match(/\.\.\//g);
88164
+ var goBack = a.path.match(/\.\.\//g);s
88101
88165
  var pref = found[1];
88102
88166
  if (goBack) {
88103
88167
  for (z_i=0; z_i<goBack.length; z_i++) {
@@ -88136,7 +88200,7 @@ zim.Frame = function(scaling, width, height, color, outerColor, ready, assets, p
88136
88200
  queue.loadAssetsCount--;
88137
88201
  if (queue.loadAssetsCount == 0) endAssetLoad();
88138
88202
  }
88139
- } else {
88203
+ } else {
88140
88204
  zim.assetIDs[a.id] = a.src;
88141
88205
  var mn = a.maxNum;
88142
88206
  if (zot(mn)) mn = maxNum;
@@ -88171,7 +88235,7 @@ zim.Frame = function(scaling, width, height, color, outerColor, ready, assets, p
88171
88235
  if (soundCheck && firstSoundCheck) {
88172
88236
  // dynamically make audio tag with sound to overcome some Apple devices not playing sounds
88173
88237
  var audioTag = document.createElement("audio");
88174
- audioTag.setAttribute("src", ((!zot(path) && !a.match(/^http:\/\/|https:\/\//i))?path:"")+a);
88238
+ audioTag.setAttribute("src", ((!zot(path) && !a.match(/^http:\/\/|https:\/\/|file:\/\//i))?path:"")+a);
88175
88239
  document.body.appendChild(audioTag);
88176
88240
  firstSoundCheck = false;
88177
88241
  }
@@ -91065,33 +91129,38 @@ Note: there are more features to the Web Speech API - see the HTML docs
91065
91129
 
91066
91130
  var SpeechRecognition = WW.SpeechRecognition || WW.webkitSpeechRecognition;
91067
91131
  var SpeechGrammarList = WW.SpeechGrammarList || WW.webkitSpeechGrammarList;
91132
+
91133
+ var recognition;
91134
+ var SpeechRecognitionEvent = WW.SpeechRecognitionEvent || WW.webkitSpeechRecognitionEvent;
91068
91135
  // this is causing an error on firefox even though they use this in their examples
91069
91136
  // and we have all the speech about:config setting set to true
91070
- var SpeechRecognitionEvent = WW.SpeechRecognitionEvent || WW.webkitSpeechRecognitionEvent;
91071
- var recognition = this.recognition = new SpeechRecognition();
91072
- recognition.continuous = false;
91073
- recognition.lang = this.language = "en-US";
91074
- recognition.interimResults = true;
91075
- recognition.maxAlternatives = 1;
91076
-
91077
- recognition.addEventListener("result", function(e) {
91078
- var ev = new createjs.Event("result");
91079
- ev.words = e.results[0][0].transcript;
91080
- ev.confidence = e.results[0][0].confidence;
91081
- that.dispatchEvent(ev);
91082
- });
91083
- recognition.addEventListener("speechend", function(e) {
91084
- recognition.stop();
91085
- that.dispatchEvent(e);
91086
- });
91087
- recognition.addEventListener("error", function(e) {
91088
- that.dispatchEvent(e);
91089
- });
91137
+ // so test for existence
91138
+ if (typeof SpeechRecognition != "undefined") {
91139
+ recognition = this.recognition = new SpeechRecognition();
91140
+ recognition.continuous = false;
91141
+ recognition.lang = this.language = "en-US";
91142
+ recognition.interimResults = true;
91143
+ recognition.maxAlternatives = 1;
91144
+
91145
+ recognition.addEventListener("result", function(e) {
91146
+ var ev = new createjs.Event("result");
91147
+ ev.words = e.results[0][0].transcript;
91148
+ ev.confidence = e.results[0][0].confidence;
91149
+ that.dispatchEvent(ev);
91150
+ });
91151
+ recognition.addEventListener("speechend", function(e) {
91152
+ recognition.stop();
91153
+ that.dispatchEvent(e);
91154
+ });
91155
+ recognition.addEventListener("error", function(e) {
91156
+ that.dispatchEvent(e);
91157
+ });
91158
+ }
91090
91159
 
91091
91160
  }
91092
91161
 
91093
91162
  this.listen = function(interim, language) {
91094
- if (M=="ios") {zogy("not supported on iOS Web"); return this;}
91163
+ if (M=="ios" || !recognition) {zogy("Speech recognition not supported - search how to activate"); return this;}
91095
91164
  if (zot(interim)) interim = true;
91096
91165
  recognition.interimResults = this.interim = interim;
91097
91166
  if (zot(language)) recognition.lang = this.language;
@@ -91113,7 +91182,10 @@ Note: there are more features to the Web Speech API - see the HTML docs
91113
91182
  var sig = "text, voice, volume, lang, rate, pitch";
91114
91183
  var duo; if (duo = zob(this.talk, arguments, sig)) return duo;
91115
91184
 
91116
- if (typeof speechSynthesis == "undefined") return;
91185
+ if (typeof speechSynthesis == "undefined") {
91186
+ zogy("Speech synthesis not supported - search how to activate");
91187
+ return;
91188
+ }
91117
91189
  // https://wicg.github.io/speech-api
91118
91190
  if (zot(text)) return;
91119
91191
  var utter = new SpeechSynthesisUtterance();
@@ -91140,13 +91212,13 @@ Note: there are more features to the Web Speech API - see the HTML docs
91140
91212
  }
91141
91213
 
91142
91214
  this.stopTalking = function() {
91143
- if (speechSynthesis) speechSynthesis.cancel();
91215
+ if (typeof speechSynthesis != "undefined") speechSynthesis.cancel();
91144
91216
  }
91145
91217
  this.pauseTalking = function() {
91146
- if (speechSynthesis) speechSynthesis.pause();
91218
+ if (typeof speechSynthesis != "undefined") speechSynthesis.pause();
91147
91219
  }
91148
91220
  this.resumeTalking = function() {
91149
- if (speechSynthesis) speechSynthesis.resume();
91221
+ if (typeof speechSynthesis != "undefined") speechSynthesis.resume();
91150
91222
  }
91151
91223
 
91152
91224
  this.getVoices = function() {
@@ -95917,6 +95989,10 @@ https://zimjs.com/015/textureactive_raw.html
95917
95989
  ZIM in VR
95918
95990
  https://zimjs.com/015/vr.html - use triggers (drag), sticks (motion) and b and y buttons (teleport)
95919
95991
 
95992
+ ZIM Central
95993
+ Use ZIM in Frame scaling:FULL and ZIM Central() to match ZIM scaling with three.js fullscreen scaling
95994
+ https://zimjs.com/three/central.html
95995
+
95920
95996
  Z-Dog is a quick alternative for three.js - here are a couple examples
95921
95997
  https://codepen.io/zimjs/pen/joXxGJ
95922
95998
  https://codepen.io/zimjs/pen/rgEEXy
@@ -95964,6 +96040,32 @@ const dial = new Dial({min:0, max:360, step:0, continuous:true}).pos(70,0,LEFT,C
95964
96040
  });
95965
96041
  END EXAMPLE
95966
96042
 
96043
+ EXAMPLE
96044
+ // use ZIM Central() to make a threejs-like full scale but centered experience
96045
+ new Frame({ready, color:yellow}); // use FULL mode (default)
96046
+ function ready() {
96047
+ const three = new Three({
96048
+ width:W,
96049
+ height:H,
96050
+ cameraPosition:new THREE.Vector3(-200,200,300),
96051
+ colorManagement:true,
96052
+ interactive:false,
96053
+ full:true, // add full screen three.js
96054
+ lay:OVER // or UNDER - see https://zimjs.com/three/central.html
96055
+ });
96056
+ const geometry = new THREE.BoxGeometry(100,100,100);
96057
+ const material = new THREE.MeshNormalMaterial();
96058
+ const mesh = new THREE.Mesh(geometry, material);
96059
+ three.scene.add(mesh);
96060
+
96061
+ const central = new Central().center();
96062
+
96063
+ new Slider({currentValue:5})
96064
+ .pos(0,200,CENTER,CENTER,central)
96065
+ .wire(mesh.rotation, "y");
96066
+ }
96067
+ END EXAMPLE
96068
+
95967
96069
  PARAMETERS
95968
96070
  ** supports DUO - parameters or single object with properties below
95969
96071
  width - (default ZIM Frame width) the width to make the three.js canvas