zimjs 19.0.8 → 19.1.0

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 +116 -26
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zimjs",
3
- "version": "19.0.8",
3
+ "version": "19.1.0",
4
4
  "type": "module",
5
5
  "main": "./src/zim.js",
6
6
  "types": "./ts-src/typings/zim",
package/src/zim.js CHANGED
@@ -34109,9 +34109,11 @@ dropHeight - (default null) set a height when dropped - overrides scale
34109
34109
  *** Drop parameters that work only when dropping on a dropTarget that is NOT a List
34110
34110
  dropHitTest - (default "bounds") can also be "reg", "circles", "circle", "rect" - see ZIM HitTests
34111
34111
  dropFull - (default true) do not drop on a full target
34112
- note - if the object is removed from the target then a drop can occur again on that target
34112
+ note - if the object is removed from the target then a drop can occur again on that target
34113
+ also see the dropFull property on a target
34113
34114
  dropSnap - (default true) snap to the target object
34114
34115
  dropEnd - (default true) once dropped on a target a noMouse() is set on the object
34116
+ dropEnd should not be false if dropBack is true - when dropping from a list
34115
34117
  *** End drop parameters that work only when dropping on a target that is NOT a List
34116
34118
  selectedIndex - same as index, kept in for backwards compatibility in ZIM DUO
34117
34119
  style - (default true) set to false to ignore styles set with the STYLE - will receive original parameter defaults
@@ -34254,8 +34256,8 @@ enabled - default is true - set to false to disable
34254
34256
  DROP ITEM PROPERTIES
34255
34257
  dropTarget - is the target dropped on
34256
34258
  dropList - is list item came from
34257
-
34258
- // dropEnd should not be false if dropBack is true - when dropping from a list
34259
+ dropFull - the target that is dropped on gets a dropFull property
34260
+ set this to false if programatically removing a dropped object such as for a garbage can
34259
34261
 
34260
34262
  ALSO: see all Window properties - like titleBar, titleBarLabel, resizeHandle, etc.
34261
34263
 
@@ -35183,6 +35185,21 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
35183
35185
  ghost.dropStartY = downItem.dropStartY;
35184
35186
  ghost.dropStartS = downItem.dropStartS;
35185
35187
 
35188
+ // ZIM 019 patch
35189
+ // pass through original x,y,scale for objects
35190
+ // that had them and were added to the list
35191
+ if (downItem.dropOriginalX != null) {
35192
+ ghost.dropOriginalX = downItem.dropOriginalX;
35193
+ ghost.dropOriginalY = downItem.dropOriginalY;
35194
+ ghost.dropOriginalS = downItem.dropOriginalS;
35195
+ ghost.dropStartX = ghost.x;
35196
+ ghost.dropStartY = ghost.y;
35197
+ ghost.dropStartS = ghost.scale;
35198
+ } else {
35199
+ // flag drag() to not add dropOriginalX, etc.
35200
+ ghost.dropOriginalList = true;
35201
+ }
35202
+
35186
35203
  that.dropItem = ghost;
35187
35204
  that.dropTarget = target;
35188
35205
  ghost = null;
@@ -35198,7 +35215,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
35198
35215
  target.dropReticle.removeFrom();
35199
35216
  if (!dropCopy) that.removeAt(1,itemIndex);
35200
35217
 
35201
- if (itemIndex < target.dropReticleIndex && that == target) target.dropReticleIndex--;
35218
+ if (itemIndex < target.dropReticleIndex && that == target && !dropCopy) target.dropReticleIndex--;
35202
35219
 
35203
35220
  if (dropCopy) {
35204
35221
  target.addAt(ghost, target.dropReticleIndex);
@@ -48722,7 +48739,7 @@ addChild(), removeChild(), addChildAt(), getChildAt(), contains(), removeAllChil
48722
48739
  PROPERTIES
48723
48740
  type - holds the class name as a String
48724
48741
  index - get or set the index of the item
48725
- selectedItem - the item at the front
48742
+ currentItem - the item at the front
48726
48743
  each item has a content property if the item was added to a container by the carousel (only if item was not a container)
48727
48744
  each item has a fader property which is a ZIM Rectangle - if the fade was not false or 0
48728
48745
  items - the array of items
@@ -53082,7 +53099,7 @@ RETURNS obj for chaining
53082
53099
  };//-47.95
53083
53100
 
