zimjs 17.2.5 → 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.
- package/package.json +1 -1
- package/src/zim.js +42 -24
package/package.json
CHANGED
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
|
|
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);
|
|
@@ -50935,6 +50939,8 @@ RETURNS obj for chaining
|
|
|
50935
50939
|
// bring stageX and stageY into the parent's frame of reference
|
|
50936
50940
|
// could use e.localX and e.localY but might be dragging container or contents
|
|
50937
50941
|
dragObject = (currentTarget)?e.currentTarget:e.target;
|
|
50942
|
+
dragObject.dragStartX = dragObject.x;
|
|
50943
|
+
dragObject.dragStartY = dragObject.y;
|
|
50938
50944
|
|
|
50939
50945
|
|
|
50940
50946
|
if (obj.zimBoundary && !dragObject.getBounds()) {zogy("zim.drag() - drag object needs bounds set"); return;}
|
|
@@ -51224,7 +51230,8 @@ RETURNS obj for chaining
|
|
|
51224
51230
|
lastBackT = upT = 0;
|
|
51225
51231
|
}
|
|
51226
51232
|
|
|
51227
|
-
if (Math.abs(dX) < 1 && Math.abs(dY) < 1) {
|
|
51233
|
+
// if (Math.abs(dX) < 1 && Math.abs(dY) < 1) {
|
|
51234
|
+
if (Math.abs(dragObject.x-dragObject.dragStartX) < 1 && Math.abs(dragObject.y-dragObject.dragStartY) < 1) {
|
|
51228
51235
|
hasMoved = false;
|
|
51229
51236
|
dragObject.dispatchEvent("slidestop");
|
|
51230
51237
|
zim.Ticker.remove(obj.zimDragTicker);
|
|
@@ -55265,7 +55272,18 @@ interval(.05, ()=>{
|
|
|
55265
55272
|
|
|
55266
55273
|
// or if you have a THREEJS mesh
|
|
55267
55274
|
// use quotes to animate a dot property:
|
|
55268
|
-
animate(mesh, {"rotation.y":360*RAD},
|
|
55275
|
+
animate(mesh, {"rotation.y":360*RAD}, 10);
|
|
55276
|
+
|
|
55277
|
+
// or to use the ZIM DUO technique with the animate function (not method),
|
|
55278
|
+
// the normal obj parameter is called target so as not to conflict
|
|
55279
|
+
// with the old obj parameter which is now props but is kept for legacy purposes ;-)
|
|
55280
|
+
animate({
|
|
55281
|
+
target:mesh,
|
|
55282
|
+
props:{"rotation.y":360*RAD},
|
|
55283
|
+
time:10,
|
|
55284
|
+
loop:true,
|
|
55285
|
+
rewind:true
|
|
55286
|
+
});
|
|
55269
55287
|
|
|
55270
55288
|
// or CSS properties - see the CSS parameter for setup info
|
|
55271
55289
|
zss("tagID").opacity = 1; // set this even if it is default
|
|
@@ -69068,9 +69086,10 @@ function apply () {
|
|
|
69068
69086
|
} else {
|
|
69069
69087
|
var point;
|
|
69070
69088
|
if (!zimThree || zimThree.resizeEvent) {
|
|
69089
|
+
var rec = renderer.domElement.getBoundingClientRect();
|
|
69071
69090
|
point = {
|
|
69072
|
-
x: (e.clientX/
|
|
69073
|
-
y: (1-e.clientY/
|
|
69091
|
+
x: ((e.clientX-rec.x)/rec.width*2-1),
|
|
69092
|
+
y: (1-(e.clientY-rec.y)/rec.height*2)
|
|
69074
69093
|
}
|
|
69075
69094
|
} else {
|
|
69076
69095
|
point = {
|
|
@@ -69181,9 +69200,10 @@ function apply () {
|
|
|
69181
69200
|
} else {
|
|
69182
69201
|
var point;
|
|
69183
69202
|
if (!zimThree || zimThree.resizeEvent) {
|
|
69203
|
+
var rec = renderer.domElement.getBoundingClientRect();
|
|
69184
69204
|
point = {
|
|
69185
|
-
x: (e.clientX/
|
|
69186
|
-
y: (1-e.clientY/
|
|
69205
|
+
x: ((e.clientX-rec.x)/rec.width*2-1),
|
|
69206
|
+
y: (1-(e.clientY-rec.y)/rec.height*2)
|
|
69187
69207
|
}
|
|
69188
69208
|
} else {
|
|
69189
69209
|
point = {
|
|
@@ -69450,8 +69470,8 @@ zim.TextureActivesManager = function(stage, toggleKey, damp) {
|
|
|
69450
69470
|
var that = this;
|
|
69451
69471
|
this.type = "TextureActivesManager";
|
|
69452
69472
|
|
|
69453
|
-
that.color =
|
|
69454
|
-
that.outerColor =
|
|
69473
|
+
that.color = darker;
|
|
69474
|
+
that.outerColor = black;
|
|
69455
69475
|
|
|
69456
69476
|
var moveCheck = false;
|
|
69457
69477
|
|
|
@@ -69464,7 +69484,7 @@ zim.TextureActivesManager = function(stage, toggleKey, damp) {
|
|
|
69464
69484
|
|
|
69465
69485
|
var sP = new zim.Proportion({baseMin:1000, baseMax:9000, targetMin:-.1, targetMax:-.05, clamp:false});
|
|
69466
69486
|
|
|
69467
|
-
that.backing = new zim.Rectangle(100,100,
|
|
69487
|
+
that.backing = new zim.Rectangle(100,100,black).addTo(stage,0);
|
|
69468
69488
|
var updateList = [];
|
|
69469
69489
|
that.updateTile = function(obj, textureActives, remove) {
|
|
69470
69490
|
if (!remove) objs.add(obj, textureActives);
|
|
@@ -69613,8 +69633,8 @@ zim.TextureActivesManager = function(stage, toggleKey, damp) {
|
|
|
69613
69633
|
}
|
|
69614
69634
|
this.hide = function() {
|
|
69615
69635
|
if (!that.toggled) return;
|
|
69616
|
-
frame.color = lastColor;
|
|
69617
|
-
frame.outerColor = lastOuter;
|
|
69636
|
+
frame.color = lastColor==undefined?null:lastColor==null?null:lastColor;
|
|
69637
|
+
frame.outerColor = lastOuter==undefined?null:lastOuter==null?null:lastOuter;
|
|
69618
69638
|
that.toggled = false;
|
|
69619
69639
|
zim.Ticker.remove(that.ticker);
|
|
69620
69640
|
nav.removeFrom();
|
|
@@ -93357,7 +93377,7 @@ click, dblclick, mousedown, mouseout, mouseover, pressdown (ZIM), pressmove, pre
|
|
|
93357
93377
|
// the Three section is for the ZIM Three helper library
|
|
93358
93378
|
|
|
93359
93379
|
/*--
|
|
93360
|
-
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)
|
|
93361
93381
|
|
|
93362
93382
|
Three
|
|
93363
93383
|
zim class
|
|
@@ -93477,6 +93497,10 @@ xr - (default false) set to true to make the renderer prepared for XR (AR/VR)
|
|
|
93477
93497
|
VRButton - (default true if xr is true and will add a VRButton if using zim_three import) adds an ENTER VR button
|
|
93478
93498
|
or pass in the VRButton class from three.js if not using the zim_three import
|
|
93479
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
|
|
93480
93504
|
|
|
93481
93505
|
METHODS
|
|
93482
93506
|
position(x, y) - position the three.js canvas (registration point in center) to the stage coordinates
|
|
@@ -93877,11 +93901,6 @@ zim.Socket = function(server, appName, roomName, maxPeople, fill, initObj)
|
|
|
93877
93901
|
|
|
93878
93902
|
Socket
|
|
93879
93903
|
zim class extends a zim EventDispatcher (with the normal event object replaced by a data param)
|
|
93880
|
-
** MUST import socket.io.js with a script tag - SEE link at top of Docs for socket.io.js under ZIM works with...
|
|
93881
|
-
** MUST import zim_socket - see https://zimjs.com/es6.html#MODULES
|
|
93882
|
-
** MUST request a ZIM Socket Server ID or have a NodeJS server running zimserver.js with SocketIO on server (and client as mentioned)
|
|
93883
|
-
** MUST test on a server to avoid CORS errors
|
|
93884
|
-
See: https://zimjs.com/es6.html#MODULES
|
|
93885
93904
|
|
|
93886
93905
|
OVERVIEW
|
|
93887
93906
|
Sockets are how multiuser games, chats, avatars, etc. work.
|
|
@@ -93909,16 +93928,14 @@ https://zimjs.com/control.html // works with control.html
|
|
|
93909
93928
|
NOTE as of ZIM 5.5.0 the zim namespace is no longer required (unless zns is set to true before running zim)
|
|
93910
93929
|
|
|
93911
93930
|
EXAMPLE
|
|
93912
|
-
//
|
|
93913
|
-
|
|
93914
|
-
// https://zimjs.org/cdn/zimserver_urls.js
|
|
93915
|
-
// 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";
|
|
93916
93933
|
|
|
93917
93934
|
// We will make a single Ball that multiple people can drag around
|
|
93918
93935
|
// In the ZIM Frame here is the preparation and the code:
|
|
93919
93936
|
|
|
93920
93937
|
// For the first parameter:
|
|
93921
|
-
// The zimSocketURL comes from
|
|
93938
|
+
// The zimSocketURL comes from the import of zim_socket and points to the ZIM Socket server.
|
|
93922
93939
|
// This way, if we change the server, the app will still work.
|
|
93923
93940
|
|
|
93924
93941
|
// For the second parameter:
|
|
@@ -94066,6 +94083,7 @@ END EXAMPLE
|
|
|
94066
94083
|
PARAMETERS
|
|
94067
94084
|
** supports DUO - parameters or single object with properties below
|
|
94068
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
|
|
94069
94087
|
appName - (required) a string id (one word or joined words) and unique for your app
|
|
94070
94088
|
roomName - (default "default") optional room name otherwise just uses a default room (can represent many rooms if maxPeople is set)
|
|
94071
94089
|
maxPeople - (default 0) how many people are allowed per room - default is 0 which is virtually unlimited
|