zimjs 18.2.4 → 18.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/zim.js +38 -23
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zimjs",
3
- "version": "18.2.4",
3
+ "version": "18.2.6",
4
4
  "type": "module",
5
5
  "main": "./src/zim.js",
6
6
  "types": "./ts-src/typings/zim",
package/src/zim.js CHANGED
@@ -9317,6 +9317,7 @@ Used internally by ZIM to globally dispose common connections
9317
9317
  if (c.getContext) c.getContext("2d").clearRect(0,0,1,1);
9318
9318
  delete obj.z_bc;
9319
9319
  }
9320
+ if (obj.cacheCanvas) obj.uncache();
9320
9321
  if (zim.KEYFOCUS == obj) zim.KEYFOCUS = null;
9321
9322
  if (WW.KEYFOCUS == obj) WW.KEYFOCUS = null;
9322
9323
  if (obj.veeObj) obj.veeObj = null;
@@ -29251,8 +29252,10 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
29251
29252
  hitArea.y = -content.y;
29252
29253
  }
29253
29254
  content.x = hscrollBar.proportion.convert(hscrollBar.x);
29254
- if (!damp) desiredX = that.scrollX;
29255
- testContent();
29255
+ if (!damp) {
29256
+ desiredX = that.scrollX;
29257
+ testContent();
29258
+ }
29256
29259
  });
29257
29260
  }
29258
29261
  }
@@ -29283,12 +29286,14 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
29283
29286
  hitArea.x = -content.x;
29284
29287
  hitArea.y = -content.y;
29285
29288
  }
29286
- if (damp) desiredY = vscrollBar.proportion.convert(vscrollBar.y);
29287
- else {
29289
+ if (damp) {
29290
+ desiredY = vscrollBar.proportion.convert(vscrollBar.y);
29291
+ testContent();
29292
+ } else {
29288
29293
  content.y = vscrollBar.proportion.convert(vscrollBar.y);
29289
29294
  desiredY = that.scrollY;
29290
29295
  }
29291
- testContent();
29296
+
29292
29297
  });
29293
29298
  }
29294
29299
  }
@@ -29312,7 +29317,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
29312
29317
  clearTimeout(that.dTimeout);
29313
29318
  that.dTimeout = setTimeout(function(){setdragBoundary();}, 300);
29314
29319
  setdragBoundary();
29315
- testContent();
29320
+ if (!damp) testContent();
29316
29321
  };
29317
29322
 
29318
29323
  this.doResize = function(w, h) {
@@ -29682,7 +29687,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
29682
29687
  }
29683
29688
 
29684
29689
  function testContent() {
29685
- if (!that.optimize) return;
29690
+ if (!that.optimize) return;
29686
29691
  stage = that.stage;
29687
29692
  content.loop(function(item) {
29688
29693
  // ADJUSTED ZIM 016 - look into how we can optimize a wrapper and keep scrollbars the right size
@@ -29698,8 +29703,8 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
29698
29703
  });
29699
29704
  }
29700
29705
 
29701
- function movescrollBars() {
29702
- testContent();
29706
+ function movescrollBars(noTest) {
29707
+ if (!noTest) testContent();
29703
29708
  that.dispatchEvent("scrolling");
29704
29709
  if (hitArea) {
29705
29710
  // move hitarea to display box
@@ -29920,7 +29925,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
29920
29925
  }
29921
29926
  }
29922
29927
  }
29923
- if (optimize) {
29928
+ if (optimize && !damp) {
29924
29929
  testContent();
29925
29930
  }
29926
29931
  }
@@ -29930,13 +29935,14 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
29930
29935
  WW.addEventListener("DOMMouseScroll", that.scrollWindow);
29931
29936
  }
29932
29937
  var dampCheck = false;
29933
- var dampY;
29938
+ var dampY;
29939
+ if (damp) {scrollBarDown = true; desiredY = .01;} // Patched ZIM 018
29934
29940
  function makeDamp(obj) {
29935
29941
  if (damp && !dampCheck && obj.stage) {
29936
29942
  dampCheck = true;
29937
29943
  dampY = new zim.Damp(that.scrollY, damp);
29938
29944
  that.dampTicker = zim.Ticker.add(function() {
29939
- if (swipeCheck) return;
29945
+ if (swipeCheck) return;
29940
29946
  if ( // need to kickstart damping but still stop updating when damping ends
29941
29947
  that.scrollY!=null && desiredY!=null
29942
29948
  && that.scrollY != desiredY // let the damping start
@@ -29945,10 +29951,9 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
29945
29951
  scrollBarDown = false;
29946
29952
  return;
29947
29953
  }
29948
- // if (!zot(desiredY)) that.scrollY = dampY.convert(desiredY);
29949
29954
  if (!zot(desiredY)) content.y = dampY.convert(desiredY);
29950
- if (!scrollBarDown) movescrollBars();
29951
-
29955
+ if (!scrollBarDown) movescrollBars(true);
29956
+ testContent();
29952
29957
  }, obj.stage);
29953
29958
  }
29954
29959
  }
@@ -29967,6 +29972,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
29967
29972
  clearTimeout(that.dTimeout);
29968
29973
  zim.noDrag(content);
29969
29974
  } else {
29975
+ swipeCheck = false;
29970
29976
  setDrag();
29971
29977
  }
