zimjs 16.2.4 → 16.2.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zimjs",
3
- "version": "16.2.4",
3
+ "version": "16.2.6",
4
4
  "type": "module",
5
5
  "main": "./src/zim.js",
6
6
  "types": "./ts-src/typings/zim",
package/src/zim.js CHANGED
@@ -3458,8 +3458,8 @@ NOTE: as of ZIM 5.5.0 the zim namespace is no longer required (unless zns is set
3458
3458
  EXAMPLE
3459
3459
  const blob = new Blob().center();
3460
3460
  const points = blob.segmentPoints;
3461
- S.on("stagemousedown", e=>{
3462
- const point = blob.globalToLocal(e.stageX, e.stageY)
3461
+ S.on("stagemousedown", ()=>{
3462
+ const point = blob.globalToLocal(F.mouseX, F.mouseY)
3463
3463
  zog(closestPointAlongCurve({x:point.x, y:point.y}, points))
3464
3464
  // gives index of point on curve before mouse location
3465
3465
  });
@@ -9237,14 +9237,14 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
9237
9237
  recursiveDispose(this, disposing);
9238
9238
  return true;
9239
9239
  };
9240
- zim.Container.prototype.specialColor = function(command, co, obj) {
9240
+ zim.Container.prototype.specialColor = function(command, co, obj, bounds) {
9241
9241
  if (co.type=="GradientColor") {
9242
9242
  if (!zot(co.angle)) {
9243
- if (!obj.width) {
9243
+ if (!obj.width && zot(bounds)) {
9244
9244
  command.style = co.colors[0];
9245
9245
  return;
9246
9246
  } else {
9247
- var b = obj.getBounds();
9247
+ var b = bounds?bounds:obj.getBounds();
9248
9248
  co.angle += 360*100000;
9249
9249
  co.angle %= 360;
9250
9250
 
@@ -9297,12 +9297,12 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
9297
9297
 
9298
9298
  } else if (co.type=="RadialColor") {
9299
9299
 
9300
- if (zot(co.x0)) {
9300
+ if (zot(co.x0) && zot(bounds)) {
9301
9301
  if (!obj.width) {
9302
9302
  command.style = co.colors[0];
9303
9303
  return;
9304
9304
  } else {
9305
- var b = obj.getBounds();
9305
+ var b = bounds?bounds:obj.getBounds();
9306
9306
  co.r0 = 0;
9307
9307
  if (obj.type=="Circle") {
9308
9308
  co.x0 = 0;
@@ -13788,7 +13788,8 @@ clone(exact) - makes a copy of the shape
13788
13788
  For instance, if the object's color is [blue, green]
13789
13789
  then its clone might be blue or green - which could be different than the original
13790
13790
  If exact is set to true then the clone will be the color of the original object
13791
- cloneAll(exact, style, group, inherit) - copies shape and any custom content in shape - experimental - usually shapes do not have content (use a Container)
13791
+ Warning: clone does not clone any content added to a shape - use a Container for that - see cloneAll()
13792
+ cloneAll(exact, style, group, inherit) - copies shape and any custom content in shape - experimental
13792
13793
  exact (default false) in theory will copy ZIM VEE values as they are in the original
13793
13794
  see main class for style, group, inherit parameters
13794
13795
  dispose() - removes from parent, removes event listeners - must still set outside references to null for garbage collection
@@ -14062,7 +14063,8 @@ clone(exact) - makes a copy of the shape
14062
14063
  For instance, if the object's color is [blue, green]
14063
14064
  then its clone might be blue or green - which could be different than the original
14064
14065
  If exact is set to true then the clone will be the color of the original object
14065
- cloneAll(exact style, group, inherit) - copies shape and any custom content in shape - experimental - usually shapes do not have content (use a Container)
14066
+ Warning: clone does not clone any content added to a shape - use a Container for that - see cloneAll()
14067
+ cloneAll(exact style, group, inherit) - copies shape and any custom content in shape - experimental
14066
14068
  exact (default false) in theory will copy ZIM VEE values as they are in the original
14067
14069
  see main class for style, group, inherit parameters
14068
14070
  dispose() - removes from parent, removes event listeners - must still set outside references to null for garbage collection
@@ -14305,12 +14307,13 @@ if one color is used, the current color is used and color1 is the second color i
14305
14307
  cache(see Container docs for parameter description) - overrides CreateJS cache() and returns object for chaining
14306
14308
  Leave parameters blank to cache bounds of shape (plus outer edge of border if borderWidth > 0)
14307
14309
  hasProp(property as String) - returns true if property exists on object else returns false
14308
- clone() - makes a copy of the shape
14309
- exact (default false) ZIM VEE (Pick) values are active in clones unless exact is set to true
14310
+ clone(exact) - makes a copy of the shape
14311
+ exact (default false) ZIM VEE (Pick) values are active in clones unless exact is set to true
14310
14312
  For instance, if the object's color is [blue, green]
14311
14313
  then its clone might be blue or green - which could be different than the original
14312
14314
  If exact is set to true then the clone will be the color of the original object
14313
- cloneAll(exact style, group, inherit) - copies shape and any custom content in shape - experimental - usually shapes do not have content (use a Container)
14315
+ Warning: clone does not clone any content added to a shape - use a Container for that - see cloneAll()
14316
+ cloneAll(exact style, group, inherit) - copies shape and any custom content in shape - experimental
14314
14317
  exact (default false) in theory will copy ZIM VEE values as they are in the original
14315
14318
  see main class for style, group, inherit parameters
14316
14319
  exact (default false) in theory will copy ZIM VEE values as they are in the original
@@ -16655,7 +16658,7 @@ Note the points property has been split into points and pointObjects (and there
16655
16658
  draggable:true,
16656
16659
  });
16657
16660
  var textArea = that.textArea = new zim.TextArea(Math.min(400, that.stage.width-70), Math.min(400, that.stage.height-70));
16658
- textArea.centerReg(pane);
16661
+ pane.add(textArea);
16659
16662
  }
16660
16663
  that.textArea.text = JSON.stringify(points);
16661
16664
  that.pane.show();
@@ -17349,7 +17352,6 @@ Note the points property has been split into points and pointObjects (and there
17349
17352
  };
17350
17353
  }
17351
17354
  function insertPointData(points, controls, ratios, percent, controlType, skipPoint, dataOnly, even) {
17352
-
17353
17355
  var index = points.length-1; // adjust for squiggle
17354
17356
  var lastRatio = 0;
17355
17357
  var currentRatio = 0;
@@ -17392,6 +17394,9 @@ Note the points property has been split into points and pointObjects (and there
17392
17394
  points[(index+1)%points.length][5] = end.y;
17393
17395
  }
17394
17396
  if (controlType) newPoint[8] = controlType;
17397
+ // else newPoint[8] = "straight";
17398
+ // points[index][8] = "straight"
17399
+ // points[index+1][8] = "straight"
17395
17400
  points.splice(index+1, 0, newPoint);
17396
17401
  return index+1;
17397
17402
  }
@@ -18836,7 +18841,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
18836
18841
  draggable:true,
18837
18842
  });
18838
18843
  var textArea = that.textArea = new zim.TextArea(Math.min(400, that.stage.width-70), Math.min(400, that.stage.height-70));
18839
- textArea.centerReg(pane);
18844
+ pane.add(textArea);
18840
18845
  }
18841
18846
  pane.show();
18842
18847
  textArea.text = JSON.stringify(points);
@@ -19577,6 +19582,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
19577
19582
  points[(index+1)%points.length][5] = end.y;
19578
19583
  }
19579
19584
  if (controlType) newPoint[8] = controlType;
19585
+
19580
19586
  points.splice(index+1, 0, newPoint);
19581
19587
  return index+1;
19582
19588
  }
@@ -33840,7 +33846,6 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
33840
33846
  selector = this.selector = new zim.Rectangle(targetW, targetH, zim.faint, zim.faint, borderWidth, corner, dashed, {ignoreScale:!resizeScale})
33841
33847
  .centerReg(that);
33842
33848
  selector.loc(tile.width/2, target.y+paddingV, that, behind?0:1);
33843
- zog(tile.width/2, target.y+paddingV)
33844
33849
  selector.visible = false;
33845
33850
  }
33846
33851
  if (!(selectedIndex < 0 || zot(currentItem))) {
@@ -36132,6 +36137,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
36132
36137
  this.type = "NumPad";
36133
36138
 
36134
36139
  var that = this;
36140
+
36135
36141
 
36136
36142
  function ms(letter, color) {
36137
36143
  if (zot(color)) color = mist;
@@ -36141,7 +36147,12 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
36141
36147
  ms("C",zim.red.darken(.1)),ms(new zim.Label({text:"␣", size:90, shiftV:-24}),zim.yellow.darken(.1)),ms(new zim.Label({text:"/",size:48,bold:true,shiftV:3})),ms(new zim.Label({text:"*", size:65, shiftV:18})),
36142
36148
  1,2,3,ms(new zim.Label({text:"-",size:60,shiftV:-3})),4,5,6,ms(new zim.Label({text:"+",size:55,shiftV:3})),
36143
36149
  7,8,9,ms(new zim.Label({text:"⌫",size:M=="ios"?60:35}), zim.red.darken(.1)),
36144
- ms(new zim.Label({text:",",size:70,shiftV:-3})),ms(new Label({text:".",size:70,shiftV:-3})),0,ms(new zim.Label({text:"⏎", size:M=="ios"?40:50, shiftV:5}), zim.green.darken(.1))]
36150
+ ms(new zim.Label({text:",",size:70,shiftV:-3})),ms(new Label({text:".",size:70,shiftV:-3})),0,ms(new zim.Label({text:"⏎", size:M=="ios"?40:50, shiftV:5}), zim.green.darken(.1))];
36151
+
36152
+
36153
+ function isRTL(){
36154
+ return getComputedStyle(zdf.canvas).direction == "rtl";
36155
+ };
36145
36156
  if (advanced=="simple") {
36146
36157
  padArray.splice(0,4);
36147
36158
  padArray.splice(3,1);
@@ -36153,8 +36164,8 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
36153
36164
  } else if (advanced) {
36154
36165
  padArray.splice(2,0,ms("%", yellow.darken(.1)));
36155
36166
  padArray.splice(4,0,ms(new zim.Label({text:"^",size:47,shiftV:10}), yellow.darken(.1)));
36156
- padArray.splice(4,0,ms(")", yellow.darken(.1)));
36157
- padArray.splice(4,0,ms("(", yellow.darken(.1)));
36167
+ padArray.splice(4,0,ms(isRTL()?"(":")", yellow.darken(.1)));
36168
+ padArray.splice(4,0,ms(isRTL()?")":"(", yellow.darken(.1)));
36158
36169
  }
36159
36170
  that.pad = new zim.Pad({
36160
36171
  width:advanced=="simple"?290:380,
@@ -39264,6 +39275,7 @@ Dispatches a "keydown" event with an event object having a letter property
39264
39275
  keyboard.on("keydown", function(e) {zog(e.letter);}); // logs letter pressed or "del" for delete
39265
39276
  Dispatches a "special" event if the special parameter is used and the special key is pressed
39266
39277
  Dispatches a "close" event when close keyboard icon at bottom right is pressed
39278
+ Dispatches "numpadopen" and "numpadclose" events when the NumPad is opened or closed
39267
39279
 
39268
39280
  ALSO: see the CreateJS Easel Docs for Container events such as:
39269
39281
  added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmove, pressup, removed, rollout, rollover
@@ -40040,15 +40052,18 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
40040
40052
  that.toggled = false;
40041
40053
  removeCursorShiftMenu();
40042
40054
  }
40055
+ that.dispatchEvent("numpadclose");
40043
40056
  });
40044
40057
  }
40045
40058
 
40046
40059
  numPadKey.removeChildAt(2);
40047
40060
  if (that.numPad.parent || status === false) {
40048
40061
  that.numPad.removeFrom();
40062
+ that.dispatchEvent("numpadclose");
40049
40063
  showNumPadIcon.clone().scaleTo(numPadKey, 60, 60).centerReg(numPadKey,2);
40050
40064
  } else if (!that.numPad.parent || status === true) {
40051
40065
  that.numPad.addTo();
40066
+ that.dispatchEvent("numpadopen");
40052
40067
  hideNumPadIcon.clone().scaleTo(numPadKey, 60, 60).centerReg(numPadKey,2);
40053
40068
  }
40054
40069
  currentKeyboard.updateCache();
@@ -50397,9 +50412,8 @@ RETURNS obj for chaining
50397
50412
  if (!redoChache) obj.updateCache();
50398
50413
  else obj.cache();
50399
50414
  }
