zimjs 16.2.4 → 16.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/zim.js +39 -33
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zimjs",
3
- "version": "16.2.4",
3
+ "version": "16.2.5",
4
4
  "type": "module",
5
5
  "main": "./src/zim.js",
6
6
  "types": "./ts-src/typings/zim",
package/src/zim.js CHANGED
@@ -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;
@@ -16655,7 +16655,7 @@ Note the points property has been split into points and pointObjects (and there
16655
16655
  draggable:true,
16656
16656
  });
16657
16657
  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);
16658
+ pane.add(textArea);
16659
16659
  }
16660
16660
  that.textArea.text = JSON.stringify(points);
16661
16661
  that.pane.show();
@@ -17349,7 +17349,6 @@ Note the points property has been split into points and pointObjects (and there
17349
17349
  };
17350
17350
  }
17351
17351
  function insertPointData(points, controls, ratios, percent, controlType, skipPoint, dataOnly, even) {
17352
-
17353
17352
  var index = points.length-1; // adjust for squiggle
17354
17353
  var lastRatio = 0;
17355
17354
  var currentRatio = 0;
@@ -17392,6 +17391,9 @@ Note the points property has been split into points and pointObjects (and there
17392
17391
  points[(index+1)%points.length][5] = end.y;
17393
17392
  }
17394
17393
  if (controlType) newPoint[8] = controlType;
17394
+ // else newPoint[8] = "straight";
17395
+ // points[index][8] = "straight"
17396
+ // points[index+1][8] = "straight"
17395
17397
  points.splice(index+1, 0, newPoint);
17396
17398
  return index+1;
17397
17399
  }
@@ -18836,7 +18838,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
18836
18838
  draggable:true,
18837
18839
  });
18838
18840
  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);
18841
+ pane.add(textArea);
18840
18842
  }
18841
18843
  pane.show();
18842
18844
  textArea.text = JSON.stringify(points);
@@ -19577,6 +19579,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
19577
19579
  points[(index+1)%points.length][5] = end.y;
19578
19580
  }
19579
19581
  if (controlType) newPoint[8] = controlType;
19582
+
19580
19583
  points.splice(index+1, 0, newPoint);
19581
19584
  return index+1;
19582
19585
  }
@@ -33840,7 +33843,6 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
33840
33843
  selector = this.selector = new zim.Rectangle(targetW, targetH, zim.faint, zim.faint, borderWidth, corner, dashed, {ignoreScale:!resizeScale})
33841
33844
  .centerReg(that);
33842
33845
  selector.loc(tile.width/2, target.y+paddingV, that, behind?0:1);
33843
- zog(tile.width/2, target.y+paddingV)
33844
33846
  selector.visible = false;
33845
33847
  }