53084
53101
  /*--
53085
- obj.drag = function(boundary, axis, overCursor, dragCursor, all, swipe, localBoundary, onTop, surround, slide, slideFactor, slideSnap, slideSnapDamp, reg, removeTweens, startBounds, rect, currentTarget, offStage, immediateBoundary, singleTouch, dropTargets, dropCopy, dropSnap, dropBack, dropEnd, dropFull, dropHitTest, dropScale, dropWidth, dropHeight)
53102
+ obj.drag = function(boundary, axis, overCursor, dragCursor, all, swipe, localBoundary, onTop, surround, slide, slideFactor, slideSnap, slideSnapDamp, reg, removeTweens, startBounds, rect, currentTarget, offStage, immediateBoundary, singleTouch, dropTargets, dropCopy, dropSnap, dropBack, dropEnd, dropFull, dropHitTest, dropScale, dropWidth, dropHeight, dropOriginal, style, group)
53086
53103
 
53087
53104
  drag
53088
53105
  zim DisplayObject method
@@ -53228,18 +53245,25 @@ singleTouch - (default false) set to true to let only one touch operate the drag
53228
53245
  dropTargets - an object or an array of objects that can receive a drop
53229
53246
  this can be a List or a Container or a single object
53230
53247
  if it is a list see the dropListProps as well to set reticle properties and scroll speed
53248
+ recommend reg(CENTER) on objects and targets
53249
+ then use dropHitTest:"reg"
53231
53250
  dropCopy - (default false) make a copy of the object as it is being dragged
53232
53251
  dropSnap - (default true) snap to the target object
53233
- dropBack - (default true) go back to start if not dropped on a target
53252
+ dropBack - (default true) go back to last position if not dropped on a target
53253
+ or back to start if not dropped on a target and the dropOriginal is true
53234
53254
  dropEnd - (default true) once dropped on a target a noMouse() is set on the object
53235
53255
  dropFull - (default true) do not drop on a full target
53236
53256
  note - if the object is removed from the target then a drop can occur again on that target
53237
53257
  dropHitTest - (default "bounds") can also be "reg", "circles", "circle", "rect" - see ZIM HitTests
53238
53258
  dropScale - set a scale for the dropped object
53259
+ if the object does not get dropped on a target, it will go back to its starting scale
53260
+ but not necessarily its starting position unless dropBack is set
53239
53261
  dropWidth - set a width for the dropped object - overrides scale
53240
53262
  height will keep aspect ratio unless dropHeight is provided
53241
53263
  dropHeight - set a height for the dropped object - overrides scale
53242
53264
  width will keep aspect ratio unless dropWidth is provided
53265
+ dropOriginal - if dropBack is true, will go to original location and scale if obj is not dropped on a target
53266
+ if dropped on a full target and dropFull is true then will go back to last position
53243
53267
  style - (default true) set to false to ignore styles set with the STYLE - will receive original parameter defaults
53244
53268
  group - (default null) set to String (or comma delimited String) so STYLE can set default styles to the group(s) (like a CSS class)
53245
53269
 
@@ -53252,6 +53276,8 @@ adds a dragPaused property to get or set the pause of the drag - which allows se
53252
53276
  *** if dropTargets is set then drag() adds the following properties to the dragged object:
53253
53277
  dropTarget - on pressup, what target the object is dropped on (or null)
53254
53278
  dropList - which List if any a dropped object has
53279
+ dropFull - the target that is dropped on gets a dropFull property
53280
+ set this to false if programatically removing a dropped object such as for a garbage can
53255
53281
  dropListProps - to be used if planning on dropping object into a List
53256
53282
  The dropListProps have the following default values
53257
53283
  {
@@ -53269,8 +53295,8 @@ Adds a "slidestop" event to the drag object that is dispatched when the object c
53269
53295
 
53270
53296
  RETURNS obj for chaining
53271
53297
  --*///+31