50400
- if (obj.alphaMask) {
50401
- zog(obj.alphaMask.type)
50402
- obj.alphaMask.updateCache();
50415
+ if (obj.effects && obj.effects.alpha && obj.effects.alpha.alphaMask.updateCache) {
50416
+ obj.effects.alpha.alphaMask.updateCache();
50403
50417
  }
50404
50418
  return obj;
50405
50419
  };//-33.163
@@ -57321,19 +57335,18 @@ There are settings that can adjust when the Ticker updates so see Usage notes be
57321
57335
  NOTE: as of ZIM 5.5.0 the zim namespace is no longer required (unless zns is set to true before running zim)
57322
57336
 
57323
57337
  EXAMPLE
57324
- const circle = new Circle(50, red);
57325
- circle.center();
57338
+ const circle = new Circle(50, red).center();
57326
57339
  Ticker.add(()=>{
57327
57340
  circle.x++;
57328
- }, stage); // stage is optional - will be the first stage made if left out
57341
+ }); // can also pass in a specific stage
57329
57342
 
57330
57343
  // to be able to remove the function:
57331
- Ticker.add(tryMe, stage);
57344
+ Ticker.add(tryMe);
57332
57345
  function tryMe() {circle.x++;}
57333
57346
  Ticker.remove(tryMe);