33846
33848
  if (!(selectedIndex < 0 || zot(currentItem))) {
@@ -62535,8 +62537,6 @@ sun.beads.animate({
62535
62537
  });
62536
62538
  END EXAMPLE
62537
62539
 
62538
- path, obj, count, angle, startPercent, endPercent, percents, onTop, showControls, visible, interactive, clone, group, style, inherit
62539
-
62540
62540
  PARAMETERS
62541
62541
  ** supports DUO - parameters or single object with properties below
62542
62542
  ** supports VEE - parameters marked with ZIM VEE mean a zim Pick() object or Pick Literal can be passed
@@ -62793,6 +62793,8 @@ regions - an array of region DisplayObjects with specific properties for each re
62793
62793
  align defaults to middle for the regions
62794
62794
  valign defaults to top and bottom for the top and bottom region and middle for the others
62795
62795
  backgroundColor applies a backing color to the region
62796
+ only vertical GradientColor and centered RadialColor are supported at this time
62797
+ so use new GradientColor([blue,green]) or new GradientColor([orange, yellow])
62796
62798
  Example HORIZONTAL region objects
62797
62799
  [{obj:col1, marginLeft:10, maxHeight:80, width:20, valign:"bottom"},
62798
62800
  {obj:col2, marginLeft:5, maxHeight:90, align:MIDDLE}, // note, middle gets no minWidth
@@ -62803,6 +62805,8 @@ regions - an array of region DisplayObjects with specific properties for each re
62803
62805
  lastMargin - (default 0) the margin at the bottom (vertical) or at the right (horizontal)
62804
62806
  lastMarginMin - (default 0) the minimum margin at the bottom (vertical) or at the right (horizontal)
62805
62807
  backgroundColor - (default null) background color for the whole holder
62808
+ only vertical GradientColor and centered RadialColor are supported at this time
62809
+ so use new GradientColor([blue,green]) or new GradientColor([orange, yellow])
62806
62810
  vertical - (default true) set to false for horizontal layout
62807
62811
  showRegions - (default null) show boundaries of regions (formerly regionShape)
62808
62812
  can toggle on and off with B key if this is set to true
@@ -63018,7 +63022,7 @@ will fill up the rest of the height until they reach their maximum widths
63018
63022
  holder.setBounds(0,0,bounds.width,bounds.height);
63019
63023
  backing.graphics.clear();
63020
63024
  if (backgroundColor!="") {
63021
- processColor(backing, backgroundColor);
63025
+ processColor(backing, backgroundColor, 0, 0, bounds.width, bounds.height);
63022
63026
  backing.graphics.r(0,0,bounds.width,bounds.height);
63023
63027
  }
63024
63028
  for (i=0; i<regions.length; i++) {
@@ -63234,7 +63238,7 @@ will fill up the rest of the height until they reach their maximum widths
63234
63238
  if (pPos == 0 || (pPos+p) == bounds[primary]) if (vertical) {addedH=1;} else {addedW=1;}
63235
63239
  if (s == bounds[secondary]) if (vertical) {addedW=1;} else {addedH=1;}
63236
63240
  if (r.backgroundColor != "") {
63237
- processColor(backing, r.backgroundColor);
63241
+ processColor(backing, r.backgroundColor, f.bX, f.bY, f.bWidth+addedW, f.bHeight+addedH);
63238
63242
  backing.graphics.r(f.bX, f.bY, f.bWidth+addedW, f.bHeight+addedH);
63239
63243
  }
63240
63244
  // increase our primary position
@@ -63244,9 +63248,11 @@ will fill up the rest of the height until they reach their maximum widths
63244
63248
 
63245
63249
  }; // end resize
63246
63250
 
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);
63251
+ function processColor(shape, co, x, y, w, h) {
63252
+ // if (co.type == "GradientColor") shape.graphics.lf(co.colors, co.ratios, co.x0, co.y0, co.x1, co.y1);
63253
+ if (co.type == "GradientColor") shape.graphics.lf(co.colors, co.ratios, x, y, x, y+h);
63254
+ // else if (co.type == "RadialColor") shape.graphics.rf(co.colors, co.ratios, co.x0, co.y0, co.r0, co.x1, co.y1, co.r1);
63255
+ 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
63256
  else if (co.type == "BitmapColor") shape.graphics.bf(co.image, co.repetition, co.matrix);
63251
63257
  else shape.graphics.f(r.backgroundColor);
63252
63258
  }
@@ -79085,10 +79091,10 @@ the result of the play() or tone() method will dispatch a "complete" event when
79085
79091
  if (wah) that2.removeWah();
79086
79092
  }, (releaseTime+1)*1000);
79087
79093
  };
79088
- if (duration) this.stop(startTime+duration-.1);
79089
- // if (duration) timeout(duration-.1, function () {
79090
- // that2.stop();
79091
- // });
79094
+ // if (duration) this.stop(startTime+duration-.1);
79095
+ if (duration) setTimeout(function () {
79096
+ that2.stop();
79097
+ }, (duration-.1) * 1000);
79092
79098
 
79093
79099
  var notes = this.notes = [oscillator];
79094
79100
 
@@ -79157,7 +79163,7 @@ the result of the play() or tone() method will dispatch a "complete" event when
79157
79163
  if (zot(val)) val = 0;
79158
79164
  if (zot(duration)) duration = that.rampDuration;
79159
79165
 
