zimjs 16.1.6 → 16.1.7

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 +107 -80
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zimjs",
3
- "version": "16.1.6",
3
+ "version": "16.1.7",
4
4
  "type": "module",
5
5
  "main": "./src/zim.js",
6
6
  "types": "./ts-src/typings/zim",
package/src/zim.js CHANGED
@@ -8363,7 +8363,7 @@ Used internally by ZIM to globally dispose common connections
8363
8363
  delete obj.z_bc;
8364
8364
  }
8365
8365
  if (zim.KEYFOCUS == obj) zim.KEYFOCUS = null;
8366
- if (WW.KEYFOCUS == obj) WW.KEYFOCUS = null;
8366
+ if (WW.KEYFOCUS == obj) WW.KEYFOCUS = null;
8367
8367
  if (obj.veeObj) obj.veeObj = null;
8368
8368
  if (obj.draggable) obj.noDrag();
8369
8369
  if (obj.zimTweens) obj.stopAnimate();
@@ -64575,11 +64575,16 @@ zim.TextureActive = function(width, height, color, color2, angle, borderColor, b
64575
64575
 
64576
64576
  if (style!==false) zim.styleTransforms(this, DS);
64577
64577
 
64578
+ this.dispose = function(a,b,disposing) {
64579
+ if (this.textureActives) this.textureActives.remove(this);
64580
+ if (!disposing) this.zimPage_dispose(true);
64581
+ }
64582
+
64578
64583
  this.clone = function() {
64579
64584
  return this.cloneProps(new zim.TextureActive(width, height, color, color2, angle, borderColor, borderWidth, corner, interactive, animated, backingOrbit, pattern, scalePattern, style, this.group, inherit));
64580
64585
  };
64581
64586
  }