57334
57347
 
57335
57348
  // OR with function literal, use the return value
57336
- var tickerFunction = Ticker.add(()=>{circle.x++;}, stage);
57349
+ var tickerFunction = Ticker.add(()=>{circle.x++;});
57337
57350
  Ticker.remove(tickerFunction);
57338
57351
 
57339
57352
  // Check to see if a function is in the Ticker for that stage:
@@ -57347,6 +57360,7 @@ however, OPTIMIZE can be overridden as follows (or with the always() method):
57347
57360
  METHODS (static)
57348
57361
  ** As of ZIM 5.1.0, stage is optional and will default to the stage of first Frame object made
57349
57362
  ** WARNING - if you are in a second Frame you should pass stage as a parameter so it does not point to the first Frame's stage
57363
+ ** NOTE - if no stage is provided, the Ticker will update the stage of the zdf - ZIM default frame (usually the first Frame made)
57350
57364
  Ticker.always(stage) - overrides OPTIMIZE and always runs an update for the stage even with no function in queue
57351
57365
  Ticker.alwaysOff(stage) - stops an always Ticker for a stage
57352
57366
  Ticker.add(function, stage) - adds the function to the Ticker queue for a given stage and returns the function that was added
@@ -57724,7 +57738,7 @@ const pages = new Pages({
57724
57738
  }).addTo();
57725
57739
 
57726
57740
  // handle any events inserted into the swipe arrays
57727
- pages.on("info", function(){zog("info requested")});
57741
+ pages.on("info", ()=>{zog("info requested")});
57728
57742
 
57729
57743
  // handle any custom requirements when arriving at a page
57730
57744
  // the event gives you the page object
@@ -57732,13 +57746,13 @@ pages.on("info", function(){zog("info requested")});
57732
57746
  home.name = "home";
57733
57747
  hide.name = "hide";
57734
57748
  find.name = "find";