79160
- if (gain) {
79166
+ if (gain) {
79161
79167
  obj.cancelScheduledValues(audioContext.currentTime);
79162
79168
  obj.linearRampToValueAtTime(
79163
79169
  obj.value,
@@ -79170,8 +79176,8 @@ the result of the play() or tone() method will dispatch a "complete" event when
79170
79176
  // gain.gain.setValueAtTime(gain.gain.value, audioContext.currentTime);
79171
79177
  // gain.gain.linearRampToValueAtTime(volume*that.hush, audioContext.currentTime+that.rampDuration);
79172
79178
 
79173
- } else {
79174
- obj.cancelScheduledValues(audioContext.currentTime);
79179
+ } else {
79180
+ obj.cancelScheduledValues(audioContext.currentTime); // this is deleting duration setting... so took out in 015
79175
79181
  obj.setTargetAtTime(val, audioContext.currentTime, duration);
79176
79182
  }
79177
79183
 
@@ -83552,7 +83558,7 @@ METHODS (of AbstractSoundInstance)
83552
83558
  stop() - stops the sound and sets the time to 0
83553
83559
  play() - plays the sound again - usually, the sound is already playing from the sound.play()
83554
83560
  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
83561
+ fade(volume, time, call) - fade in or out a playing sound in a time and call the call function when done
83556
83562
  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
83563
 
83558
83564
  PROPERTIES
@@ -83659,7 +83665,7 @@ loop - dispatched when the sound loops (but not at end of last loop - that is co
83659
83665
  props:{volume:val},
83660
83666
  time:time,
83661
83667
  override:true,
83662
- animateCall:function() {zog("here"); that.soundInstance.volume = ob.volume},
83668
+ animateCall:function() {that.soundInstance.volume = ob.volume},
83663
83669
  call:call
83664
83670
  });
83665
83671
  return that.sound;
@@ -83677,7 +83683,7 @@ loop - dispatched when the sound loops (but not at end of last loop - that is co
83677
83683
  props:{pan:val},
83678
83684
  time:time,
83679
83685
  override:true,
83680
- animateCall:function() {zogb(ob.pan); that.soundInstance.pan = ob.pan},
83686
+ animateCall:function() {that.soundInstance.pan = ob.pan},
83681
83687
  call:call
83682
83688
  });
83683
83689
  return that.sound;
@@ -84396,7 +84402,7 @@ Thanks Karel Rosseel for the initial research on Speech.
84396
84402
  SEE: https://zimjs.com/016/speech.html
84397
84403
 
84398
84404
  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.
84405
+ But the talk() method works on iOS and Android Web - however, there seems to be one voice.
84400
84406
 
84401
84407
  NOTE: as of ZIM 5.5.0 the zim namespace is no longer required (unless zns is set to true before running zim)
84402
84408
 
@@ -84471,7 +84477,6 @@ recognition - the SpeechRecognition() object created (used internally) has JS pr
84471
84477
 
84472
84478
  EVENTS
84473
84479
  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
84480
  dispatches "result" when either as each word is spoken if listen() is used (interim defaults to true)
84476
84481
  or at the end of speaking words if listen(false) is used (interim is set to false)
84477
84482
  the result event will have an event object (often e is used) that holds a words property with the words spoken
@@ -87181,14 +87186,15 @@ but usually, just pass the callback as the first parameter
87181
87186
  backdropColor:backdropColor
87182
87187
  });
87183
87188
  var icon = new zim.Container();
87184
- new zim.Shape().s(zim.dark).ss(3,1,0,3).p("AAAj0IAAFJAA8hoIBuAAIAAFdIlTAAIAAldIBuAA")
87189
+ new zim.Shape(50,30).s(zim.dark).ss(3,1,0,3).p("AAAj0IAAFJAA8hoIBuAAIAAFdIlTAAIAAldIBuAA")
87185
87190
  .sca(1.7).addTo(icon);
87186
- new zim.Shape().s(zim.dark).ss(3,1,0,3).p("AhGAlIBGhGIBHBG")
87191
+ new zim.Shape(50,30).s(zim.dark).ss(3,1,0,3).p("AhGAlIBGhGIBHBG")
87187
87192
  .sca(1.7).addTo(icon).mov(0,-38);
87188
- var tile = new zim.Tile([icon, label], 2, 1, 40, 0, true)
87193
+ var tile = new zim.Tile([icon, label], 2, 1, 20, 0, true)
87189
87194
  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);
87195
+ tile.setBounds(-90,-10,480,100);
87196
+ tile.noMouse();
87197
+ icon.mov(-30,0);
87192
87198
  tile.center(pane);
87193
87199
  }
87194
87200