zimjs 18.1.2 → 18.1.4

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 +41 -25
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zimjs",
3
- "version": "18.1.2",
3
+ "version": "18.1.4",
4
4
  "type": "module",
5
5
  "main": "./src/zim.js",
6
6
  "types": "./ts-src/typings/zim",
package/src/zim.js CHANGED
@@ -26688,7 +26688,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
26688
26688
  //-56
26689
26689
 
26690
26690
  /*--
26691
- zim.RadioButtons = function(size, buttons, vertical, color, backgroundColor, spacing, margin, always, indicatorColor, index, rtl, selectedIndex, style, group, inherit)
26691
+ zim.RadioButtons = function(size, buttons, vertical, color, backgroundColor, borderColor, borderWidth, spacing, margin, always, indicatorColor, index, rtl, selectedIndex, style, group, inherit)
26692
26692
 
26693
26693
  RadioButtons
26694
26694
  zim class - extends a zim.Container which extends a createjs.Container
@@ -27659,7 +27659,7 @@ content - (default " ") optional content to be centered in one of three formats:
27659
27659
  header - a ZIM DisplayObject for the top of the content
27660
27660
  message - text that will put into a ZIM Label - default darker - see color property
27661
27661
  display - a ZIM DisplayObject for beneath the message
27662
- buttons - an array of ZIM Button objects or configuration objects {} as follows:
27662
+ buttons - an array of ZIM Button objects or configuration objects {} as follows:
27663
27663
  {label, color, rollColor, backgroundColor, rollBackgroundColor, call}
27664
27664
  with call being a callback function for when the button is pressed
27665
27665
  buttonScale - the scale for the buttons
@@ -28270,7 +28270,7 @@ content - (default null) optional content to be centered in one of three formats
28270
28270
  header - a ZIM DisplayObject for the top of the content
28271
28271
  message - text that will put into a ZIM Label - default color white - see color property
28272
28272
  display - a ZIM DisplayObject for beneath the message
28273
- buttons - an array of ZIM Button objects or configuration objects {} as follows:
28273
+ buttons - an array of ZIM Button objects or configuration objects {} as follows:
28274
28274
  {label, color, rollColor, backgroundColor, rollBackgroundColor, call}
28275
28275
  with call being a callback function for when the button is pressed
28276
28276
  buttonScale - the scale for the buttons
@@ -28799,7 +28799,7 @@ content - (default null) optional content to be centered in one of three formats
28799
28799
  header - a ZIM DisplayObject for the top of the content
28800
28800
  message - text that will put into a ZIM Label - default color white - see color property
28801
28801
  display - a ZIM DisplayObject for beneath the message
28802
- buttons - an array of ZIM Button objects or configuration objects {} as follows:
28802
+ buttons - an array of ZIM Button objects or configuration objects {} as follows:
28803
28803
  {label, color, rollColor, backgroundColor, rollBackgroundColor, call}
28804
28804
  with call being a callback function for when the button is pressed
28805
28805
  buttonScale - the scale for the buttons
@@ -51581,6 +51581,7 @@ To give a more responsive single tap it reduces the default dblTime value
51581
51581
 
51582
51582
  NOTE: tap() ignores List titleBar and organizer as to not conflict with tapping on actual list
51583
51583
  NOTE: set an object's noTap property to true to avoid activating a hold on an object
51584
+ NOTE: use mobileUp:true for tapping to use Speech talk() as Apple currently does not talk on mousedown - sigh.
51584
51585
 
51585
51586
  SEE: noTap() as well
51586
51587
 
@@ -57280,7 +57281,7 @@ RETURNS the target for chaining (or null if no target is provided and run on zim
57280
57281
  loopWait = zim.Pick.choose(loopWait);
57281
57282
  rewind = zim.Pick.choose(rewind);
57282
57283
  rewindWait = zim.Pick.choose(rewindWait);
57283
- if (zot(rewindTime)) rewindTime = time;
57284
+ if (rewind && zot(rewindTime)) rewindTime = time;
57284
57285
  else rewindTime = zim.Pick.choose(rewindTime);
57285
57286
  sequenceReverse = zim.Pick.choose(sequenceReverse);
57286
57287
  from = zim.Pick.choose(from);
@@ -57400,6 +57401,7 @@ RETURNS the target for chaining (or null if no target is provided and run on zim
57400
57401
  var extraTypes = ["extra", "zoom", "speed", "layer", "fade"];
57401
57402
  var extraLookup = {zoom:target.type=="Pen"?"size":"scale", speed:"percentSpeed", layer:"layer", fade:"alpha"};
57402
57403
 
57404
+
57403
57405
  if (target instanceof Array) {
57404
57406
  if (sequenceReverse) target.reverse();
57405
57407
 
@@ -57439,7 +57441,7 @@ RETURNS the target for chaining (or null if no target is provided and run on zim
57439
57441
  var seqTime = i*sequence;
57440
57442
  if (i==0 && sequence!=0) seqTime = timeType=="s"?.02:20; // patched in 10.7.0 and 10.7.1
57441
57443
 
57442
- // zim.animate(tar, tar.zimObj, time, ease, (i==target.length-1?call:null), (i==target.length-1?params:null)
57444
+ // zim.animate(tar, tar.zimObj, time, ease, (i==target.length-1?call:null), (i==target.length-1?params:null)
57443
57445
  zim.animate(tar, tar.zimObj, time, ease, (i==target.length-1?sequenceDone:null), null, wait, waitedCall, waitedParams, null, null, null, null, null, null, null, loopPick, null, null, null, null, null, null, rewindTime, rewindEase, startCall, startParams, animateCall, animateParams, null, sequenceCall, sequenceParams, null, null, ticker, zim.copy(cjsProps), css, protect, override, null, set, id, events, sequenceTarget, dynamic, drag, clamp, startPaused, clean, obj, seriesWait, seqTime, rrr, pauseOnBlur, easeAmount, easeFrequency, timeUnit, timeCheck, noAnimateCall, pathDamp, rewindPick); // do not send from!
57444
57446
 
57445
57447
  }
@@ -66604,9 +66606,10 @@ note: the item is not the event object target - as that is the tile
66604
66606
  that.rows = rows = Math.round(rows);
66605
66607
  that.squeezeH = squeezeH;
66606
66608
  that.squeezeV = squeezeV;
66607
- var VEEAlign = (typeof align=="function");
66608
- var VEEVAlign = (typeof valign=="function");
66609
- // these two are used only for not ZIM VEE - as there are VEE with Squeeze is not supported
66609
+ var VEEAlign = zim.isPick(align)
66610
+ var VEEVAlign = zim.isPick(valign);
66611
+
66612
+ // these two are used only for not ZIM VEE - as VEE with Squeeze is not supported
66610
66613
  that.align = VEEAlign?"left":align;
66611
66614
  that.valign = VEEVAlign?"top":valign;
66612
66615
  that.mirrorH = mirrorH;
@@ -66728,6 +66731,7 @@ note: the item is not the event object target - as that is the tile
66728
66731
  scalesX[j].push(tile.scaleX);
66729
66732
  scalesY[j].push(tile.scaleY);
66730
66733
  if (colSize&&zot(width)) w = zim.Pick.choose(colSize);
66734
+
66731
66735
  if (j==0) finalAlign.push(zim.Pick.choose(align));
66732
66736
 
66733
66737
  // needs projected width and height on the tile
@@ -66907,7 +66911,7 @@ note: the item is not the event object target - as that is the tile
66907
66911
  }
66908
66912
  tile.pos(colTotal, null);
66909
66913
 
66910
- if (!that.squeezeH && VEEAlign) {
66914
+ if (!that.squeezeH && VEEAlign) {
66911
66915
  if (zot(width) && (align=="center" || align=="middle")) {
66912
66916
  tile.x += (widthMax[i]-tile.fW)/2;
66913
66917
  } else if (zot(width) && align=="right") {
@@ -89553,7 +89557,6 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
89553
89557
  if (inner.type == "Bitmap") that.bitmap = inner.clone().addTo(that);
89554
89558
  else that.bitmap = inner.getChildAt(0).clone().addTo(that);
89555
89559
  that.id = that.bitmap.id = file;
89556
- zogb(that.id)
89557
89560
  that.image = that.bitmap.image;
89558
89561
  that.src = that.bitmap.src;
89559
89562
  that.item = that.bitmap.item;
@@ -90859,14 +90862,18 @@ SEE: https://zimjs.com/016/speech.html
90859
90862
 
90860
90863
  NOTE: The listen() method is currently not supported by Apple iOS Web - only Native apps (grr)
90861
90864
  But the talk() method works on iOS and Android Web - however, there seems to be one voice.
90865
+ NOTE: The talk() method on iOS currently does not work on mousedown - so use mobileUp:true on tap() or a pressup event
90862
90866
 
90863
90867
  NOTE: as of ZIM 5.5.0 the zim namespace is no longer required (unless zns is set to true before running zim)
90864
90868
 
90865
90869
  EXAMPLE
90866
90870
  const speech = new Speech();
90867
90871
  // interact at least once before talking
90868
- new Button({label:"TALK"}).center().tap(()=>{
90869
- speech.talk("Hello World");
90872
+ new Button({label:"TALK"}).center().tap({
90873
+ call:()=>{
90874
+ speech.talk("Hello World");
90875
+ },
90876
+ mobileUp:true // talk() on iOS does not seem to work on mousedown - or use pressup event on Button
90870
90877
  });
90871
90878
  END EXAMPLE
90872
90879
 
@@ -90874,8 +90881,11 @@ EXAMPLE
90874
90881
  // let user pick a voice
90875
90882
  const speech = new Speech();
90876
90883
  // interact at least once before talking
90877
- new Button({label:"TALK"}).center().mov(0,-120).tap(()=>{
90878
- speech.talk("Hello World!", list?list.text:null);
90884
+ new Button({label:"TALK"}).center().mov(0,-120).tap({
90885
+ call:()=>{
90886
+ speech.talk("Hello World!", list?list.text:null);
90887
+ },
90888
+ mobileUp:true // talk() on iOS does not seem to work on mousedown - or use pressup event on Button
90879
90889
  });
90880
90890
  let list;
90881
90891
  speech.on("voiceschanged", ()=>{ // must wait for voices to be loaded
@@ -90901,6 +90911,7 @@ END EXAMPLE
90901
90911
  METHODS
90902
90912
  talk(text, voice, volume, lang, rate, pitch) - the computer will say the words
90903
90913
  returns an utterance object on which all these parameter can be dynamically set including the words
90914
+ note: currently, talk() does not work on mousedown on iOS so use pressup events or set tap to mobileUp:true
90904
90915
  text - the text to say (or see Web Speech API for special formats)
90905
90916
  voice (default "Microsoft David - English (United States)") - the voice
90906
90917
  also see "voiceschanged" event at which point speech.voices will be a list
@@ -90939,7 +90950,8 @@ dispatches "result" when either as each word is spoken if listen() is used (inte
90939
90950
  and a confidence property that is a ratio (0-1) for confidence in the result
90940
90951
  Note: iOS (at this time) does not support the listen() and result event
90941
90952
  dispatches "speechend" events when listen() has detected an end to the talking
90942
- dispatches "start", "end" events
90953
+ dispatches "start" event when reading
90954
+ dispatches "end" event when reading
90943
90955
  dispatches a "boundary" event between words
90944
90956
  dispatches an "error" event if no words are spoken, etc. the event object has an error property with the error message
90945
90957
  Note: there are more features to the Web Speech API - see the HTML docs
@@ -92251,15 +92263,19 @@ RETURNS - a Label if a string or number is passed as content, a Container if a c
92251
92263
  var buts = new zim.Container().loc(0,obj.height+(data.header||data.message||data.display?spacingV:0),obj);
92252
92264
  for (var bb=0; bb<data.buttons.length; bb++) {
92253
92265
  var bd = data.buttons[bb];
92254
- var call = bd.call||function(){};
92255
- if (!bd.button) bd.button = new zim.Button({
92256
- width:bd.width,
92257
- label:bd.label,
92258
- backgroundColor:bd.backgroundColor||bd.bgColor,
92259
- color:bd.color,
92260
- rollBackgroundColor:bd.rollBackgroundColor||bd.rollBgColor,
92261
- rollColor:bd.rollColor
92262
- });
92266
+ var call = bd.call||function(){};
92267
+ if (bd.type != "Button") {
92268
+ bd.button = new zim.Button({
92269
+ width:bd.width,
92270
+ label:bd.label,
92271
+ backgroundColor:bd.backgroundColor||bd.bgColor,
92272
+ color:bd.color,
92273
+ rollBackgroundColor:bd.rollBackgroundColor||bd.rollBgColor,
92274
+ rollColor:bd.rollColor
92275
+ });
92276
+ } else {
92277
+ bd.button = bd;
92278
+ }
92263
92279
  bd.button.call = call;
92264
92280
  bd.button.sca(data.buttonScale).loc((bb==0?0:buts.width+spacingH),0,buts).tap(function(e){e.target.call(e.target)});
92265
92281
  }