57735
- pages.on("page", function() {
57749
+ pages.on("page", ()=>{
57736
57750
  zog(pages.page.name); // now we know which page we are on
57737
57751
  })
57738
57752
 
57739
57753
  // you can manually go to pages as well
57740
57754
  // we will make a little triangle to click:
57741
- var back = new Triangle({color:red});
57755
+ const back = new Triangle({color:red});
57742
57756
  back.center(find); // add triangle to find page
57743
57757
  // not really supposed to add things to zim shapes
57744
57758
  // they default to mouseChildren false
@@ -57746,8 +57760,7 @@ back.center(find); // add triangle to find page
57746
57760
  // so we have to set the mouseChildren of find to true
57747
57761
  find.mouseChildren = true;
57748
57762
  back.cur();
57749
- back.on("click", function() {pages.go(home, UP)});
57750
- S.update();
57763
+ back.on("click", ()=>{pages.go(home, UP)});
57751
57764
  END EXAMPLE
57752
57765
 
57753
57766
  PARAMETERS
@@ -58687,6 +58700,125 @@ Additional "mousedown", "click" or other button events can be added if desired
58687
58700
  zim.extend(zim.Arrow, zim.Button, "clone", "zimButton", false);
58688
58701
  //-71.2
58689
58702
 
58703
+
58704
+ /*--
58705
+ zim.HotSpot = function(obj, x, y, width, height, call, callOver, callOut, local, talk)
58706
+
58707
+ HotSpot
58708
+ zim class - extends a zim.Container which extends a createjs.Container
58709
+
58710
+ DESCRIPTION
58711
+ HotSpot adds an invisible button to a container object (often think of this as the page).
58712
+ If you want multiple spots it is more efficient to use the HotSpots class above
58713
+ which manages multiple HotSpot objects (otherwise you end up with multiple event functions).
58714
+ The spot is a pixel rect with an alpha of .01 and then uses a hitArea of a backing shape.
58715
+ The spot will get a cursor of "pointer".
58716
+
58717
+ NOTE: as of ZIM 5.5.0 the zim namespace is no longer required (unless zns is set to true before running zim)
58718
+
58719
+ EXAMPLE
58720
+ const hs = new HotSpot(S, 100, 100, 50, 50, myFunction);
58721
+ function myFunction() {
58722
+ zog("activation!");
58723
+ }
58724
+ // hs.show(); // uncomment this to see rectangle hotSpot
58725
+ END EXAMPLE
58726
+
58727
+ PARAMETERS supports DUO - parameters or single object with properties below
58728
+ holder - container object in which to place the hotspot (stage for instance)
58729
+ x, y, width and height - of the rectangle for the hotspot
58730
+ call - the function to call when the spot is pressed
58731
+ local - (default true) hotSpot rect is based on local coordinates of the container
58732
+ use when the element scale independently from the stage
58733
+ if set to false then you pass in global coordinates and hotSpot will convert them
58734
+ talk - (default "hotspot") text for ZIM Accessibility screen reader
58735
+
58736
+ METHODS
58737
+ show() - helps when creating the spot to see where it is
58738
+ hide() - hides the hotspot
58739
+ dispose() - removes the listener and the spot
58740
+
58741
+ PROPERTIES
58742
+ type - holds the class name as a String
58743
+ spot - the actual hotSpot object that gets added to the container can be accessed with the spot property
58744
+ eg. hs.spot
58745
+
58746
+ ACTIONEVENT
58747
+ This component is affected by the general ACTIONEVENT setting
58748
+ The default is "mousedown" - if set to something else the component will act on click (press)
58749
+ --*///+73
58750
+ zim.HotSpot = function(obj, x, y, width, height, call, callOver, callOut, local, talk) {
58751
+ var sig = "obj, x, y, width, height, call, callOver, callOut, local, talk";
58752
+ var duo; if (duo = zob(zim.HotSpot, arguments, sig, this)) return duo;
58753
+ z_d("73");
58754
+ this.zimContainer_constructor(null,null,null,null,false);
58755
+ this.type = "HotSpot";
58756
+
58757
+ if (zot(obj) || !obj.addChild) {zogy("zim controls - HotSpot():\nPlease pass in container object for obj"); return;}
58758
+ if (obj instanceof createjs.Container == false) {zogy("zim controls - HotSpot():\nObjects passed in should be Containers"); return;}
58759
+ if (zot(x) || zot(y) || zot(width) || zot(height)) {zogy("zim controls - HotSpot():\nPlease pass in x, y, width, height"); return;}
58760
+ if (zot(local)) local = true;
58761
+ var eventType = (!zns?WW.ACTIONEVENT=="mousedown":zim.ACTIONEVENT=="mousedown")?"mousedown":"click";
58762
+
58763
+ var w = width; var h = height;
58764
+ var point,newW,newH;
58765
+ if (!local) {
58766
+ point = obj.globalToLocal(x,y);
58767
+ var point2 = obj.globalToLocal(x+w,y+h);
58768
+ newW = point2.x-point.x;
58769
+ newH = point2.y-point.y;
58770
+ } else {
58771
+ point = new zim.Point(x,y);
58772
+ newW = width;
58773
+ newH = height;
58774
+ }
58775
+ var but = new zim.Shape(width, height);
58776
+ but.talk = zot(talk)?"HotSpot":talk;
58777
+ but.alpha = 0;
58778
+ but.graphics.f("black").dr(0,0,newW,newH);
58779
+ but.x = point.x;
58780
+ but.y = point.y;
58781
+ but.cur("pointer");
58782
+ but.expand(0);
58783
+ this.spot = but;
58784
+
58785
+ if (typeof(call) == "function") {
58786
+ var butEvent = but.on(eventType,function(e) {
58787
+ call(e);
58788
+ });
58789
+ }
58790
+ if (typeof(callOver) == "function") {
58791
+ var butOverEvent = but.on("mouseover",function(e) {
58792
+ callOver(e);
58793
+ });
58794
+ }
58795
+ if (typeof(callOut) == "function") {
58796
+ var butOutEvent = but.on("mouseout",function(e) {
58797
+ callOut(e);
58798
+ });
58799
+ }
58800
+ obj.addChild(but);
58801
+
58802
+ this.show = function() {
58803
+ but.alpha = .5;
58804
+ if (obj.stage) obj.stage.update();
58805
+ };
58806
+ this.hide = function() {
58807
+ but.alpha = 0;
58808
+ if (obj.stage) obj.stage.update();
58809
+ };
58810
+ this.dispose = function() {
58811
+ if (butEvent) but.off(eventType, butOverEvent);
58812
+ if (butOverEvent) but.off("mouseover", butOverEvent);
58813
+ if (butOutEvent) but.off("mouseout", butOutEvent);
58814
+ obj.removeChild(but);
58815
+ but = null;
58816
+ return true;
58817
+ };
58818
+ };
58819
+ zim.extend(zim.HotSpot, zim.Container, "dispose", "zimContainer", false);
58820
+ //-73
58821
+
58690
58822
  /*--
58691
58823
  zim.HotSpots = function(spots, local, mouseDowns)
58692
58824
 
@@ -58703,25 +58835,20 @@ NOTE: as of ZIM 5.5.0 the zim namespace is no longer required (unless zns is set
58703
58835
 
58704
58836
  EXAMPLE
58705
58837
  // our first hotSpot will be a 50 pixel square at 100, 100
58706
- // then we will add hotSpots to these items as well
58707
- var circle = new Circle(60, red);
58708
- circle.center();
58709
58838
 
58710
- const button = new Button();
58711
- S.addChild(button);
58712
- button.x = W - button.width - 100;
58713
- button.y = H - button.height - 100;
58839
+ // then we will add hotSpots to these items as well
58840
+ const circle = new Circle(60, red).center();
58841
+ const button = new Button().pos(100,100,RIGHT,BOTTOM);
58714
58842
 
58715
58843
  // make the hotSpots object
58716
58844
  // these are all on the same page
58717
58845
  // gets really handy when you have multiple pages with Pages
58718
58846
  const hs = new HotSpots([
58719
- {page:stage, rect:[100,100,50,50], call:()=>{zog("hot!");}},
58720
- {page:stage, rect:circle, call:()=>{zog("circle!");}},
58721
- {page:stage, rect:button, call:()=>{zog("button!");}},
58847
+ {page:S, rect:[100,100,50,50], call:()=>{zog("hot!");}},
58848
+ {page:S, rect:circle, call:()=>{zog("circle!");}},
58849
+ {page:S, rect:button, call:()=>{zog("button!");}},
58722
58850
  ]);
58723
58851
  // hs.show(); // uncomment this to see rectangle hotSpots
58724
- S.update();
58725
58852
  END EXAMPLE
58726
58853
 
58727
58854
  PARAMETERS supports DUO - parameters or single object with properties below
@@ -58899,125 +59026,6 @@ the class creates HotSpot objects - see the class underneath this one
58899
59026
  //-72
58900
59027
 
58901
59028
 
58902
- /*--
58903
- zim.HotSpot = function(obj, x, y, width, height, call, callOver, callOut, local, talk)
58904
-
58905
- HotSpot
58906
- zim class - extends a zim.Container which extends a createjs.Container
58907
-
58908
- DESCRIPTION
58909
- HotSpot adds an invisible button to a container object (often think of this as the page).
58910
- If you want multiple spots it is more efficient to use the HotSpots class above
58911
- which manages multiple HotSpot objects (otherwise you end up with multiple event functions).
58912
- The spot is a pixel rect with an alpha of .01 and then uses a hitArea of a backing shape.
58913
- The spot will get a cursor of "pointer".
58914
-
58915
- NOTE: as of ZIM 5.5.0 the zim namespace is no longer required (unless zns is set to true before running zim)
58916
-
58917
- EXAMPLE
58918
- const hs = new HotSpot(stage, 100, 100, 50, 50, myFunction);
58919
- function myFunction() {
58920
- zog("activation!");
58921
- }
58922
- // hs.show(); // uncomment this to see rectangle hotSpot
58923
- S.update();
58924
- END EXAMPLE
58925
-
58926
- PARAMETERS supports DUO - parameters or single object with properties below
58927
- holder - container object in which to place the hotspot (stage for instance)
58928
- x, y, width and height - of the rectangle for the hotspot
58929
- call - the function to call when the spot is pressed
58930
- local - (default true) hotSpot rect is based on local coordinates of the container
58931
- use when the element scale independently from the stage
58932
- if set to false then you pass in global coordinates and hotSpot will convert them
58933
- talk - (default "hotspot") text for ZIM Accessibility screen reader
58934
-
58935
- METHODS
58936
- show() - helps when creating the spot to see where it is
58937
- hide() - hides the hotspot
58938
- dispose() - removes the listener and the spot
58939
-
58940
- PROPERTIES
58941
- type - holds the class name as a String
58942
- spot - the actual hotSpot object that gets added to the container can be accessed with the spot property
58943
- eg. hs.spot
58944
-
58945
- ACTIONEVENT
58946
- This component is affected by the general ACTIONEVENT setting
58947
- The default is "mousedown" - if set to something else the component will act on click (press)
58948
- --*///+73
58949
- zim.HotSpot = function(obj, x, y, width, height, call, callOver, callOut, local, talk) {
58950
- var sig = "obj, x, y, width, height, call, callOver, callOut, local, talk";
58951
- var duo; if (duo = zob(zim.HotSpot, arguments, sig, this)) return duo;
58952
- z_d("73");
58953
- this.zimContainer_constructor(null,null,null,null,false);
58954
- this.type = "HotSpot";
58955
-
58956
- if (zot(obj) || !obj.addChild) {zogy("zim controls - HotSpot():\nPlease pass in container object for obj"); return;}
58957
- if (obj instanceof createjs.Container == false) {zogy("zim controls - HotSpot():\nObjects passed in should be Containers"); return;}
58958
- if (zot(x) || zot(y) || zot(width) || zot(height)) {zogy("zim controls - HotSpot():\nPlease pass in x, y, width, height"); return;}
58959
- if (zot(local)) local = true;
58960
- var eventType = (!zns?WW.ACTIONEVENT=="mousedown":zim.ACTIONEVENT=="mousedown")?"mousedown":"click";
58961
-
58962
- var w = width; var h = height;
58963
- var point,newW,newH;
58964
- if (!local) {
58965
- point = obj.globalToLocal(x,y);
58966
- var point2 = obj.globalToLocal(x+w,y+h);
58967
- newW = point2.x-point.x;
58968
- newH = point2.y-point.y;
58969
- } else {
58970
- point = new zim.Point(x,y);
58971
- newW = width;
58972
- newH = height;
58973
- }
58974
- var but = new zim.Shape(width, height);
58975
- but.talk = zot(talk)?"HotSpot":talk;
58976
- but.alpha = 0;
58977
- but.graphics.f("black").dr(0,0,newW,newH);
58978
- but.x = point.x;
58979
- but.y = point.y;
58980
- but.cur("pointer");
58981
- but.expand(0);
58982
- this.spot = but;
58983
-
58984
- if (typeof(call) == "function") {
58985
- var butEvent = but.on(eventType,function(e) {
58986
- call(e);
58987
- });
58988
- }
58989
- if (typeof(callOver) == "function") {
58990
- var butOverEvent = but.on("mouseover",function(e) {
58991
- callOver(e);
58992
- });
58993
- }
58994
- if (typeof(callOut) == "function") {
58995
- var butOutEvent = but.on("mouseout",function(e) {
58996
- callOut(e);
58997
- });
58998
- }
58999
- obj.addChild(but);
59000
-
59001
- this.show = function() {
59002
- but.alpha = .5;
59003
- if (obj.stage) obj.stage.update();
59004
- };
59005
- this.hide = function() {
59006
- but.alpha = 0;
59007
- if (obj.stage) obj.stage.update();
59008
- };
59009
- this.dispose = function() {
59010
- if (butEvent) but.off(eventType, butOverEvent);
59011
- if (butOverEvent) but.off("mouseover", butOverEvent);
59012
- if (butOutEvent) but.off("mouseout", butOutEvent);
59013
- obj.removeChild(but);
59014
- but = null;
59015
- return true;
59016
- };
59017
- };
59018
- zim.extend(zim.HotSpot, zim.Container, "dispose", "zimContainer", false);
59019
- //-73
59020
-
59021
59029
  /*--
59022
59030
  zim.Guide = function(obj, vertical, pixels, hideKey, pixelKey, style, group, inherit)
59023
59031
 
@@ -61614,7 +61622,7 @@ note: the item is not the event object target - as that is the tile
61614
61622
  if (style!==false) zim.styleTransforms(this, DS); // global function - would have put on DisplayObject if had access to it
61615
61623
 
61616
61624
  this.clone = function(exact) {
61617
- if (unique) exact = true; // added ZIM 016
61625
+ if (zot(exact) && unique) exact = true; // added ZIM 016
61618
61626
  if (exact) {
61619
61627
  var exactItems = [];
61620
61628
  if (backgroundColor) var exactBackgroundColors = [];
@@ -62535,8 +62543,6 @@ sun.beads.animate({
62535
62543
  });
62536
62544
  END EXAMPLE
62537
62545
 
62538
- path, obj, count, angle, startPercent, endPercent, percents, onTop, showControls, visible, interactive, clone, group, style, inherit
62539
-
62540
62546
  PARAMETERS
62541
62547
  ** supports DUO - parameters or single object with properties below
62542
62548
  ** supports VEE - parameters marked with ZIM VEE mean a zim Pick() object or Pick Literal can be passed
@@ -62793,6 +62799,8 @@ regions - an array of region DisplayObjects with specific properties for each re
62793
62799
  align defaults to middle for the regions
62794
62800
  valign defaults to top and bottom for the top and bottom region and middle for the others
62795
62801
  backgroundColor applies a backing color to the region
62802
+ only vertical GradientColor and centered RadialColor are supported at this time
62803
+ so use new GradientColor([blue,green]) or new GradientColor([orange, yellow])
62796
62804
  Example HORIZONTAL region objects
62797
62805
  [{obj:col1, marginLeft:10, maxHeight:80, width:20, valign:"bottom"},
62798
62806
  {obj:col2, marginLeft:5, maxHeight:90, align:MIDDLE}, // note, middle gets no minWidth
@@ -62803,6 +62811,8 @@ regions - an array of region DisplayObjects with specific properties for each re
62803
62811
  lastMargin - (default 0) the margin at the bottom (vertical) or at the right (horizontal)
62804
62812
  lastMarginMin - (default 0) the minimum margin at the bottom (vertical) or at the right (horizontal)
62805
62813
  backgroundColor - (default null) background color for the whole holder
62814
+ only vertical GradientColor and centered RadialColor are supported at this time
62815
+ so use new GradientColor([blue,green]) or new GradientColor([orange, yellow])
62806
62816
  vertical - (default true) set to false for horizontal layout
62807
62817
  showRegions - (default null) show boundaries of regions (formerly regionShape)
62808
62818
  can toggle on and off with B key if this is set to true
@@ -63018,7 +63028,7 @@ will fill up the rest of the height until they reach their maximum widths
63018
63028
  holder.setBounds(0,0,bounds.width,bounds.height);
63019
63029
  backing.graphics.clear();
63020
63030
  if (backgroundColor!="") {
63021
- processColor(backing, backgroundColor);
63031
+ processColor(backing, backgroundColor, 0, 0, bounds.width, bounds.height);
63022
63032
  backing.graphics.r(0,0,bounds.width,bounds.height);
63023
63033
  }
63024
63034
  for (i=0; i<regions.length; i++) {
@@ -63234,7 +63244,7 @@ will fill up the rest of the height until they reach their maximum widths
63234
63244
  if (pPos == 0 || (pPos+p) == bounds[primary]) if (vertical) {addedH=1;} else {addedW=1;}
63235
63245
  if (s == bounds[secondary]) if (vertical) {addedW=1;} else {addedH=1;}
63236
63246
  if (r.backgroundColor != "") {
63237
- processColor(backing, r.backgroundColor);
63247
+ processColor(backing, r.backgroundColor, f.bX, f.bY, f.bWidth+addedW, f.bHeight+addedH);
63238
63248
  backing.graphics.r(f.bX, f.bY, f.bWidth+addedW, f.bHeight+addedH);
63239
63249
  }
63240
63250
  // increase our primary position
@@ -63244,9 +63254,11 @@ will fill up the rest of the height until they reach their maximum widths
63244
63254
 
63245
63255
  }; // end resize
63246
63256
 
63247
- function processColor(shape, co) {
63248
- if (co.type == "GradientColor") shape.graphics.lf(co.colors, co.ratios, co.x0, co.y0, co.x1, co.y1);
63249
- else if (co.type == "RadialColor") shape.graphics.rf(co.colors, co.ratios, co.x0, co.y0, co.r0, co.x1, co.y1, co.r1);
63257
+ function processColor(shape, co, x, y, w, h) {
63258
+ // if (co.type == "GradientColor") shape.graphics.lf(co.colors, co.ratios, co.x0, co.y0, co.x1, co.y1);
63259
+ if (co.type == "GradientColor") shape.graphics.lf(co.colors, co.ratios, x, y, x, y+h);
63260
+ // else if (co.type == "RadialColor") shape.graphics.rf(co.colors, co.ratios, co.x0, co.y0, co.r0, co.x1, co.y1, co.r1);
63261
+ else if (co.type == "RadialColor") shape.graphics.rf(co.colors, co.ratios, x+w/2, y+h/2, 0, x+w/2, y+h/2, Math.max(w/2,h/2));
63250
63262
  else if (co.type == "BitmapColor") shape.graphics.bf(co.image, co.repetition, co.matrix);
63251
63263
  else shape.graphics.f(r.backgroundColor);
63252
63264
  }
@@ -69752,11 +69764,24 @@ join(obj1, obj2, point1, point2, minAngle, maxAngle, type) - creates and returns
69752
69764
  break(joint) - break a joint created with join()
69753
69765
  to use, store the result of the join() method in a variable and pass that variable in to break()
69754
69766
  attach(control, obj) attach a physics object (obj) to a ZIM object (control) to like a mousejoint to the ZIM object not the mouse
69755
- the control can then be animated, wiggled, dragged and the physics object will follow it
69756
- returns an id to be able to unattach
69757
- const id = physics.attach(triangle, circle);
69758
- timeout(2, ()=>{physics.unattach(id)});
69767
+ the control can then be animated, wiggled, dragged and the physics object will follow it
69768
+ returns an id to be able to unattach
69769
+ const id = physics.attach(triangle, circle);
69770
+ timeout(2, ()=>{physics.unattach(id)});
69759
69771
  unattach(id) unattach a physics object from the ZIM object based on the stored id from attach();
69772
+ buoyancy(height, denisity, linear, angular) returns a Box2D buoyancy controller. Then need to add() or remove() objects
69773
+ height - (default H/2) is pixels from bottom of the stage
69774
+ density - (default 3) density of fluid - the higher the more an object floats
69775
+ linear - (default 4) linear damping to reduce movement
69776
+ angular - (default 4) angular damping to reduce rotation
69777
+ the buoyancy controller will have the following methods:
69778
+ add(obj) - add object with physics or an array of objects with physics to buoyancy controller
69779
+ returns buoyancy object for chaining
69780
+ remove(obj) - remove object or an array of objects from buoyancy controller
69781
+ returns buoyancy object for chaining
69782
+ clear() - remove all objects from buoyancy controller
69783
+ returns buoyancy object for chaining
69784
+ dispose() - deletes buoyancy controller
69760
69785
  debug() - activates the debugging - returns object for chaining
69761
69786
  updateDebug() - updates the debug canvas if the frame has been scaled (put in frame resize event)
69762
69787
  removeDebug() - removes the debug canvas - you can add it again later (or toggle, etc.)
@@ -79085,10 +79110,10 @@ the result of the play() or tone() method will dispatch a "complete" event when
79085
79110
  if (wah) that2.removeWah();
79086
79111
  }, (releaseTime+1)*1000);
79087
79112
  };
79088
- if (duration) this.stop(startTime+duration-.1);
79089
- // if (duration) timeout(duration-.1, function () {
79090
- // that2.stop();
79091
- // });
79113
+ // if (duration) this.stop(startTime+duration-.1);
79114
+ if (duration) setTimeout(function () { // reverted back to this in ZIM 015
79115
+ that2.stop();
79116
+ }, (duration-.1) * 1000);
79092
79117
 
79093
79118
  var notes = this.notes = [oscillator];
79094
79119
 
@@ -79157,7 +79182,7 @@ the result of the play() or tone() method will dispatch a "complete" event when
79157
79182
  if (zot(val)) val = 0;
79158
79183
  if (zot(duration)) duration = that.rampDuration;
79159
79184
 
79160
- if (gain) {
79185
+ if (gain) {
79161
79186
  obj.cancelScheduledValues(audioContext.currentTime);
79162
79187
  obj.linearRampToValueAtTime(
79163
79188
  obj.value,
@@ -79170,8 +79195,8 @@ the result of the play() or tone() method will dispatch a "complete" event when
79170
79195
  // gain.gain.setValueAtTime(gain.gain.value, audioContext.currentTime);
79171
79196
  // gain.gain.linearRampToValueAtTime(volume*that.hush, audioContext.currentTime+that.rampDuration);
79172
79197
 
79173
- } else {
79174
- obj.cancelScheduledValues(audioContext.currentTime);
79198
+ } else {
79199
+ obj.cancelScheduledValues(audioContext.currentTime); // this is deleting duration setting... so took out in 015
79175
79200
  obj.setTargetAtTime(val, audioContext.currentTime, duration);
79176
79201
  }
79177
79202
 
@@ -83552,7 +83577,7 @@ METHODS (of AbstractSoundInstance)
83552
83577
  stop() - stops the sound and sets the time to 0
83553
83578
  play() - plays the sound again - usually, the sound is already playing from the sound.play()
83554
83579
  but if it is stopped - this will start it again
83555
- fade(volume, time, call) - fade in our out a playing sound in a time and call the call function when done
83580
+ fade(volume, time, call) - fade in or out a playing sound in a time and call the call function when done
83556
83581
  panSound(pan, time, call) - pan left (-1) or right (1) or in between a playing sound in a time and call the call function when done
83557
83582
 
83558
83583
  PROPERTIES
@@ -83659,7 +83684,7 @@ loop - dispatched when the sound loops (but not at end of last loop - that is co
83659
83684
  props:{volume:val},
83660
83685
  time:time,
83661
83686
  override:true,
83662
- animateCall:function() {zog("here"); that.soundInstance.volume = ob.volume},
83687
+ animateCall:function() {that.soundInstance.volume = ob.volume},
83663
83688
  call:call
83664
83689
  });
83665
83690
  return that.sound;
@@ -83677,7 +83702,7 @@ loop - dispatched when the sound loops (but not at end of last loop - that is co
83677
83702
  props:{pan:val},
83678
83703
  time:time,
83679
83704
  override:true,
83680
- animateCall:function() {zogb(ob.pan); that.soundInstance.pan = ob.pan},
83705
+ animateCall:function() {that.soundInstance.pan = ob.pan},
83681
83706
  call:call
83682
83707
  });
83683
83708
  return that.sound;
@@ -84396,7 +84421,7 @@ Thanks Karel Rosseel for the initial research on Speech.
84396
84421
  SEE: https://zimjs.com/016/speech.html
84397
84422
 
84398
84423
  NOTE: The listen() method is currently not supported by Apple iOS Web - only Native apps (grr)
84399
- But the talk() method works on iOS Web - however, there seems to be one voice.
84424
+ But the talk() method works on iOS and Android Web - however, there seems to be one voice.
84400
84425
 
84401
84426
  NOTE: as of ZIM 5.5.0 the zim namespace is no longer required (unless zns is set to true before running zim)
84402
84427
 
@@ -84471,7 +84496,6 @@ recognition - the SpeechRecognition() object created (used internally) has JS pr
84471
84496
 
84472
84497
  EVENTS
84473
84498
  dispatches a "voiceschanged" event when voices property will be ready - not needed if just using default voice
84474
- f preloaded this is dispatched 20 ms after the SVG is made.
84475
84499
  dispatches "result" when either as each word is spoken if listen() is used (interim defaults to true)
84476
84500
  or at the end of speaking words if listen(false) is used (interim is set to false)
84477
84501
  the result event will have an event object (often e is used) that holds a words property with the words spoken
@@ -87181,14 +87205,15 @@ but usually, just pass the callback as the first parameter
87181
87205
  backdropColor:backdropColor
87182
87206
  });
87183
87207
  var icon = new zim.Container();
87184
- new zim.Shape().s(zim.dark).ss(3,1,0,3).p("AAAj0IAAFJAA8hoIBuAAIAAFdIlTAAIAAldIBuAA")
87208
+ new zim.Shape(50,30).s(zim.dark).ss(3,1,0,3).p("AAAj0IAAFJAA8hoIBuAAIAAFdIlTAAIAAldIBuAA")
87185
87209
  .sca(1.7).addTo(icon);
87186
- new zim.Shape().s(zim.dark).ss(3,1,0,3).p("AhGAlIBGhGIBHBG")
87210
+ new zim.Shape(50,30).s(zim.dark).ss(3,1,0,3).p("AhGAlIBGhGIBHBG")
87187
87211
  .sca(1.7).addTo(icon).mov(0,-38);
87188
- var tile = new zim.Tile([icon, label], 2, 1, 40, 0, true)
87212
+ var tile = new zim.Tile([icon, label], 2, 1, 20, 0, true)
87189
87213
  if (tile.width > zdf.stage.width*.7) tile.width = zdf.stage.width*.7;
87190
- tile.setBounds(-70,-10,480,100);
87191
- icon.mov(-30,35);
87214
+ tile.setBounds(-90,-10,480,100);
87215
+ tile.noMouse();
87216
+ icon.mov(-30,0);
87192
87217
  tile.center(pane);
87193
87218
  }
87194
87219
 
@@ -90866,8 +90891,8 @@ export let outline = zim.outline;
90866
90891
  export let blendmodes = zim.blendmodes;
90867
90892
  export let Pages = zim.Pages;
90868
90893
  export let Arrow = zim.Arrow;
90869
- export let HotSpots = zim.HotSpots;
90870
90894
  export let HotSpot = zim.HotSpot;
90895
+ export let HotSpots = zim.HotSpots;
90871
90896
  export let Guide = zim.Guide;
90872
90897
  export let Grid = zim.Grid;
90873
90898
  export let Wrapper = zim.Wrapper;
@@ -3616,8 +3616,12 @@ declare namespace zim {
3616
3616
  borders(boundary?: Boundary | {}): void
3617
3617
  drag(array?: [any]): void
3618
3618
  noDrag(): void
3619
+ pause(type?:boolean): void;
3619
3620
  join(obj1: DisplayObject, obj2: DisplayObject, point1?: Point | {}, point2?: Point | {}, minAngle?: number, maxAngle?: number, type?: string): any
3620
3621
  break(joint: any): void
3622
+ attach(control:DisplayObject, obj:DisplayObject):string
3623
+ unattach(id:string):void
3624
+ buoyancy(height?:number, denisity?:number, linear?:number, angular?:number):any
3621
3625
  debug(): void
3622
3626
  updateDebug(): void
3623
3627
  removeDebug(): void