zimjs 17.2.6 → 17.2.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 +26 -22
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zimjs",
3
- "version": "17.2.6",
3
+ "version": "17.2.7",
4
4
  "type": "module",
5
5
  "main": "./src/zim.js",
6
6
  "types": "./ts-src/typings/zim",
package/src/zim.js CHANGED
@@ -28418,6 +28418,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
28418
28418
  hitArea.y = -content.y;
28419
28419
  }
28420
28420
  content.x = hscrollBar.proportion.convert(hscrollBar.x);
28421
+ if (!damp) desiredX = that.scrollX;
28421
28422
  testContent();
28422
28423
  });
28423
28424
  }
@@ -28450,7 +28451,10 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
28450
28451
  hitArea.y = -content.y;
28451
28452
  }
28452
28453
  if (damp) desiredY = vscrollBar.proportion.convert(vscrollBar.y);
28453
- else content.y = vscrollBar.proportion.convert(vscrollBar.y);
28454
+ else {
28455
+ content.y = vscrollBar.proportion.convert(vscrollBar.y);
28456
+ desiredY = that.scrollY;
28457
+ }
28454
28458
  testContent();
28455
28459
  });
28456
28460
  }
@@ -28969,7 +28973,7 @@ added, click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmo
28969
28973
  document.WW.addEventListener("blur", that.blurEvent);
28970
28974
  }
28971
28975
 