29972
29978
  if (that.blinker) {
@@ -52042,7 +52048,7 @@ END EXAMPLE
52042
52048
 
52043
52049
  PARAMETERS supports DUO - parameters or single object with properties below
52044
52050
  boundary - (default null) a ZIM Boundary object for the drag boundary
52045
- or a ZIM DisplayObject including stage
52051
+ or a ZIM DisplayObject including stage
52046
52052
  If the boundary is a display object then ZIM will keep the shape of the dragged object inside the bounds.
52047
52053
  If the boundary object is a Blob then the dragged object will stay within the Blob (experimental).
52048
52054
  If the boundary object is a Circle then the registration point of the dragged object will stay within the circle
@@ -52088,7 +52094,7 @@ rect - (depreciated) same as boundary - kept for backwards compatibility when us
52088
52094
  currentTarget - (default false) same as the all parameter - kept for backwards compatibility when using config object
52089
52095
  offStage - (default false) set to true to be able to drag object off stage (thanks Shammi!)
52090
52096
  immediateBoundary - (default false) set to true to add bounds immediately when drag() is set on a Container.
52091
- this is normally set to false for a .05 second delay to allow objects to be added to Container before setting bounds.
52097
+ this is normally set to false for a .05 second delay to allow objects to be added to Container before setting bounds.
52092
52098
  singleTouch - (default false) set to true to let only one touch operate the drag
52093
52099
  also see Frame() singleTouch setting - but setting on drag will only affect that object's drag
52094
52100
  dropTargets - an object or an array of objects that can receive a drop
@@ -52672,7 +52678,7 @@ RETURNS obj for chaining
52672
52678
  // if (dampY) dampY.immediate(0);
52673
52679
 
52674
52680
  } else {
52675
- obj.downCheck = false; // added ZIM NFT 01
52681
+ obj.downCheck = false; // added ZIM NFT 01
52676
52682
  var pointerCount = 0;
52677
52683
  for (var o in obj.pointers) {
52678
52684
  pointerCount++;
@@ -56881,7 +56887,12 @@ PARAMETERS
56881
56887
  ** supports DUO - parameters or single object with properties below
56882
56888
  ** supports VEE - parameters marked with ZIM VEE mean a zim Pick() object or Pick Literal can be passed
56883
56889
  Pick Literal formats: [1,3,2] - random; {min:10, max:20} - range; series(1,2,3) - order, function(){return result;} - function
56884
-
56890
+ ** supports OCT - parameter defaults can be set with STYLE control (like CSS)
56891
+ NOTE: can target parameters in general like
56892
+ STYLE = {loop:true};
56893
+ to target animate specifically use
56894
+ STYLE = {Animate:{loop:true}};
56895
+ NOT STYLE = {animate:{loop:true}} as lowercase animate conflicts with setting a animate convenience style
56885
56896
  props - the object literal holding properties and values to animate
56886
56897
  Basic examples: {x:200} or {rotation:360, alpha:0} or {scale:4} or {x:300, y:300, scale:"2"} (relative scale)
56887
56898
  There are custom options below including Convenience, ZIM VEE, Relative, and Series properties.
@@ -57253,6 +57264,7 @@ RETURNS the target for chaining (or null if no target is provided and run on zim
57253
57264
  if (target && target.type && target.type=="AC" && WW.zdf) {WW.zdf.ac("animate", arguments); return target;}
57254
57265
  if (!zim.animateCheck) {z_d("45"); zim.animateCheck=true;}
57255
57266
 
57267
+
57256
57268
  if (!target) target = {}; // ZIM 018 replacing: return; from 10.9.0
57257
57269
  var AN = zim.ANIMATE;
57258
57270
  if (WW.ANIMATE != null) AN = WW.ANIMATE;
@@ -57512,7 +57524,7 @@ RETURNS the target for chaining (or null if no target is provided and run on zim
57512
57524
  // ANIMATION SERIES HANDLING
57513
57525
  // if an array is passed in to animate() as the obj
57514
57526
  // then animate treats this as an animation series
57515
- // [{target:circle, obj:{alpha:0}, time:1}, {target:rect, obj:{alpha:0}, time:1},]
57527
+ // [{target:circle, obj:{alpha:0}, time:1}, {target:rect, obj:{alpha:0}, time:1}]
57516
57528
 
57517
57529
  if (obj instanceof Array) {
57518
57530
  currentCount = 1;
@@ -61710,9 +61722,9 @@ zim constant and static Class
61710
61722
  Also GLOBALSTYLE zim constant
61711
61723
 
61712
61724
  DESCRIPTION
61713
- STYLE can be used to set any parameter on a DisplayObject and many of the Controls.
61714
- For instance: Circle, Blob, Button, Pane, Bitmap, Sprite, Tile, Pen, Emitter, Scroller, etc.
61715
- These are applied at the time the objects are made.
61725
+ STYLE can be used to set any parameter on a DisplayObject, many of the Controls, and some methods.
61726
+ For instance: Circle, Blob, Button, Pane, Bitmap, Sprite, Tile, Pen, Emitter, Scroller, drag, animate, etc.
61727
+ These are applied at the time the objects are made or method called.
61716
61728
  They are cascading with each level overriding the previous level:
61717
61729
 
61718
61730
  1. GENERAL: any style can be specified in general
@@ -61749,6 +61761,9 @@ STYLE = {big:{width:500}} // will be automatically converted to STYLE = {group:{
61749
61761
  NOTE: As of ZIM 016, group styles for an object will be used even if style for the object is set to false
61750
61762
  this will ignore all styles except those made by a group
61751
61763
 
61764
+ NOTE: As of ZIM 019, animate() and drag() can be styled.
61765
+ If the object type is used to target these, use Animate and Drag to avoid conflicting with convenience styles of animate and drag
61766
+
61752
61767
  EXAMPLE
61753
61768
  STYLE = {
61754
61769
  corner:20,