53272
- zim.drag = function(obj, boundary, axis, overCursor, dragCursor, all, swipe, localBoundary, onTop, surround, slide, slideFactor, slideSnap, slideSnapDamp, reg, removeTweens, startBounds, rect, currentTarget, offStage, immediateBoundary, singleTouch, dropTargets, dropCopy, dropSnap, dropBack, dropEnd, dropFull, dropHitTest, dropScale, dropWidth, dropHeight, style, group) {
53273
- var sig = "obj, boundary, axis, overCursor, dragCursor, all, swipe, localBoundary, onTop, surround, slide, slideFactor, slideSnap, slideSnapDamp, reg, removeTweens, startBounds, rect, currentTarget, offStage, immediateBoundary, singleTouch, dropTargets, dropCopy, dropSnap, dropBack, dropEnd, dropFull, dropHitTest, dropScale, dropWidth, dropHeight, style, group";
53298
+ zim.drag = function(obj, boundary, axis, overCursor, dragCursor, all, swipe, localBoundary, onTop, surround, slide, slideFactor, slideSnap, slideSnapDamp, reg, removeTweens, startBounds, rect, currentTarget, offStage, immediateBoundary, singleTouch, dropTargets, dropCopy, dropSnap, dropBack, dropEnd, dropFull, dropHitTest, dropScale, dropWidth, dropHeight, dropOriginal, style, group) {
53299
+ var sig = "obj, boundary, axis, overCursor, dragCursor, all, swipe, localBoundary, onTop, surround, slide, slideFactor, slideSnap, slideSnapDamp, reg, removeTweens, startBounds, rect, currentTarget, offStage, immediateBoundary, singleTouch, dropTargets, dropCopy, dropSnap, dropBack, dropEnd, dropFull, dropHitTest, dropScale, dropWidth, dropHeight, dropOriginal, style, group";
53274
53300
  var duo; if (duo = zob(zim.drag, arguments, sig)) return duo;
53275
53301
  if (obj.type=="AC"&&WW.zdf) {WW.zdf.ac("drag", arguments); return obj;}
53276
53302
  z_d("31");
@@ -53345,6 +53371,7 @@ RETURNS obj for chaining
53345
53371
  if (zot(dropScale)) dropScale = DS.dropScale!=null?DS.dropScale:null;
53346
53372
  if (zot(dropWidth)) dropWidth = DS.dropWidth!=null?DS.dropWidth:null;
53347
53373
  if (zot(dropHeight)) dropHeight = DS.dropHeight!=null?DS.dropHeight:null;
53374
+ if (zot(dropOriginal)) dropOriginal = DS.dropOriginal!=null?DS.dropOriginal:null; // ZIM 019 patch
53348
53375
 
53349
53376
  if (dropTargets) {
53350
53377
  slide = false;
@@ -53603,7 +53630,12 @@ RETURNS obj for chaining
53603
53630
  }
53604
53631
 
53605
53632
  // DROP - added ZIM 017 Patch
53606
- if (zot(dragObject.dropStartS)) {
53633
+ if (zot(dragObject.dropStartS)) {
53634
+ if (!dragObject.dropOriginalList) {
53635
+ dragObject.dropOriginalX = dragObject.x;
53636
+ dragObject.dropOriginalY = dragObject.y;
53637
+ dragObject.dropOriginalS = dragObject.scale;
53638
+ }
53607
53639
  dragObject.dropStartX = dragObject.x;
53608
53640
  dragObject.dropStartY = dragObject.y;
53609
53641
  dragObject.dropStartS = dragObject.scale;
@@ -53612,9 +53644,14 @@ RETURNS obj for chaining
53612
53644
  if (dragObject.clone) {
53613
53645
  dragObject.dropCopy = dragObject.clone(true).addTo(dragObject.parent, dragObject.parent.getChildIndex(dragObject));
53614
53646
  dragObject.dropCopy.dropClone = true;
53647
+ if (!dragObject.dropOriginalList) {
53648
+ dragObject.dropCopy.dropOriginalX = dragObject.dropOriginalX;
53649
+ dragObject.dropCopy.dropOriginalY = dragObject.dropOriginalY;
53650
+ dragObject.dropCopy.dropOriginalS = dragObject.dropOriginalS;
53651
+ }
53615
53652
  dragObject.dropCopy.dropStartX = dragObject.dropStartX;
53616
53653
  dragObject.dropCopy.dropStartY = dragObject.dropStartY;
53617
- dragObject.dropCopy.dropStartS = dragObject.dropStartS;
53654
+ dragObject.dropCopy.dropStartS = dragObject.dropStartS;
53618
53655
  dragObject.dropCopy.noMouse();
53619
53656
  }
53620
53657
  }
@@ -53851,11 +53888,17 @@ RETURNS obj for chaining
53851
53888
 
53852
53889
  if (obj.dropTargets) {
53853
53890
  if (!Array.isArray(obj.dropTargets)) obj.dropTargets = [obj.dropTargets];
53854
- // watch - could drop from one target to another
53855
- if (dragObject.droppedTarget) {
53856
- dragObject.droppedTarget.dropFull = false;
53857
- dragObject.droppedTarget = null;
53858
- }
53891
+ // // ZIM 019 patch - removed this and moved dropFull = false
53892
+ // // to if moved to different place
53893
+ // // the droppedTarget will be overwritten if succesful
53894
+ // // but if not then we want it to be the same as it was
53895
+ // if (dragObject.droppedTarget) {
53896
+ // dragObject.droppedTarget.dropFull = false;
53897
+ // dragObject.droppedTarget = null;
53898
+ // }
53899
+
53900
+ var wasFull = false; // ZIM 019 patch
53901
+
53859
53902
  var miss = zim.loop(obj.dropTargets, function(target) {
53860
53903
 
53861
53904
  if (target.type == "List") {
@@ -53875,10 +53918,15 @@ RETURNS obj for chaining
53875
53918
  if (dropWidth || dropHeight) placeObject.siz(dropWidth, dropHeight);
53876
53919
  if (dropEnd) placeObject.noMouse();
53877
53920
  else placeObject.mouse();
53921
+
53922
+ // added in ZIM 019 patch
53923
+ // set last dropTarget dropFull to false
53924
+ if (placeObject.droppedTarget) placeObject.droppedTarget.dropFull = false;
53925
+
53878
53926
  placeObject.droppedTarget = target;
53879
- target.addAt(placeObject, target.dropReticleIndex);
53880
-
53927
+ target.addAt(placeObject, target.dropReticleIndex);
53881
53928
  target.dropItem = dragObject;
53929
+
53882
53930
  dragObject.droppedTarget = target;
53883
53931
  dragObject.dropTarget = target;
53884
53932
  target.dropList = target;
@@ -53890,6 +53938,9 @@ RETURNS obj for chaining
53890
53938
  }
53891
53939
 
53892
53940
  if (dragObject["hitTest"+String(dropHitTest).charAt(0).toUpperCase() + String(dropHitTest).slice(1)](target)) {
53941
+
53942
+ wasFull = target.dropFull; // ZIM 019 patch
53943
+
53893
53944
  if (!dropFull || !target.dropFull) {
53894
53945
  var placeObject = dragObject;
53895
53946
  if (dropCopy && dragObject.dropCopy) {
@@ -53902,17 +53953,43 @@ RETURNS obj for chaining
53902
53953
  if (dropScale) placeObject.sca(dropScale);
53903
53954
  if (dropWidth || dropHeight) placeObject.siz(dropWidth, dropHeight);
53904
53955
  if (dropEnd) placeObject.noMouse();
53905
- else placeObject.mouse();
53956
+ else placeObject.mouse();
53957
+
53958
+ // added these in ZIM 019 patch
53959
+ placeObject.dropStartX = placeObject.x;
53960
+ placeObject.dropStartY = placeObject.y;
53961
+ placeObject.dropStartS = placeObject.scale;
53962
+ // set last dropTarget dropFull to false
53963
+ if (placeObject.droppedTarget) dragObject.droppedTarget.dropFull = false;
53964
+ // end ZIM 019 patch
53965
+
53906
53966
  if (dropFull) target.dropFull = true;
53967
+
53907
53968
  placeObject.droppedTarget = target;
53908
- placeObject.dropTarget = target;
53969
+ placeObject.dropTarget = target;
53970
+
53909
53971
  return false;
53910
53972
  }
53911
53973
  }
53912
53974
  });
53975
+
53976
+ // dropOriginal
53977
+ // if set to false then once in a system always snaps back to within system
53978
+ // if set to true if dropped not on target then goes back to original x,y,scale
53979
+ // otherwise if full then still snaps back inside system
53913
53980
  if (miss) {
53914
- dragObject.dropTarget = dragObject.droppedTarget = null;
53981
+ // dragObject.dropTarget = dragObject.droppedTarget = null; // going back to last spot - removed this in ZIM 019 patch
53915
53982
  if (dropBack) {
53983
+
53984
+ // ZIM 019 Patch to handle dropOrigin
53985
+ // dropOriginalList means it came originally from a List and will not have a dropOriginalX, etc.
53986
+ if ((!dropFull || !wasFull) && dropOriginal && !dragObject.dropOriginalList) {
53987
+ dragObject.dropStartX = dragObject.dropOriginalX;
53988
+ dragObject.dropStartY = dragObject.dropOriginalY;
53989
+ dragObject.dropStartS = dragObject.dropOriginalS;
53990
+ if (dragObject.droppedTarget) dragObject.droppedTarget.dropFull = false;
53991
+ dragObject.dropTarget = dragObject.droppedTarget = null;
53992
+ }
53916
53993
  dragObject.animate({
53917
53994
  props:{x:dragObject.dropStartX, y:dragObject.dropStartY, scale:dragObject.dropStartS},
53918
53995
  time:.2,
@@ -53925,7 +54002,13 @@ RETURNS obj for chaining
53925
54002
  }
53926
54003
  });
53927
54004
  } else {
53928
- dragObject.sca(dragObject.dropStartS);
54005
+
54006
+ // added these in ZIM 019 patch
54007
+ if (dragObject.droppedTarget) dragObject.droppedTarget.dropFull = false;
54008
+ dragObject.droppedTarget = null;
54009
+ // end ZIM 019 patch
54010
+
54011
+ dragObject.sca(dragObject.dropOriginalS);
53929
54012
  if (dropCopy && dragObject.dropCopy) {
53930
54013
  swapProperties("x", dragObject, dragObject.dropCopy);
53931
54014
  swapProperties("y", dragObject, dragObject.dropCopy);
@@ -58270,6 +58353,7 @@ sequence - (default 0) the delay time in seconds to run on children of a contain
58270
58353
  Note: for a sequence animate() give the animate() an id and pauseAnimate() or stopAnimate() that id.
58271
58354
  sequenceCall - (default null) the function that will be called for each sequence animation
58272
58355
  Note: the value of the sequenceCall parameter will be the object that just ended animation unless there is a sequenceParams value
58356
+ To get the object about to animate use the startCall parameter
58273
58357
  sequenceParams - (default null) a parameter sent to the sequenceCall function
58274
58358
  sequenceReverse - |ZIM VEE| (default false) set to true to sequence through container or array backwards
58275
58359
  sequenceRatio - (default null) set to a value to adjust the rate based on item ratio property
@@ -58989,6 +59073,8 @@ RETURNS the target for chaining (or null if no target is provided and run on zim
58989
59073
 
58990
59074
  if (zot(o.props) && !zot(o.obj)) o.props = o.obj;
58991
59075
  o.obj = o.props;
59076
+ if (o.loopCall || o.loopWait || o.loopPick || o.loopCount) o.loop = true;
59077
+ if (o.rewindCall || o.rewindWait || o.rewindPick || o.rewindTime || o.rewindEase) o.rewind = true;
58992
59078
  if (o.loop && (zot(o.loopCount) || o.loopCount <= 0)) {
58993
59079
  o.loopCount = 0;
58994
59080
  // this object is looping forever so no point in keeping any next objects
@@ -63727,8 +63813,11 @@ PATH
63727
63813
  zim global variable
63728
63814
 
63729
63815
  DESCRIPTION
63730
- PATH is used by lazy-loaded assets (not using Frame assets parameter or loadAssets() method).
63731
- This will be set by default to the latest path parameter in Frame or in loadAssets().
63816
+ PATH can be used to set the URL path to assets for Pic(), Aud(), etc.
63817
+ This only works with lazy-loaded assets so assets not using the Frame() or loadAssets() assets and path parameter.
63818
+ PATH is set by default to the latest path parameter in Frame or in loadAssets().
63819
+
63820
+ NOTE: this is NOT paths for ZIM Blobs and Squiggles https://zimjs.com/paths - that is something else.
63732
63821
 
63733
63822
  NOTE: if an lazy-loaded asset has a path in it (as in a /) then the PATH will be ignored.
63734
63823
 
@@ -63739,7 +63828,7 @@ EXAMPLE
63739
63828
  new Pic("image.png").center(); // will look in local directory
63740
63829
  new Pic("images/image.png").center(); // will look in images/ directory
63741
63830
 
63742
- PATH = "assets/";
63831
+ PATH = "assets/"; // or could be an absolute URL like "https://zimjs.org/assets/"
63743
63832
  new Pic("image.png").center(); // will look in assets/ directory
63744
63833
  new Pic("sound.mp3").play(); // will look in assets/ directory
63745
63834
  new Pic("test/image.png").center(); // will look in test/ directory
@@ -85540,7 +85629,7 @@ END EXAMPLE
85540
85629
  EXAMPLE
85541
85630
  // using ZIM VEE series to adjust stroke color and width
85542
85631
  const g = new Generator({draw:gen, maxCount:360/2, strokeColor:green});
85543
- const s = series({min:1, max:4}).step(.1).bounce(); // stroke sizes
85632
+ const s = series({min:1, max:4, step:.1}).bounce(); // stroke sizes
85544
85633
  const c = series(blue,pink,green).every(12); // color change
85545
85634
  function gen(count, total, g) {
85546
85635
  g
@@ -102808,6 +102897,7 @@ for (z_i = 0; z_i < globalFunctions.length; z_i++) {
102808
102897
  ["END", zim.END],
102809
102898
  ["TOP", zim.TOP],
102810
102899
  ["BOTTOM", zim.BOTTOM],
102900
+ ["BOT", zim.BOT],
102811
102901
  ["OVER", zim.OVER],
102812
102902
  ["UNDER", zim.UNDER],
102813
102903
  ["HORIZONTAL", zim.HORIZONTAL],