28972
- function stageUp() {
28976
+ function stageUp() {
28973
28977
  zim.Ticker.remove(swipeMovescrollBars);
28974
28978
  swipeCheck = false;
28975
28979
  if (hCheck) if (scrollBarFade && scrollBarActive) zim.animate(hscrollBar, {alpha:0}, scrollBar.fadeTime);
@@ -69082,9 +69086,10 @@ function apply () {
69082
69086
  } else {
69083
69087
  var point;
69084
69088
  if (!zimThree || zimThree.resizeEvent) {
69089
+ var rec = renderer.domElement.getBoundingClientRect();
69085
69090
  point = {
69086
- x: (e.clientX/window.innerWidth*2-1),
69087
- y: (1-e.clientY/window.innerHeight*2)
69091
+ x: ((e.clientX-rec.x)/rec.width*2-1),
69092
+ y: (1-(e.clientY-rec.y)/rec.height*2)
69088
69093
  }
69089
69094
  } else {
69090
69095
  point = {
@@ -69195,9 +69200,10 @@ function apply () {
69195
69200
  } else {
69196
69201
  var point;
69197
69202
  if (!zimThree || zimThree.resizeEvent) {
69203
+ var rec = renderer.domElement.getBoundingClientRect();
69198
69204
  point = {
69199
- x: (e.clientX/window.innerWidth*2-1),
69200
- y: (1-e.clientY/window.innerHeight*2)
69205
+ x: ((e.clientX-rec.x)/rec.width*2-1),
69206
+ y: (1-(e.clientY-rec.y)/rec.height*2)
69201
69207
  }
69202
69208
  } else {
69203
69209
  point = {
@@ -69464,8 +69470,8 @@ zim.TextureActivesManager = function(stage, toggleKey, damp) {
69464
69470
  var that = this;
69465
69471
  this.type = "TextureActivesManager";
69466
69472
 
69467
- that.color = zim.darker;
69468
- that.outerColor = "black";
69473
+ that.color = darker;
69474
+ that.outerColor = black;
69469
69475
 
69470
69476
  var moveCheck = false;
69471
69477
 
@@ -69478,7 +69484,7 @@ zim.TextureActivesManager = function(stage, toggleKey, damp) {
69478
69484
 
69479
69485
  var sP = new zim.Proportion({baseMin:1000, baseMax:9000, targetMin:-.1, targetMax:-.05, clamp:false});
69480
69486
 
69481
- that.backing = new zim.Rectangle(100,100,zim.faint).addTo(stage,0);
69487
+ that.backing = new zim.Rectangle(100,100,black).addTo(stage,0);
69482
69488
  var updateList = [];
69483
69489
  that.updateTile = function(obj, textureActives, remove) {
69484
69490
  if (!remove) objs.add(obj, textureActives);
@@ -69627,8 +69633,8 @@ zim.TextureActivesManager = function(stage, toggleKey, damp) {
69627
69633
  }
69628
69634
  this.hide = function() {
69629
69635
  if (!that.toggled) return;
69630
- frame.color = lastColor;
69631
- frame.outerColor = lastOuter;
69636
+ frame.color = lastColor==undefined?null:lastColor==null?null:lastColor;
69637
+ frame.outerColor = lastOuter==undefined?null:lastOuter==null?null:lastOuter;
69632
69638
  that.toggled = false;
69633
69639
  zim.Ticker.remove(that.ticker);
69634
69640
  nav.removeFrom();
@@ -93371,7 +93377,7 @@ click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmove, pre
93371
93377
  // the Three section is for the ZIM Three helper library
93372
93378
 
93373
93379
  /*--
93374
- zim.Three = function(width, height, color, cameraPosition, cameraLook, interactive, resize, frame, ortho, textureActive, colorSpace, colorManagement, legacyLights, throttle, lay, full, xr, VRButton, xrBufferScale)
93380
+ zim.Three = function(width, height, color, cameraPosition, cameraLook, interactive, resize, frame, ortho, textureActive, colorSpace, colorManagement, legacyLights, throttle, lay, full, xr, VRButton, xrBufferScale, tag)
93375
93381
 
93376
93382
  Three
93377
93383
  zim class
@@ -93491,6 +93497,10 @@ xr - (default false) set to true to make the renderer prepared for XR (AR/VR)
93491
93497
  VRButton - (default true if xr is true and will add a VRButton if using zim_three import) adds an ENTER VR button
93492
93498
  or pass in the VRButton class from three.js if not using the zim_three import
93493
93499
  xrBufferScale - (default 2) magnification of scene - 2 makes for better quality in VR
93500
+ tag - (default null) a string to an HTML tag with id or the HTML Element to add the three.js renderer domElement to
93501
+ this is to be used with TextureActive to be able to add a feature to an existing html tag
93502
+ the width and height of the tag will be used and should be set ahead of time with CSS - px or percent is okay
93503
+ See: https://zimjs.com/015/textureactive_simple_tag.html
93494
93504
 
93495
93505
  METHODS
93496
93506
  position(x, y) - position the three.js canvas (registration point in center) to the stage coordinates
@@ -93891,11 +93901,6 @@ zim.Socket = function(server, appName, roomName, maxPeople, fill, initObj)
93891
93901
 
93892
93902
  Socket
93893
93903
  zim class extends a zim EventDispatcher (with the normal event object replaced by a data param)
93894
- ** MUST import socket.io.js with a script tag - SEE link at top of Docs for socket.io.js under ZIM works with...
93895
- ** MUST import zim_socket - see https://zimjs.com/es6.html#MODULES
93896
- ** MUST request a ZIM Socket Server ID or have a NodeJS server running zimserver.js with SocketIO on server (and client as mentioned)
93897
- ** MUST test on a server to avoid CORS errors
93898
- See: https://zimjs.com/es6.html#MODULES
93899
93904
 
93900
93905
  OVERVIEW
93901
93906
  Sockets are how multiuser games, chats, avatars, etc. work.
@@ -93923,16 +93928,14 @@ https://zimjs.com/control.html // works with control.html
93923
93928
  NOTE as of ZIM 5.5.0 the zim namespace is no longer required (unless zns is set to true before running zim)
93924
93929
 
93925
93930
  EXAMPLE
93926
- // up top after loading CreateJS and ZIM add the latest versions of these files
93927
- // https://zimjs.org/cdn/2.3.0/socket.io.js
93928
- // https://zimjs.org/cdn/zimserver_urls.js
93929
- // https://zimjs.org/cdn/zimsocket_1.1.js
93931
+ // must import the socket module at the top of the script
93932
+ import zim from "https://zimjs.org/cdn/017/zim_socket";
93930
93933
 
93931
93934
  // We will make a single Ball that multiple people can drag around
93932
93935
  // In the ZIM Frame here is the preparation and the code:
93933
93936
 
93934
93937
  // For the first parameter:
93935
- // The zimSocketURL comes from zimserver_urls.js and points to the ZIM Socket server.
93938
+ // The zimSocketURL comes from the import of zim_socket and points to the ZIM Socket server.
93936
93939
  // This way, if we change the server, the app will still work.
93937
93940
 
93938
93941
  // For the second parameter:
@@ -94080,6 +94083,7 @@ END EXAMPLE
94080
94083
  PARAMETERS
94081
94084
  ** supports DUO - parameters or single object with properties below
94082
94085
  server - (default https://localhost:3000) the server that is running node and the zimsocket.js : portNumber
94086
+ if using the ZIM socket server then this should be zimSocketURL which is defined in the zim_socket import
94083
94087
  appName - (required) a string id (one word or joined words) and unique for your app
94084
94088
  roomName - (default "default") optional room name otherwise just uses a default room (can represent many rooms if maxPeople is set)
94085
94089
  maxPeople - (default 0) how many people are allowed per room - default is 0 which is virtually unlimited