64582
- zim.extend(zim.TextureActive, zim.Page, ["clone"], "zimPage", false);
64587
+ zim.extend(zim.TextureActive, zim.Page, ["clone","dispose"], "zimPage", false);
64583
64588
  zim.TextureActive.makeLogo = function(shade, mouse) {
64584
64589
  if (zot(shade)) shade = "light";
64585
64590
  var onLight = shade != "dark";
@@ -64895,7 +64900,8 @@ function addActives(actives) {
64895
64900
  zim.loop(actives, function(active) {
64896
64901
  if (that.actives.indexOf(active) < 0) {
64897
64902
  that.actives.push(active);
64898
- active.cache();
64903
+ active.cache();
64904
+ active.textureActives = that;
64899
64905
  active.canvas.content = active;
64900
64906
  if (active.interactive) {
64901
64907
  interactive = true;
@@ -64974,47 +64980,47 @@ function apply () {
64974
64980
  var tempMatrix = new threejs.Matrix4();
64975
64981
 
64976
64982
  var controller1 = that.controllerLeft = renderer.xr.getController(0);
64977
- controller1.addEventListener('selectstart', doLcDown); // ignoring select
64978
- controller1.addEventListener('selectend', doLcUp);
64979
- controller1.addEventListener('move', doLcMove);
64983
+ controller1.addEventListener('selectstart', that.doLcDown); // ignoring select
64984
+ controller1.addEventListener('selectend', that.doLcUp);
64985
+ controller1.addEventListener('move', that.doLcMove);
64980
64986
 
64981
64987
  var controller2 = that.controllerRight = renderer.xr.getController(1);
64982
- controller2.addEventListener('selectstart', doRcDown); // ignoring select
64983
- controller2.addEventListener('selectend', doRcUp);
64984
- controller2.addEventListener('move', doRcMove);
64988
+ controller2.addEventListener('selectstart', that.doRcDown); // ignoring select
64989
+ controller2.addEventListener('selectend', that.doRcUp);
64990
+ controller2.addEventListener('move', that.doRcMove);
64985
64991
 
64986
- function doLcDown(e) {
64992
+ that.doLcDown = function (e) {
64987
64993
  // possibly need to set pointerID
64988
64994
  XR = true;
64989
64995
  doDown(e);
64990
64996
  }
64991
- function doLcUp(e) {
64997
+ that.doLcUp = function (e) {
64992
64998
  XR = true;
64993
64999
  doUp(e);
64994
65000
  }
64995
- function doLcMove(e) {
65001
+ that.doLcMove = function (e) {
64996
65002
  XR = true;
64997
65003
  doMove(e, "left"); // move does not come with data
64998
65004
  }
64999
-
65000
- function doRcDown(e) {
65005
+ that.doRcDown = function (e) {
65001
65006
  XR = true;
65002
65007
  doDown(e);
65003
65008
  }
65004
- function doRcUp(e) {
65009
+ that.doRcUp = function (e) {
65005
65010
  XR = true;
65006
65011
  doUp(e);
65007
65012
  }
65008
- function doRcMove(e) {
65013
+ that.doRcMove = function (e) {
65009
65014
  XR = true;
65010
65015
  doMove(e, "right");
65011
65016
  }
65012
-
65013
- window.addEventListener("pointerdown", doPointerDown);
65014
- function doPointerDown(e) {
65017
+
65018
+
65019
+ that.doPointerDown = function(e) {
65015
65020
  XR = false;
65016
65021
  doDown(e);
65017
- }
65022
+ }
65023
+ window.addEventListener("pointerdown", that.doPointerDown);
65018
65024
  function doDown(e) {
65019
65025
 
65020
65026
  if (!that.raycast) return;
@@ -65094,11 +65100,12 @@ function apply () {
65094
65100
  }
65095
65101
  }
65096
65102
 
65097
- window.addEventListener("pointerup", doPointerUp);
65098
- function doPointerUp(e) {
65103
+
65104
+ that.doPointerUp = function(e) {
65099
65105
  XR = false;
65100
65106
  doUp(e);
65101
65107
  }
65108
+ window.addEventListener("pointerup", that.doPointerUp);
65102
65109
  function doUp(e) {
65103
65110
 
65104
65111
  if (!that.raycast) return;
@@ -65121,11 +65128,12 @@ function apply () {
65121
65128
  createjs.handleRemotePointer(null, null, "up", e, stage, e.pointerId);
65122
65129
  }
65123
65130
 
65124
- window.addEventListener("pointermove", doPointerMove);
65125
- function doPointerMove(e) {
65131
+
65132
+ that.doPointerMove = function(e) {
65126
65133
  XR = false;
65127
65134
  doMove(e);
65128
65135
  }
65136
+ window.addEventListener("pointermove", that.doPointerMove);
65129
65137
  function doMove(e, handed) {
65130
65138
 
65131
65139
  if (!that.raycast) return;
@@ -65259,7 +65267,7 @@ this.remove = function(actives) {
65259
65267
  if (active.textureMap) delete active.textureMap.userData.ta_content;
65260
65268
  index = that.threeMeshes.indexOf(active);
65261
65269
  if (index >= 0) that.threeMeshes.splice(index, 1);
65262
- active.dispose();
65270
+ // active.dispose();
65263
65271
  }, true);
65264
65272
  if (count > 0) {
65265
65273
  zim.TAM.updateTile(that, that.actives);
@@ -65323,7 +65331,20 @@ that.addMesh = function(mesh, layer) {
65323
65331
  }
65324
65332
 
65325
65333
  that.dispose = function() {
65334
+
65326
65335
  that.raycast = false;
65336
+ window.addEventListener("pointerdown", that.doPointerDown);
65337
+ window.removeEventListener("pointerup", that.doPointerUp);
65338
+ window.removeEventListener("pointermove", that.doPointerMove);
65339
+
65340
+ that.controllerLeft.removeEventListener('selectstart', that.doLcDown); // ignoring select
65341
+ that.controllerLeft.removeEventListener('selectend', that.doLcUp);
65342
+ that.controllerLeft.removeEventListener('move', that.doLcMove);
65343
+
65344
+ that.controllerRight.removeEventListener('selectstart', that.doRcDown); // ignoring select
65345
+ that.controllerRight.removeEventListener('selectend', that.doRcUp);
65346
+ that.controllerRight.removeEventListener('move', that.doRcMove);
65347
+
65327
65348
  if (controls) {
65328
65349
  controls.enableRotate = true;
65329
65350
  controls.enabled = true;
@@ -65369,7 +65390,7 @@ also see the toggle property
65369
65390
  and show() and hide()
65370
65391
  show() - show the ZIM canvas and hide the three.js canvas - also see toggle()
65371
65392
  hide() - hide the ZIM canvas and show the three.js canvas - also see toggle()
65372
- dispose() - disposes objects in the manager
65393
+ dispose(obj) - disposes objects in the manager
65373
65394
 
65374
65395
  PROPERTIES
65375
65396
  type - holds the class name as a String
@@ -65600,7 +65621,10 @@ zim.TextureActivesManager = function(stage, toggleKey, damp) {
65600
65621
  that.updateTile(null, null, true);
65601
65622
  }
65602
65623
 
65603
- that.dispose = function() {
65624
+ that.dispose = function() {
65625
+ zim.loop(objs, function(obj) {
65626
+ obj.dispose();
65627
+ });
65604
65628
  that.hide();
65605
65629
  nav.dispose();
65606
65630
  frame.off("keydown", that.keyEvent);
@@ -82776,6 +82800,9 @@ zim.Frame = function(scaling, width, height, color, outerColor, ready, assets, p
82776
82800
  if (canvas) canvas.removeAllEventListeners();
82777
82801
  if (that.frameTime) clearInterval(that.frameTime);
82778
82802
 
82803
+ if (zim.TAM) zim.TAM.dispose();
82804
+ zim.TAM = null;
82805
+
82779
82806
  if (WW.zimDefaultPhysics && WW.zimDefaultPhysics.dispose) WW.zimDefaultPhysics.dispose();
82780
82807
  if (WW.zimDefaultThree && WW.zimDefaultThree.dispose) WW.zimDefaultThree.dispose();
82781
82808
 
@@ -88596,8 +88623,8 @@ makePanel(textureActive, textureActives, scale, curve, opacity, material, double
88596
88623
  scale (default .5) change to adjust the width and height of the geometry
88597
88624
  curve (default null) change the z amount to curve the geometry - also can use negative amount
88598
88625
  opacity (default 1) change to set the opacity of the material, can also set opacity on the TextureActve
88599
- material (default "MeshBasicMaterial") a string version if three.js materials
88600
- example "MeshPhongMaterial", "MeshLamberMaterial" - both these need lights
88626
+ material (default THREE.MeshBasicMaterial) a three.js material
88627
+ example THREE.MeshPhongMaterial, THREE.MeshLamberMaterial - both these need lights
88601
88628
  doubleSide (default false) set to true to do double sided material
88602
88629
  colorSpace (default null) see https://threejs.org/docs/#manual/en/introduction/Color-management
88603
88630
  returns a three.js mesh with the textureActive object set as a CanvasTexture
@@ -88605,6 +88632,14 @@ makePanel(textureActive, textureActives, scale, curve, opacity, material, double
88605
88632
  All this can be done manually in three.js - it is just a wrapper function to make panels
88606
88633
  See https://zimjs.com/015/textureactive_raw.html for a manual example - scroll down to the THREE section and see MENU
88607
88634
  ** if being used for a HUD in sceneOrtho then see the pos() method below for METHODS ON MESH
88635
+ posMesh(mesh, x, y, horizontal, vertical, gutter) - use for sceneOrtho makePanel meshes
88636
+ position a mesh on the sceneOrtho around the edges or middle as follows:
88637
+ x - default 0 - the distance in the x
88638
+ y - default 0 - the distance in the y
88639
+ horizontal - default LEFT - set to LEFT, CENTER, RIGHT to specify where the distance is applied horizontally
88640
+ horizontal - default TOP - set to TOP, CENTER, BOTTOM to specify where the distance is applied vertically
88641
+ gutter - default 0 - distance in the horizontal middle to keep left and right away from each other
88642
+ the left and right will stop squeezing and possibly go off the screen when the window is reduced
88608
88643
  flipMaterial(materialType, params) - flip about the y access a material
88609
88644
  This will set the userData.ta_flipped to true which guides the TextureActives raycasting on the UV x coordinate
88610
88645
  The params are the regular parameter object that would be passed to the material such as color, map, transparency, alpha, etc.
@@ -88618,15 +88653,7 @@ dispose() - clears geometries, materials, stops the renderer, removes scene and
88618
88653
  myThree.dispose();
88619
88654
  mythree = null; // same for any dispose - ZIM cannot set your variables to null
88620
88655
  METHODS ON MESH
88621
- ** If makePanel() is used on the ortho scene (ortho parameter true and makeMesh added to three.sceneOrtho)
88622
- ** then the mesh is given a pos() method:
88623
- pos(x,y,horizontal,vertical,gutter) - position a mesh on the sceneOrtho around the edges or middle as follows:
88624
- x - default 0 - the distance in the x
88625
- y - default 0 - the distance in the y
88626
- horizontal - default LEFT - set to LEFT, CENTER, RIGHT to specify where the distance is applied horizontally
88627
- horizontal - default TOP - set to TOP, CENTER, BOTTOM to specify where the distance is applied vertically
88628
- gutter - default 0 - distance in the horizontal middle to keep left and right away from each other
88629
- the left and right will stop squeezing and possibly go off the screen when the window is reduced
88656
+ pos(x,y,horizontal,vertical,gutter) - DEPRECATED - see posMesh() method
88630
88657
 
88631
88658
  PROPERTIES
88632
88659
  renderer - the three.js WebGLRenderer (see three.js Docs)
@@ -90434,48 +90461,48 @@ for (z_i = 0; z_i < globalFunctions.length; z_i++) {
90434
90461
 
90435
90462
  // these are global regardless
90436
90463
  var globalsConstants = [
90437
- ["FIT", zim.FIT],
90438
- ["FILL", zim.FILL],
90439
- ["FULL", zim.FULL],
90440
- ["LEFT", zim.LEFT],
90441
- ["RIGHT", zim.RIGHT],
90442
- ["CENTER", zim.CENTER],
90443
- ["MIDDLE", zim.MIDDLE],
90444
- ["START", zim.START],
90445
- ["END", zim.END],
90446
- ["TOP", zim.TOP],
90447
- ["BOTTOM", zim.BOTTOM],
90448
- ["OVER", zim.OVER],
90449
- ["UNDER", zim.UNDER],
90450
- ["HORIZONTAL", zim.HORIZONTAL],
90451
- ["VERTICAL", zim.VERTICAL],
90452
- ["BOTH", zim.BOTH],
90453
- ["RADIAL", zim.RADIAL],
90454
- ["UP", zim.UP],
90455
- ["DOWN", zim.DOWN],
90456
- ["NEXT", zim.NEXT],
90457
- ["PREV", zim.PREV],
90458
- ["AUTO", zim.AUTO],
90459
- ["AVE", zim.AVE],
90460
- ["DEFAULT", zim.DEFAULT],
90461
- ["ALL", zim.ALL],
90462
- ["NONE", zim.NONE],
90463
- ["GET", zim.GET],
90464
- ["POST", zim.POST],
90465
- ["LOCALSTORAGE", zim.LOCALSTORAGE],
90466
- ["SOCKET", zim.SOCKET],
90467
- ["TO", zim.TO],
90468
- ["FROM", zim.FROM],
90469
- ["SINE", zim.SINE],
90470
- ["SQUARE", zim.SQUARE],
90471
- ["TRIANGLE", zim.TRIANGLE],
90472
- ["SAW", zim.SAW],
90473
- ["SAWTOOTH", zim.SAWTOOTH],
90474
- ["ZAP", zim.ZAP],
90475
- ["TAU", zim.TAU],
90476
- ["DEG", zim.DEG],
90477
- ["RAD", zim.RAD],
90478
- ["PHI", zim.PHI],
90464
+ ["FIT", zim.FIT],
90465
+ ["FILL", zim.FILL],
90466
+ ["FULL", zim.FULL],
90467
+ ["LEFT", zim.LEFT],
90468
+ ["RIGHT", zim.RIGHT],
90469
+ ["CENTER", zim.CENTER],
90470
+ ["MIDDLE", zim.MIDDLE],
90471
+ ["START", zim.START],
90472
+ ["END", zim.END],
90473
+ ["TOP", zim.TOP],
90474
+ ["BOTTOM", zim.BOTTOM],
90475
+ ["OVER", zim.OVER],
90476
+ ["UNDER", zim.UNDER],
90477
+ ["HORIZONTAL", zim.HORIZONTAL],
90478
+ ["VERTICAL", zim.VERTICAL],
90479
+ ["BOTH", zim.BOTH],
90480
+ ["RADIAL", zim.RADIAL],
90481
+ ["UP", zim.UP],
90482
+ ["DOWN", zim.DOWN],
90483
+ ["NEXT", zim.NEXT],
90484
+ ["PREV", zim.PREV],
90485
+ ["AUTO", zim.AUTO],
90486
+ ["AVE", zim.AVE],
90487
+ ["DEFAULT", zim.DEFAULT],
90488
+ ["ALL", zim.ALL],
90489
+ ["NONE", zim.NONE],
90490
+ ["GET", zim.GET],
90491
+ ["POST", zim.POST],
90492
+ ["LOCALSTORAGE", zim.LOCALSTORAGE],
90493
+ ["SOCKET", zim.SOCKET],
90494
+ ["TO", zim.TO],
90495
+ ["FROM", zim.FROM],
90496
+ ["SINE", zim.SINE],
90497
+ ["SQUARE", zim.SQUARE],
90498
+ ["TRIANGLE", zim.TRIANGLE],
90499
+ ["SAW", zim.SAW],
90500
+ ["SAWTOOTH", zim.SAWTOOTH],
90501
+ ["ZAP", zim.ZAP],
90502
+ ["TAU", zim.TAU],
90503
+ ["DEG", zim.DEG],
90504
+ ["RAD", zim.RAD],
90505
+ ["PHI", zim.PHI],
90479
90506
  ];
90480
90507
 
90481
90508
  for (z_i = 0; z_i < globalsConstants.length; z_i++) {