@woosh/meep-engine 2.109.25 → 2.110.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.
- package/build/meep.cjs +229 -461
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +229 -461
- package/editor/tools/GridPaintTool.js +12 -11
- package/editor/tools/engine/ToolEngine.js +2 -1
- package/package.json +1 -1
- package/src/core/collection/heap/{FastBinaryHeap.d.ts → BinaryHeap.d.ts} +4 -4
- package/src/core/collection/heap/BinaryHeap.d.ts.map +1 -0
- package/src/core/collection/heap/{FastBinaryHeap.js → BinaryHeap.js} +3 -3
- package/src/core/collection/heap/BinaryHeap.spec.d.ts +2 -0
- package/src/core/collection/heap/BinaryHeap.spec.d.ts.map +1 -0
- package/src/core/collection/heap/{FastBinaryHeap.spec.js → BinaryHeap.spec.js} +10 -10
- package/src/core/collection/heap/Uint32Heap.spec.d.ts +2 -0
- package/src/core/collection/heap/Uint32Heap.spec.d.ts.map +1 -0
- package/src/core/geom/3d/topology/simplify/simplifyTopoMesh.d.ts +1 -0
- package/src/core/geom/3d/topology/simplify/simplifyTopoMesh.d.ts.map +1 -1
- package/src/core/geom/3d/topology/simplify/simplifyTopoMesh.js +5 -5
- package/src/core/geom/3d/triangle/computeTriangleRayIntersectionBarycentricEdge.d.ts.map +1 -1
- package/src/core/geom/3d/triangle/computeTriangleRayIntersectionBarycentricEdge.js +14 -8
- package/src/core/geom/packing/max-rect/MaxRectanglesPacker.js +2 -2
- package/src/core/graph/Edge.d.ts +1 -0
- package/src/core/graph/Edge.d.ts.map +1 -1
- package/src/core/graph/Edge.js +5 -0
- package/src/core/graph/graph_compute_distance_matrix.js +2 -2
- package/src/core/graph/metis/cluster_mesh_metis.d.ts +9 -0
- package/src/core/graph/metis/cluster_mesh_metis.d.ts.map +1 -0
- package/src/core/graph/metis/cluster_mesh_metis.js +31 -0
- package/src/core/graph/metis/mesh_to_metis_graph.d.ts +10 -0
- package/src/core/graph/metis/mesh_to_metis_graph.d.ts.map +1 -0
- package/src/core/graph/metis/mesh_to_metis_graph.js +64 -0
- package/src/core/graph/metis/metis_cluster_bs.d.ts +12 -0
- package/src/core/graph/metis/metis_cluster_bs.d.ts.map +1 -0
- package/src/core/graph/{cluster_mesh_metis.js → metis/metis_cluster_bs.js} +12 -98
- package/src/core/graph/mn_graph_coarsen.d.ts.map +1 -1
- package/src/core/graph/mn_graph_coarsen.js +7 -3
- package/src/core/graph/mn_graph_coarsen.spec.js +2 -0
- package/src/core/math/interval/NumericInterval.d.ts +13 -7
- package/src/core/math/interval/NumericInterval.d.ts.map +1 -1
- package/src/core/math/interval/NumericInterval.js +35 -15
- package/src/engine/asset/AssetManager.js +3 -3
- package/src/engine/graphics/camera/makeOrbitalCameraController.d.ts.map +1 -1
- package/src/engine/graphics/camera/makeOrbitalCameraController.js +4 -4
- package/src/engine/graphics/geometry/VertexDataSpec.d.ts.map +1 -1
- package/src/engine/graphics/geometry/VertexDataSpec.js +4 -7
- package/src/engine/graphics/sh3/gi/material/common.glsl +45 -54
- package/src/engine/graphics/sh3/gi/material/makeOctahedralDepthAtlas.d.ts.map +1 -1
- package/src/engine/graphics/sh3/gi/material/makeOctahedralDepthAtlas.js +5 -3
- package/src/engine/graphics/sh3/lpv/LightProbeVolume.js +2 -2
- package/src/engine/graphics/sh3/lpv/LightProbeVolumeBaker.js +1 -1
- package/src/engine/graphics/sh3/lpv/PathTracerProbeRenderer.d.ts.map +1 -1
- package/src/engine/graphics/sh3/lpv/PathTracerProbeRenderer.js +3 -2
- package/src/engine/graphics/sh3/lpv/depth/octahedral/bake_octahedral_depth_map.d.ts.map +1 -1
- package/src/engine/graphics/sh3/lpv/depth/octahedral/bake_octahedral_depth_map.js +14 -7
- package/src/engine/graphics/sh3/lpv/depth/octahedral/v2/visualise.frag.glsl +17 -15
- package/src/engine/graphics/sh3/lpv/probe_volume_to_textures.d.ts.map +1 -1
- package/src/engine/graphics/sh3/lpv/probe_volume_to_textures.js +6 -2
- package/src/engine/graphics/sh3/lpv/serialization/LightProbeVolumeSerializationAdapter.js +2 -2
- package/src/engine/graphics/sh3/path_tracer/PathTracedScene.d.ts.map +1 -1
- package/src/engine/graphics/sh3/path_tracer/PathTracedScene.js +10 -0
- package/src/engine/graphics/sh3/prototypeSH3Probe.js +3 -3
- package/src/engine/input/devices/LocationalInteractionMetadata.d.ts +4 -0
- package/src/engine/input/devices/LocationalInteractionMetadata.d.ts.map +1 -1
- package/src/engine/input/devices/LocationalInteractionMetadata.js +6 -1
- package/src/engine/input/devices/PointerDevice.d.ts +0 -3
- package/src/engine/input/devices/PointerDevice.d.ts.map +1 -1
- package/src/engine/input/devices/PointerDevice.js +49 -306
- package/src/engine/input/devices/events/PointerEvents.d.ts +14 -0
- package/src/engine/input/devices/events/PointerEvents.d.ts.map +1 -0
- package/src/engine/input/devices/events/PointerEvents.js +16 -0
- package/src/engine/input/devices/events/eventToSourceIdentifier.d.ts.map +1 -0
- package/src/engine/input/devices/mouse/decodeMouseEventButtons.d.ts +10 -0
- package/src/engine/input/devices/mouse/decodeMouseEventButtons.d.ts.map +1 -0
- package/src/engine/input/devices/mouse/decodeMouseEventButtons.js +19 -0
- package/src/engine/input/devices/mouse/suppressContextMenu.d.ts +7 -0
- package/src/engine/input/devices/mouse/suppressContextMenu.d.ts.map +1 -0
- package/src/engine/input/devices/mouse/suppressContextMenu.js +11 -0
- package/src/engine/input/devices/touch/TouchDevice.d.ts +20 -0
- package/src/engine/input/devices/touch/TouchDevice.d.ts.map +1 -0
- package/src/engine/input/devices/touch/TouchDevice.js +95 -0
- package/src/engine/input/devices/touch/getTouchCenter.d.ts +7 -0
- package/src/engine/input/devices/touch/getTouchCenter.d.ts.map +1 -0
- package/src/engine/input/devices/touch/getTouchCenter.js +32 -0
- package/src/engine/input/devices/touch/observePinch.d.ts +12 -0
- package/src/engine/input/devices/touch/observePinch.d.ts.map +1 -0
- package/src/engine/input/devices/touch/observePinch.js +128 -0
- package/src/engine/network/PriorityFetch.d.ts.map +1 -1
- package/src/engine/network/PriorityFetch.js +2 -2
- package/src/generation/grid/generation/discrete/GridTaskConnectRooms.js +3 -3
- package/src/generation/grid/generation/discrete/layer/GridTaskBuildSourceDistanceMap.js +2 -2
- package/src/generation/grid/generation/discrete/layer/GridTaskDistanceToMarkers.js +2 -2
- package/src/generation/grid/generation/road/GridTaskGenerateRoads.js +2 -2
- package/src/core/collection/heap/FastBinaryHeap.d.ts.map +0 -1
- package/src/core/collection/heap/FastBinaryHeap.spec.d.ts +0 -2
- package/src/core/collection/heap/FastBinaryHeap.spec.d.ts.map +0 -1
- package/src/core/collection/heap/Uin32Heap.spec.d.ts +0 -2
- package/src/core/collection/heap/Uin32Heap.spec.d.ts.map +0 -1
- package/src/core/graph/cluster_mesh_metis.d.ts +0 -28
- package/src/core/graph/cluster_mesh_metis.d.ts.map +0 -1
- package/src/engine/input/devices/eventToSourceIdentifier.d.ts.map +0 -1
- /package/src/core/collection/heap/{Uin32Heap.spec.js → Uint32Heap.spec.js} +0 -0
- /package/src/engine/input/devices/{eventToSourceIdentifier.d.ts → events/eventToSourceIdentifier.d.ts} +0 -0
- /package/src/engine/input/devices/{eventToSourceIdentifier.js → events/eventToSourceIdentifier.js} +0 -0
package/build/meep.module.js
CHANGED
|
@@ -54461,6 +54461,10 @@ class NumericInterval {
|
|
|
54461
54461
|
*/
|
|
54462
54462
|
this.max = max;
|
|
54463
54463
|
|
|
54464
|
+
/**
|
|
54465
|
+
* @readonly
|
|
54466
|
+
* @type {Signal<number, number, number, number>}
|
|
54467
|
+
*/
|
|
54464
54468
|
this.onChanged = new Signal();
|
|
54465
54469
|
}
|
|
54466
54470
|
|
|
@@ -54475,24 +54479,21 @@ class NumericInterval {
|
|
|
54475
54479
|
const oldMin = this.min;
|
|
54476
54480
|
const oldMax = this.max;
|
|
54477
54481
|
|
|
54478
|
-
if (min
|
|
54479
|
-
|
|
54480
|
-
|
|
54482
|
+
if (min === oldMin && max === oldMax) {
|
|
54483
|
+
return;
|
|
54484
|
+
}
|
|
54481
54485
|
|
|
54482
|
-
|
|
54483
|
-
|
|
54484
|
-
|
|
54486
|
+
this.min = min;
|
|
54487
|
+
this.max = max;
|
|
54488
|
+
|
|
54489
|
+
if (!this.onChanged.hasHandlers()) {
|
|
54490
|
+
return;
|
|
54485
54491
|
}
|
|
54486
|
-
}
|
|
54487
54492
|
|
|
54488
|
-
|
|
54489
|
-
*
|
|
54490
|
-
* @param {NumericInterval} other
|
|
54491
|
-
*/
|
|
54492
|
-
copy(other) {
|
|
54493
|
-
this.set(other.min, other.max);
|
|
54493
|
+
this.onChanged.send4(min, max, oldMin, oldMax);
|
|
54494
54494
|
}
|
|
54495
54495
|
|
|
54496
|
+
|
|
54496
54497
|
/**
|
|
54497
54498
|
*
|
|
54498
54499
|
* @param {number} value
|
|
@@ -54565,6 +54566,10 @@ class NumericInterval {
|
|
|
54565
54566
|
};
|
|
54566
54567
|
}
|
|
54567
54568
|
|
|
54569
|
+
toString() {
|
|
54570
|
+
return `NumericInterval{ min=${this.min}, max=${this.max} }`;
|
|
54571
|
+
}
|
|
54572
|
+
|
|
54568
54573
|
/**
|
|
54569
54574
|
*
|
|
54570
54575
|
* @param {BinaryBuffer} buffer
|
|
@@ -54583,6 +54588,14 @@ class NumericInterval {
|
|
|
54583
54588
|
this.max = buffer.readFloat64();
|
|
54584
54589
|
}
|
|
54585
54590
|
|
|
54591
|
+
/**
|
|
54592
|
+
*
|
|
54593
|
+
* @param {NumericInterval} other
|
|
54594
|
+
*/
|
|
54595
|
+
copy(other) {
|
|
54596
|
+
this.set(other.min, other.max);
|
|
54597
|
+
}
|
|
54598
|
+
|
|
54586
54599
|
/**
|
|
54587
54600
|
*
|
|
54588
54601
|
* @param {NumericInterval} other
|
|
@@ -54623,12 +54636,19 @@ NumericInterval.prototype.isNumericInterval = true;
|
|
|
54623
54636
|
* @readonly
|
|
54624
54637
|
* @type {NumericInterval}
|
|
54625
54638
|
*/
|
|
54626
|
-
NumericInterval.
|
|
54639
|
+
NumericInterval.zero_zero = Object.freeze(new NumericInterval(0, 0));
|
|
54640
|
+
|
|
54641
|
+
/**
|
|
54642
|
+
* @readonly
|
|
54643
|
+
* @type {NumericInterval}
|
|
54644
|
+
*/
|
|
54645
|
+
NumericInterval.zero_one = Object.freeze(new NumericInterval(0, 1));
|
|
54646
|
+
|
|
54627
54647
|
/**
|
|
54628
54648
|
* @readonly
|
|
54629
54649
|
* @type {NumericInterval}
|
|
54630
54650
|
*/
|
|
54631
|
-
NumericInterval.
|
|
54651
|
+
NumericInterval.one_one = Object.freeze(new NumericInterval(1, 1));
|
|
54632
54652
|
|
|
54633
54653
|
/**
|
|
54634
54654
|
*
|
|
@@ -71547,6 +71567,23 @@ class EntityObserver {
|
|
|
71547
71567
|
}
|
|
71548
71568
|
}
|
|
71549
71569
|
|
|
71570
|
+
/**
|
|
71571
|
+
* Given an object and a value, find the first property with matching value and returns name of that property
|
|
71572
|
+
* Useful for working with ENUM-like objects
|
|
71573
|
+
* @param {Object<T>} object
|
|
71574
|
+
* @param {T} value
|
|
71575
|
+
* @returns {string|undefined} name of the property, or undefined if property not found
|
|
71576
|
+
*/
|
|
71577
|
+
function objectKeyByValue(object, value) {
|
|
71578
|
+
for (let i in object) {
|
|
71579
|
+
if (object[i] === value) {
|
|
71580
|
+
return i;
|
|
71581
|
+
}
|
|
71582
|
+
}
|
|
71583
|
+
|
|
71584
|
+
return undefined;
|
|
71585
|
+
}
|
|
71586
|
+
|
|
71550
71587
|
/**
|
|
71551
71588
|
*
|
|
71552
71589
|
* @enum {number}
|
|
@@ -71663,6 +71700,10 @@ class Edge {
|
|
|
71663
71700
|
return [this.first, this.second];
|
|
71664
71701
|
}
|
|
71665
71702
|
|
|
71703
|
+
toString() {
|
|
71704
|
+
return `Edge{ first=${this.first}, second=${this.second}, direction=${objectKeyByValue(EdgeDirectionType, this.direction)} }`
|
|
71705
|
+
}
|
|
71706
|
+
|
|
71666
71707
|
}
|
|
71667
71708
|
|
|
71668
71709
|
/**
|
|
@@ -78580,23 +78621,6 @@ class ShadedGeometrySystem extends System {
|
|
|
78580
78621
|
}
|
|
78581
78622
|
}
|
|
78582
78623
|
|
|
78583
|
-
/**
|
|
78584
|
-
* Given an object and a value, find the first property with matching value and returns name of that property
|
|
78585
|
-
* Useful for working with ENUM-like objects
|
|
78586
|
-
* @param {Object<T>} object
|
|
78587
|
-
* @param {T} value
|
|
78588
|
-
* @returns {string|undefined} name of the property, or undefined if property not found
|
|
78589
|
-
*/
|
|
78590
|
-
function objectKeyByValue(object, value) {
|
|
78591
|
-
for (let i in object) {
|
|
78592
|
-
if (object[i] === value) {
|
|
78593
|
-
return i;
|
|
78594
|
-
}
|
|
78595
|
-
}
|
|
78596
|
-
|
|
78597
|
-
return undefined;
|
|
78598
|
-
}
|
|
78599
|
-
|
|
78600
78624
|
/**
|
|
78601
78625
|
*
|
|
78602
78626
|
* @enum {string}
|
|
@@ -84592,7 +84616,7 @@ class ViewStack extends View {
|
|
|
84592
84616
|
* The data structure is a binary heap where elements are removed in order defined by scoring function
|
|
84593
84617
|
* @template T
|
|
84594
84618
|
*/
|
|
84595
|
-
class
|
|
84619
|
+
class BinaryHeap {
|
|
84596
84620
|
/**
|
|
84597
84621
|
* @private
|
|
84598
84622
|
* @type {T[]}
|
|
@@ -84863,7 +84887,7 @@ class FastBinaryHeap {
|
|
|
84863
84887
|
* @readonly
|
|
84864
84888
|
* @type {boolean}
|
|
84865
84889
|
*/
|
|
84866
|
-
|
|
84890
|
+
BinaryHeap.prototype.isBinaryHeap = true;
|
|
84867
84891
|
|
|
84868
84892
|
/**
|
|
84869
84893
|
* Decorator that wraps another map and lets you observe mutations
|
|
@@ -86053,7 +86077,7 @@ let Response$1 = class Response {
|
|
|
86053
86077
|
};
|
|
86054
86078
|
|
|
86055
86079
|
/**
|
|
86056
|
-
* Used by the priority queue, so the priority is inverted as the
|
|
86080
|
+
* Used by the priority queue, so the priority is inverted as the BinaryHeap returns elements in ascending score order (from lowest)
|
|
86057
86081
|
* @param {PendingAsset} pending_asset
|
|
86058
86082
|
* @returns {number}
|
|
86059
86083
|
*/
|
|
@@ -86088,7 +86112,7 @@ class AssetManager {
|
|
|
86088
86112
|
* @type {BinaryHeap<PendingAsset>}
|
|
86089
86113
|
* @private
|
|
86090
86114
|
*/
|
|
86091
|
-
#pending_asset_wait_queue = new
|
|
86115
|
+
#pending_asset_wait_queue = new BinaryHeap(get_pending_asset_priority_score);
|
|
86092
86116
|
/**
|
|
86093
86117
|
* Assets currently being processed by #loaders
|
|
86094
86118
|
* @type {Set<PendingAsset>}
|
|
@@ -91420,6 +91444,18 @@ class KeyboardDevice {
|
|
|
91420
91444
|
}
|
|
91421
91445
|
}
|
|
91422
91446
|
|
|
91447
|
+
//Use highest available resolution time source
|
|
91448
|
+
const source = typeof performance === "undefined" ? Date : performance;
|
|
91449
|
+
|
|
91450
|
+
/**
|
|
91451
|
+
* Current time in seconds
|
|
91452
|
+
* @returns {number}
|
|
91453
|
+
*/
|
|
91454
|
+
function current_time_in_seconds() {
|
|
91455
|
+
// time source produces value in milliseconds, we need to scale to seconds
|
|
91456
|
+
return source.now() * 1e-3;
|
|
91457
|
+
}
|
|
91458
|
+
|
|
91423
91459
|
/**
|
|
91424
91460
|
* Event names for DOM {@link EventTarget} related to mouse.
|
|
91425
91461
|
* useful for .addEventListener and .removeEventListener
|
|
@@ -91440,57 +91476,28 @@ const MouseEvents = {
|
|
|
91440
91476
|
};
|
|
91441
91477
|
|
|
91442
91478
|
/**
|
|
91443
|
-
*
|
|
91444
|
-
* useful for .addEventListener and .removeEventListener
|
|
91445
|
-
* @readonly
|
|
91479
|
+
*
|
|
91446
91480
|
* @enum {string}
|
|
91447
91481
|
*/
|
|
91448
|
-
const
|
|
91449
|
-
|
|
91450
|
-
|
|
91451
|
-
Move: "
|
|
91452
|
-
|
|
91482
|
+
const PointerEvents = {
|
|
91483
|
+
Up: "pointerup",
|
|
91484
|
+
Down: "pointerdown",
|
|
91485
|
+
Move: "pointermove",
|
|
91486
|
+
Over: "pointerover",
|
|
91487
|
+
Out: "pointerout",
|
|
91488
|
+
Enter: "pointerenter",
|
|
91489
|
+
Leave: "pointerleave",
|
|
91490
|
+
Cancel: "pointercancel",
|
|
91491
|
+
GotCapture: "gotpointercapture",
|
|
91492
|
+
LostCapture: "lostpointercapture"
|
|
91453
91493
|
};
|
|
91454
91494
|
|
|
91455
|
-
/**
|
|
91456
|
-
*
|
|
91457
|
-
* @param {TouchEvent|MouseEvent} event
|
|
91458
|
-
* @returns {number}
|
|
91459
|
-
*/
|
|
91460
|
-
function eventToSourceIdentifier(event) {
|
|
91461
|
-
let device_id = 0;
|
|
91462
|
-
let source_id = 0;
|
|
91463
|
-
|
|
91464
|
-
if (event instanceof MouseEvent) {
|
|
91465
|
-
|
|
91466
|
-
// mouse
|
|
91467
|
-
|
|
91468
|
-
device_id = 1;
|
|
91469
|
-
source_id = event.button;
|
|
91470
|
-
|
|
91471
|
-
} else if (event instanceof TouchEvent) {
|
|
91472
|
-
|
|
91473
|
-
// touch
|
|
91474
|
-
|
|
91475
|
-
device_id = 2;
|
|
91476
|
-
const touches = event.changedTouches;
|
|
91477
|
-
const num_changes = touches.length;
|
|
91478
|
-
|
|
91479
|
-
if (num_changes > 0) {
|
|
91480
|
-
const touch = touches.item(0);
|
|
91481
|
-
|
|
91482
|
-
source_id = touch.identifier;
|
|
91483
|
-
}
|
|
91484
|
-
|
|
91485
|
-
}
|
|
91486
|
-
|
|
91487
|
-
return ((device_id & 0b11) << 29)
|
|
91488
|
-
| (source_id & 0b11111111111111111111111111111)
|
|
91489
|
-
;
|
|
91490
|
-
}
|
|
91491
|
-
|
|
91492
91495
|
class LocationalInteractionMetadata {
|
|
91493
|
-
|
|
91496
|
+
/**
|
|
91497
|
+
* In seconds
|
|
91498
|
+
* @type {number}
|
|
91499
|
+
*/
|
|
91500
|
+
timestamp = current_time_in_seconds()
|
|
91494
91501
|
position = new Vector2()
|
|
91495
91502
|
|
|
91496
91503
|
/**
|
|
@@ -91506,99 +91513,35 @@ class LocationalInteractionMetadata {
|
|
|
91506
91513
|
}
|
|
91507
91514
|
}
|
|
91508
91515
|
|
|
91509
|
-
/**
|
|
91510
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/buttons
|
|
91511
|
-
* @see https://w3c.github.io/uievents/#widl-MouseEvent-buttons
|
|
91512
|
-
*
|
|
91513
|
-
* @param {Number} value
|
|
91514
|
-
* @return {boolean[]} array of booleans, boolean is true if mouse button is pressed, false otherwise
|
|
91515
|
-
*/
|
|
91516
|
-
function decodeMouseEventButtons(value) {
|
|
91517
|
-
const result = [];
|
|
91518
|
-
|
|
91519
|
-
for (let i = 0; i < 32; i++) {
|
|
91520
|
-
|
|
91521
|
-
const shiftedValue = value >> i;
|
|
91522
|
-
|
|
91523
|
-
result[i] = (shiftedValue & 1) !== 0;
|
|
91524
|
-
}
|
|
91525
|
-
|
|
91526
|
-
return result;
|
|
91527
|
-
}
|
|
91528
|
-
|
|
91529
91516
|
/**
|
|
91530
91517
|
* Prevent default context menu from showing up
|
|
91531
91518
|
* @param {Event} event
|
|
91519
|
+
* @returns {boolean}
|
|
91532
91520
|
*/
|
|
91533
|
-
function
|
|
91521
|
+
function suppressContextMenu(event) {
|
|
91534
91522
|
event.preventDefault();
|
|
91535
91523
|
event.stopPropagation();
|
|
91536
91524
|
|
|
91537
91525
|
return false;
|
|
91538
|
-
}
|
|
91539
|
-
|
|
91540
|
-
/**
|
|
91541
|
-
*
|
|
91542
|
-
* @param {TouchList} touchList
|
|
91543
|
-
* @param {function(Touch,number)} callback
|
|
91544
|
-
*/
|
|
91545
|
-
function forEachTouch(touchList, callback) {
|
|
91546
|
-
const length = touchList.length;
|
|
91547
|
-
for (let i = 0; i < length; i++) {
|
|
91548
|
-
const touch = touchList.item(i);
|
|
91549
|
-
callback(touch, i);
|
|
91550
|
-
}
|
|
91551
|
-
}
|
|
91552
|
-
|
|
91553
|
-
/**
|
|
91554
|
-
*
|
|
91555
|
-
* @param {TouchList} touchList
|
|
91556
|
-
* @param {Vector2} result
|
|
91557
|
-
*/
|
|
91558
|
-
function getTouchCenter(touchList, result) {
|
|
91559
|
-
const length = touchList.length;
|
|
91560
|
-
|
|
91561
|
-
let x = 0, y = 0;
|
|
91562
|
-
|
|
91563
|
-
if (length > 0) {
|
|
91564
|
-
|
|
91565
|
-
for (let i = 0; i < length; i++) {
|
|
91566
|
-
const touch = touchList.item(i);
|
|
91567
|
-
|
|
91568
|
-
if (touch === null) {
|
|
91569
|
-
continue;
|
|
91570
|
-
}
|
|
91571
|
-
|
|
91572
|
-
x += touch.clientX;
|
|
91573
|
-
y += touch.clientY;
|
|
91574
|
-
}
|
|
91575
|
-
|
|
91576
|
-
// average to get center
|
|
91577
|
-
x /= length;
|
|
91578
|
-
y /= length;
|
|
91579
|
-
|
|
91580
|
-
}
|
|
91581
|
-
|
|
91582
|
-
result.set(x, y);
|
|
91583
|
-
|
|
91584
|
-
}
|
|
91585
|
-
|
|
91586
|
-
|
|
91526
|
+
}
|
|
91527
|
+
|
|
91587
91528
|
/**
|
|
91588
91529
|
*
|
|
91589
91530
|
* @param {Signal} up
|
|
91590
91531
|
* @param {Signal} down
|
|
91591
91532
|
* @param {Signal} move
|
|
91592
|
-
* @param {number} maxDistance
|
|
91533
|
+
* @param {number} [maxDistance] in pixels
|
|
91534
|
+
* @param {number} [maxDelay] Maximum delay between down and up events in seconds
|
|
91593
91535
|
* @param {Signal} signal
|
|
91594
91536
|
*/
|
|
91595
|
-
function observeTap(
|
|
91596
|
-
|
|
91597
|
-
|
|
91598
|
-
|
|
91599
|
-
|
|
91600
|
-
|
|
91601
|
-
|
|
91537
|
+
function observeTap({
|
|
91538
|
+
up,
|
|
91539
|
+
down,
|
|
91540
|
+
move = new Signal(),
|
|
91541
|
+
maxDistance = 10,
|
|
91542
|
+
maxDelay = 1,
|
|
91543
|
+
signal
|
|
91544
|
+
}) {
|
|
91602
91545
|
|
|
91603
91546
|
/**
|
|
91604
91547
|
*
|
|
@@ -91612,7 +91555,8 @@ function observeTap(
|
|
|
91612
91555
|
*/
|
|
91613
91556
|
function reset(id) {
|
|
91614
91557
|
|
|
91615
|
-
|
|
91558
|
+
const deleted = active.delete(id);
|
|
91559
|
+
if (deleted) {
|
|
91616
91560
|
up.remove(handleUp);
|
|
91617
91561
|
move.remove(handleMove);
|
|
91618
91562
|
}
|
|
@@ -91621,10 +91565,10 @@ function observeTap(
|
|
|
91621
91565
|
/**
|
|
91622
91566
|
*
|
|
91623
91567
|
* @param {Vector2} position
|
|
91624
|
-
* @param {
|
|
91568
|
+
* @param {PointerEvent} event
|
|
91625
91569
|
*/
|
|
91626
91570
|
function handleUp(position, event) {
|
|
91627
|
-
const id =
|
|
91571
|
+
const id = event.pointerId;
|
|
91628
91572
|
|
|
91629
91573
|
const meta = active.get(id);
|
|
91630
91574
|
|
|
@@ -91635,16 +91579,25 @@ function observeTap(
|
|
|
91635
91579
|
|
|
91636
91580
|
reset(id);
|
|
91637
91581
|
|
|
91582
|
+
const time_now = current_time_in_seconds();
|
|
91583
|
+
|
|
91584
|
+
const delay = time_now - meta.timestamp;
|
|
91585
|
+
|
|
91586
|
+
if (delay > maxDelay) {
|
|
91587
|
+
// too much time has passed, swallow event
|
|
91588
|
+
return;
|
|
91589
|
+
}
|
|
91590
|
+
|
|
91638
91591
|
signal.send2(position, event);
|
|
91639
91592
|
}
|
|
91640
91593
|
|
|
91641
91594
|
/**
|
|
91642
91595
|
*
|
|
91643
91596
|
* @param {Vector2} position
|
|
91644
|
-
* @param {
|
|
91597
|
+
* @param {PointerEvent} event
|
|
91645
91598
|
*/
|
|
91646
91599
|
function handleMove(position, event) {
|
|
91647
|
-
const id =
|
|
91600
|
+
const id = event.pointerId;
|
|
91648
91601
|
|
|
91649
91602
|
const meta = active.get(id);
|
|
91650
91603
|
|
|
@@ -91666,10 +91619,10 @@ function observeTap(
|
|
|
91666
91619
|
/**
|
|
91667
91620
|
*
|
|
91668
91621
|
* @param {Vector2} position
|
|
91669
|
-
* @param {
|
|
91622
|
+
* @param {PointerEvent} event
|
|
91670
91623
|
*/
|
|
91671
91624
|
function handleDown(position, event) {
|
|
91672
|
-
const id =
|
|
91625
|
+
const id = event.pointerId;
|
|
91673
91626
|
|
|
91674
91627
|
// make sure to cancel previous pending resolution
|
|
91675
91628
|
reset(id);
|
|
@@ -91685,119 +91638,6 @@ function observeTap(
|
|
|
91685
91638
|
down.add(handleDown);
|
|
91686
91639
|
}
|
|
91687
91640
|
|
|
91688
|
-
/**
|
|
91689
|
-
*
|
|
91690
|
-
* @param {Signal} touchStart
|
|
91691
|
-
* @param {Signal} touchEnd
|
|
91692
|
-
* @param {Signal} touchMove
|
|
91693
|
-
* @param {Signal} pinch
|
|
91694
|
-
* @param {Signal} pinchStart
|
|
91695
|
-
* @param {Signal} pinchEnd
|
|
91696
|
-
* @param {PointerDevice} device
|
|
91697
|
-
*/
|
|
91698
|
-
function observePinch({
|
|
91699
|
-
touchStart,
|
|
91700
|
-
touchEnd,
|
|
91701
|
-
touchMove,
|
|
91702
|
-
pinch,
|
|
91703
|
-
pinchStart,
|
|
91704
|
-
pinchEnd,
|
|
91705
|
-
device
|
|
91706
|
-
}) {
|
|
91707
|
-
const center = new Vector2();
|
|
91708
|
-
|
|
91709
|
-
const v2 = new Vector2();
|
|
91710
|
-
|
|
91711
|
-
const pinchBox0 = new Vector2();
|
|
91712
|
-
const pinchBox1 = new Vector2();
|
|
91713
|
-
|
|
91714
|
-
let pinchActive = false;
|
|
91715
|
-
let touchCount = 0;
|
|
91716
|
-
|
|
91717
|
-
|
|
91718
|
-
/**
|
|
91719
|
-
*
|
|
91720
|
-
* @param {TouchList} touchList
|
|
91721
|
-
* @param {Vector2} pinchDimensions
|
|
91722
|
-
*/
|
|
91723
|
-
function computeTouchRadius(touchList, pinchDimensions) {
|
|
91724
|
-
getTouchCenter(touchList, center);
|
|
91725
|
-
|
|
91726
|
-
const length = touchList.length;
|
|
91727
|
-
|
|
91728
|
-
pinchDimensions.set(0, 0);
|
|
91729
|
-
|
|
91730
|
-
for (let i = 0; i < length; i++) {
|
|
91731
|
-
const touch = touchList.item(i);
|
|
91732
|
-
|
|
91733
|
-
device.readPointerPositionFromEvent(v2, touch);
|
|
91734
|
-
|
|
91735
|
-
v2.sub(center);
|
|
91736
|
-
v2.abs();
|
|
91737
|
-
|
|
91738
|
-
pinchDimensions.add(v2);
|
|
91739
|
-
}
|
|
91740
|
-
|
|
91741
|
-
return pinchDimensions.multiplyScalar(1 / length);
|
|
91742
|
-
}
|
|
91743
|
-
|
|
91744
|
-
function touchRemoved(touch, event) {
|
|
91745
|
-
touchCount--;
|
|
91746
|
-
if (touchCount < 2 && pinchActive) {
|
|
91747
|
-
handlePinchEnd();
|
|
91748
|
-
}
|
|
91749
|
-
}
|
|
91750
|
-
|
|
91751
|
-
function touchAdded(touch, event) {
|
|
91752
|
-
touchCount++;
|
|
91753
|
-
if (touchCount > 1 && !pinchActive) {
|
|
91754
|
-
handlePinchStart(event);
|
|
91755
|
-
}
|
|
91756
|
-
}
|
|
91757
|
-
|
|
91758
|
-
function handlePinchStart(event) {
|
|
91759
|
-
pinchActive = true;
|
|
91760
|
-
|
|
91761
|
-
computeTouchRadius(event.touches, pinchBox0);
|
|
91762
|
-
|
|
91763
|
-
touchMove.add(handleMove);
|
|
91764
|
-
|
|
91765
|
-
pinchStart.send1(pinchBox0);
|
|
91766
|
-
}
|
|
91767
|
-
|
|
91768
|
-
/**
|
|
91769
|
-
*
|
|
91770
|
-
* @param {TouchEvent} event
|
|
91771
|
-
*/
|
|
91772
|
-
function handlePinchEnd(event) {
|
|
91773
|
-
pinchActive = false;
|
|
91774
|
-
|
|
91775
|
-
touchMove.remove(handleMove);
|
|
91776
|
-
|
|
91777
|
-
pinchEnd.send0();
|
|
91778
|
-
}
|
|
91779
|
-
|
|
91780
|
-
function handleDown(position, event) {
|
|
91781
|
-
forEachTouch(event.changedTouches, function (touch) {
|
|
91782
|
-
touchAdded(touch, event);
|
|
91783
|
-
});
|
|
91784
|
-
}
|
|
91785
|
-
|
|
91786
|
-
function handleUp(position, event) {
|
|
91787
|
-
forEachTouch(event.changedTouches, function (touch) {
|
|
91788
|
-
touchRemoved();
|
|
91789
|
-
});
|
|
91790
|
-
}
|
|
91791
|
-
|
|
91792
|
-
function handleMove(position, event) {
|
|
91793
|
-
computeTouchRadius(event.touches, pinchBox1);
|
|
91794
|
-
pinch.send2(pinchBox1, pinchBox0);
|
|
91795
|
-
}
|
|
91796
|
-
|
|
91797
|
-
touchEnd.add(handleUp);
|
|
91798
|
-
touchStart.add(handleDown);
|
|
91799
|
-
}
|
|
91800
|
-
|
|
91801
91641
|
/**
|
|
91802
91642
|
*
|
|
91803
91643
|
* @param {Signal} up
|
|
@@ -91889,18 +91729,8 @@ class PointerDevice {
|
|
|
91889
91729
|
*/
|
|
91890
91730
|
position = new Vector2();
|
|
91891
91731
|
|
|
91892
|
-
/**
|
|
91893
|
-
* @readonly
|
|
91894
|
-
* @type {Vector2}
|
|
91895
|
-
*/
|
|
91896
|
-
#anchor_touch_last = new Vector2();
|
|
91897
|
-
|
|
91898
91732
|
#globalUp = new Signal();
|
|
91899
91733
|
|
|
91900
|
-
#touchStart = new Signal();
|
|
91901
|
-
#touchEnd = new Signal();
|
|
91902
|
-
#touchMove = new Signal();
|
|
91903
|
-
|
|
91904
91734
|
/**
|
|
91905
91735
|
* @readonly
|
|
91906
91736
|
*/
|
|
@@ -91990,41 +91820,18 @@ class PointerDevice {
|
|
|
91990
91820
|
this.#domElement = domElement;
|
|
91991
91821
|
|
|
91992
91822
|
|
|
91993
|
-
this.#touchStart.add(this.on.down.send3, this.on.down);
|
|
91994
|
-
|
|
91995
|
-
this.#touchEnd.add(this.on.up.send3, this.on.up);
|
|
91996
|
-
|
|
91997
|
-
this.#touchMove.add(this.on.move.send3, this.on.move);
|
|
91998
|
-
|
|
91999
91823
|
//constructed events
|
|
92000
|
-
observeTap(this.on.up, this.on.down, this.on.move, 10, this.on.tap);
|
|
91824
|
+
observeTap({ up: this.on.up, down: this.on.down, move: this.on.move, maxDistance: 10, signal: this.on.tap });
|
|
92001
91825
|
observeDrag(this.#globalUp, this.on.down, this.on.move, this.on.dragStart, this.on.dragEnd, this.on.drag);
|
|
92002
|
-
observePinch({
|
|
92003
|
-
touchStart: this.#touchStart,
|
|
92004
|
-
touchEnd: this.#touchEnd,
|
|
92005
|
-
touchMove: this.#touchMove,
|
|
92006
|
-
pinch: this.on.pinch,
|
|
92007
|
-
pinchStart: this.on.pinchStart,
|
|
92008
|
-
pinchEnd: this.on.pinchEnd,
|
|
92009
|
-
device: this
|
|
92010
|
-
});
|
|
92011
|
-
}
|
|
92012
|
-
|
|
92013
91826
|
|
|
92014
|
-
/**
|
|
92015
|
-
*
|
|
92016
|
-
* @param {TouchEvent} event
|
|
92017
|
-
*/
|
|
92018
|
-
#eventHandlerGlobalTouchEnd = (event) => {
|
|
92019
|
-
getTouchCenter(event.touches, this.position);
|
|
92020
|
-
this.#globalUp.send2(this.position, event);
|
|
92021
91827
|
}
|
|
92022
91828
|
|
|
91829
|
+
|
|
92023
91830
|
/**
|
|
92024
91831
|
*
|
|
92025
|
-
* @param {
|
|
91832
|
+
* @param {PointerEvent} event
|
|
92026
91833
|
*/
|
|
92027
|
-
#
|
|
91834
|
+
#eventHandlerPointerDown = (event) => {
|
|
92028
91835
|
this.readPointerPositionFromEvent(this.position, event);
|
|
92029
91836
|
this.on.down.send2(this.position, event);
|
|
92030
91837
|
|
|
@@ -92038,9 +91845,9 @@ class PointerDevice {
|
|
|
92038
91845
|
|
|
92039
91846
|
/**
|
|
92040
91847
|
*
|
|
92041
|
-
* @param {
|
|
91848
|
+
* @param {PointerEvent} event
|
|
92042
91849
|
*/
|
|
92043
|
-
#
|
|
91850
|
+
#eventHandlerPointerUp = (event) => {
|
|
92044
91851
|
this.readPointerPositionFromEvent(this.position, event);
|
|
92045
91852
|
this.on.up.send2(this.position, event);
|
|
92046
91853
|
}
|
|
@@ -92049,7 +91856,7 @@ class PointerDevice {
|
|
|
92049
91856
|
*
|
|
92050
91857
|
* @param {MouseEvent} event
|
|
92051
91858
|
*/
|
|
92052
|
-
#
|
|
91859
|
+
#eventHandlerGlobalPointerUp = (event) => {
|
|
92053
91860
|
this.readPointerPositionFromEvent(this.position, event);
|
|
92054
91861
|
this.#globalUp.send2(this.position, event);
|
|
92055
91862
|
|
|
@@ -92061,32 +91868,6 @@ class PointerDevice {
|
|
|
92061
91868
|
button?.release();
|
|
92062
91869
|
}
|
|
92063
91870
|
|
|
92064
|
-
/**
|
|
92065
|
-
*
|
|
92066
|
-
* @param {TouchEvent} event
|
|
92067
|
-
*/
|
|
92068
|
-
#eventHandlerTouchEnd = (event) => {
|
|
92069
|
-
getTouchCenter(event.touches, this.position);
|
|
92070
|
-
this.#touchEnd.send2(this.position, event);
|
|
92071
|
-
}
|
|
92072
|
-
|
|
92073
|
-
/**
|
|
92074
|
-
*
|
|
92075
|
-
* @param {TouchEvent} event
|
|
92076
|
-
*/
|
|
92077
|
-
#eventHandlerTouchMove = (event) => {
|
|
92078
|
-
event.preventDefault();
|
|
92079
|
-
|
|
92080
|
-
getTouchCenter(event.touches, this.position);
|
|
92081
|
-
|
|
92082
|
-
const delta = new Vector2();
|
|
92083
|
-
|
|
92084
|
-
delta.subVectors(this.position, this.#anchor_touch_last);
|
|
92085
|
-
|
|
92086
|
-
this.#touchMove.send3(this.position, event, delta);
|
|
92087
|
-
|
|
92088
|
-
this.#anchor_touch_last.copy(this.position);
|
|
92089
|
-
}
|
|
92090
91871
|
|
|
92091
91872
|
/**
|
|
92092
91873
|
*
|
|
@@ -92110,20 +91891,9 @@ class PointerDevice {
|
|
|
92110
91891
|
|
|
92111
91892
|
/**
|
|
92112
91893
|
*
|
|
92113
|
-
* @param {
|
|
91894
|
+
* @param {PointerEvent} event
|
|
92114
91895
|
*/
|
|
92115
|
-
#
|
|
92116
|
-
getTouchCenter(event.touches, this.position);
|
|
92117
|
-
this.#touchStart.send2(this.position, event);
|
|
92118
|
-
|
|
92119
|
-
this.#anchor_touch_last.copy(this.position);
|
|
92120
|
-
}
|
|
92121
|
-
|
|
92122
|
-
/**
|
|
92123
|
-
*
|
|
92124
|
-
* @param {MouseEvent} event
|
|
92125
|
-
*/
|
|
92126
|
-
#eventHandlerMouseMove = (event) => {
|
|
91896
|
+
#eventHandlerPointerMove = (event) => {
|
|
92127
91897
|
event.preventDefault();
|
|
92128
91898
|
|
|
92129
91899
|
this.#target = event.target;
|
|
@@ -92192,16 +91962,11 @@ class PointerDevice {
|
|
|
92192
91962
|
|
|
92193
91963
|
const domElement = this.#domElement;
|
|
92194
91964
|
|
|
92195
|
-
domElement.addEventListener(
|
|
92196
|
-
domElement.addEventListener(
|
|
92197
|
-
domElement.addEventListener(
|
|
92198
|
-
|
|
92199
|
-
domElement.addEventListener(TouchEvents.Start, this.#eventHandlerTouchStart);
|
|
92200
|
-
domElement.addEventListener(TouchEvents.End, this.#eventHandlerTouchEnd);
|
|
92201
|
-
domElement.addEventListener(TouchEvents.Move, this.#eventHandlerTouchMove);
|
|
91965
|
+
domElement.addEventListener(PointerEvents.Move, this.#eventHandlerPointerMove);
|
|
91966
|
+
domElement.addEventListener(PointerEvents.Up, this.#eventHandlerPointerUp);
|
|
91967
|
+
domElement.addEventListener(PointerEvents.Down, this.#eventHandlerPointerDown);
|
|
92202
91968
|
|
|
92203
|
-
window.addEventListener(
|
|
92204
|
-
window.addEventListener(TouchEvents.End, this.#eventHandlerGlobalTouchEnd);
|
|
91969
|
+
window.addEventListener(PointerEvents.Up, this.#eventHandlerGlobalPointerUp);
|
|
92205
91970
|
|
|
92206
91971
|
/*
|
|
92207
91972
|
In some cases wheel event gets registered as "passive" by default. This interferes with "preventDefault()"
|
|
@@ -92210,7 +91975,7 @@ class PointerDevice {
|
|
|
92210
91975
|
domElement.addEventListener(MouseEvents.Wheel, this.#eventHandlerWheel, { passive: false });
|
|
92211
91976
|
|
|
92212
91977
|
|
|
92213
|
-
domElement.addEventListener("contextmenu",
|
|
91978
|
+
domElement.addEventListener("contextmenu", suppressContextMenu);
|
|
92214
91979
|
}
|
|
92215
91980
|
|
|
92216
91981
|
stop() {
|
|
@@ -92225,21 +91990,16 @@ class PointerDevice {
|
|
|
92225
91990
|
|
|
92226
91991
|
const domElement = this.domElement;
|
|
92227
91992
|
|
|
92228
|
-
domElement.removeEventListener(
|
|
92229
|
-
domElement.removeEventListener(
|
|
92230
|
-
domElement.removeEventListener(
|
|
92231
|
-
|
|
92232
|
-
domElement.removeEventListener(TouchEvents.Start, this.#eventHandlerTouchStart);
|
|
92233
|
-
domElement.removeEventListener(TouchEvents.End, this.#eventHandlerTouchEnd);
|
|
92234
|
-
domElement.removeEventListener(TouchEvents.Move, this.#eventHandlerTouchMove);
|
|
91993
|
+
domElement.removeEventListener(PointerEvents.Move, this.#eventHandlerPointerMove);
|
|
91994
|
+
domElement.removeEventListener(PointerEvents.Up, this.#eventHandlerPointerUp);
|
|
91995
|
+
domElement.removeEventListener(PointerEvents.Down, this.#eventHandlerPointerDown);
|
|
92235
91996
|
|
|
92236
|
-
window.removeEventListener(
|
|
92237
|
-
window.removeEventListener(TouchEvents.End, this.#eventHandlerGlobalTouchEnd);
|
|
91997
|
+
window.removeEventListener(PointerEvents.Up, this.#eventHandlerGlobalPointerUp);
|
|
92238
91998
|
|
|
92239
91999
|
domElement.removeEventListener(MouseEvents.Wheel, this.#eventHandlerWheel);
|
|
92240
92000
|
|
|
92241
92001
|
|
|
92242
|
-
domElement.removeEventListener("contextmenu",
|
|
92002
|
+
domElement.removeEventListener("contextmenu", suppressContextMenu);
|
|
92243
92003
|
}
|
|
92244
92004
|
}
|
|
92245
92005
|
|
|
@@ -96698,18 +96458,6 @@ Stat.Process = {
|
|
|
96698
96458
|
*/
|
|
96699
96459
|
Stat.prototype.isStat = true;
|
|
96700
96460
|
|
|
96701
|
-
//Use highest available resolution time source
|
|
96702
|
-
const source = typeof performance === "undefined" ? Date : performance;
|
|
96703
|
-
|
|
96704
|
-
/**
|
|
96705
|
-
* Current time in seconds
|
|
96706
|
-
* @returns {number}
|
|
96707
|
-
*/
|
|
96708
|
-
function current_time_in_seconds() {
|
|
96709
|
-
// time source produces value in milliseconds, we need to scale to seconds
|
|
96710
|
-
return source.now() * 1e-3;
|
|
96711
|
-
}
|
|
96712
|
-
|
|
96713
96461
|
/**
|
|
96714
96462
|
*
|
|
96715
96463
|
* @param {Clock} clock
|
|
@@ -105373,6 +105121,95 @@ class EngineConfiguration {
|
|
|
105373
105121
|
}
|
|
105374
105122
|
}
|
|
105375
105123
|
|
|
105124
|
+
/**
|
|
105125
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/buttons
|
|
105126
|
+
* @see https://w3c.github.io/uievents/#widl-MouseEvent-buttons
|
|
105127
|
+
*
|
|
105128
|
+
* @param {Number} value
|
|
105129
|
+
* @param {boolean[]} [result]
|
|
105130
|
+
* @return {boolean[]} array of booleans, boolean is true if mouse button is pressed, false otherwise
|
|
105131
|
+
*/
|
|
105132
|
+
function decodeMouseEventButtons(value, result = []) {
|
|
105133
|
+
|
|
105134
|
+
for (let i = 0; i < 32; i++) {
|
|
105135
|
+
|
|
105136
|
+
const shiftedValue = value >> i;
|
|
105137
|
+
|
|
105138
|
+
result[i] = (shiftedValue & 1) !== 0;
|
|
105139
|
+
}
|
|
105140
|
+
|
|
105141
|
+
return result;
|
|
105142
|
+
}
|
|
105143
|
+
|
|
105144
|
+
class InputBinding {
|
|
105145
|
+
/**
|
|
105146
|
+
*
|
|
105147
|
+
* @param {string} path
|
|
105148
|
+
* @param {function} listener
|
|
105149
|
+
* @param {boolean} [exclusive=false]
|
|
105150
|
+
*/
|
|
105151
|
+
constructor({ path, listener, exclusive = false }) {
|
|
105152
|
+
|
|
105153
|
+
/**
|
|
105154
|
+
*
|
|
105155
|
+
* @type {string}
|
|
105156
|
+
*/
|
|
105157
|
+
this.path = path;
|
|
105158
|
+
/**
|
|
105159
|
+
*
|
|
105160
|
+
* @type {Function}
|
|
105161
|
+
*/
|
|
105162
|
+
this.listener = listener;
|
|
105163
|
+
/**
|
|
105164
|
+
* @deprecated don't use
|
|
105165
|
+
* @type {boolean}
|
|
105166
|
+
*/
|
|
105167
|
+
this.exclusive = exclusive;
|
|
105168
|
+
}
|
|
105169
|
+
}
|
|
105170
|
+
|
|
105171
|
+
class InputController {
|
|
105172
|
+
/**
|
|
105173
|
+
*
|
|
105174
|
+
* @param {Array} bindings
|
|
105175
|
+
* @constructor
|
|
105176
|
+
*/
|
|
105177
|
+
constructor(bindings = []) {
|
|
105178
|
+
|
|
105179
|
+
this.mapping = new List();
|
|
105180
|
+
|
|
105181
|
+
const inputControllerBindings = bindings.map(b => new InputBinding(b));
|
|
105182
|
+
|
|
105183
|
+
this.mapping.addAll(inputControllerBindings);
|
|
105184
|
+
|
|
105185
|
+
this.on = {
|
|
105186
|
+
unlinked: new Signal()
|
|
105187
|
+
};
|
|
105188
|
+
}
|
|
105189
|
+
|
|
105190
|
+
/**
|
|
105191
|
+
*
|
|
105192
|
+
* @param {Array} bindings
|
|
105193
|
+
*/
|
|
105194
|
+
static from(bindings) {
|
|
105195
|
+
const ic = new InputController();
|
|
105196
|
+
|
|
105197
|
+
const n = bindings.length;
|
|
105198
|
+
for (let i = 0; i < n; i++) {
|
|
105199
|
+
const binding = bindings[i];
|
|
105200
|
+
|
|
105201
|
+
const inputBinding = new InputBinding(binding);
|
|
105202
|
+
|
|
105203
|
+
ic.mapping.add(inputBinding);
|
|
105204
|
+
}
|
|
105205
|
+
|
|
105206
|
+
return ic;
|
|
105207
|
+
}
|
|
105208
|
+
}
|
|
105209
|
+
|
|
105210
|
+
InputController.typeName = "InputController";
|
|
105211
|
+
InputController.serializable = false;
|
|
105212
|
+
|
|
105376
105213
|
/**
|
|
105377
105214
|
*
|
|
105378
105215
|
* @param {number[]} mat4
|
|
@@ -105763,75 +105600,6 @@ TopDownCameraController.typeName = "TopDownCameraController";
|
|
|
105763
105600
|
TopDownCameraController.pan = pan;
|
|
105764
105601
|
TopDownCameraController.rotate = rotate_from_view;
|
|
105765
105602
|
|
|
105766
|
-
class InputBinding {
|
|
105767
|
-
/**
|
|
105768
|
-
*
|
|
105769
|
-
* @param {string} path
|
|
105770
|
-
* @param {function} listener
|
|
105771
|
-
* @param {boolean} [exclusive=false]
|
|
105772
|
-
*/
|
|
105773
|
-
constructor({ path, listener, exclusive = false }) {
|
|
105774
|
-
|
|
105775
|
-
/**
|
|
105776
|
-
*
|
|
105777
|
-
* @type {string}
|
|
105778
|
-
*/
|
|
105779
|
-
this.path = path;
|
|
105780
|
-
/**
|
|
105781
|
-
*
|
|
105782
|
-
* @type {Function}
|
|
105783
|
-
*/
|
|
105784
|
-
this.listener = listener;
|
|
105785
|
-
/**
|
|
105786
|
-
* @deprecated don't use
|
|
105787
|
-
* @type {boolean}
|
|
105788
|
-
*/
|
|
105789
|
-
this.exclusive = exclusive;
|
|
105790
|
-
}
|
|
105791
|
-
}
|
|
105792
|
-
|
|
105793
|
-
class InputController {
|
|
105794
|
-
/**
|
|
105795
|
-
*
|
|
105796
|
-
* @param {Array} bindings
|
|
105797
|
-
* @constructor
|
|
105798
|
-
*/
|
|
105799
|
-
constructor(bindings = []) {
|
|
105800
|
-
|
|
105801
|
-
this.mapping = new List();
|
|
105802
|
-
|
|
105803
|
-
const inputControllerBindings = bindings.map(b => new InputBinding(b));
|
|
105804
|
-
|
|
105805
|
-
this.mapping.addAll(inputControllerBindings);
|
|
105806
|
-
|
|
105807
|
-
this.on = {
|
|
105808
|
-
unlinked: new Signal()
|
|
105809
|
-
};
|
|
105810
|
-
}
|
|
105811
|
-
|
|
105812
|
-
/**
|
|
105813
|
-
*
|
|
105814
|
-
* @param {Array} bindings
|
|
105815
|
-
*/
|
|
105816
|
-
static from(bindings) {
|
|
105817
|
-
const ic = new InputController();
|
|
105818
|
-
|
|
105819
|
-
const n = bindings.length;
|
|
105820
|
-
for (let i = 0; i < n; i++) {
|
|
105821
|
-
const binding = bindings[i];
|
|
105822
|
-
|
|
105823
|
-
const inputBinding = new InputBinding(binding);
|
|
105824
|
-
|
|
105825
|
-
ic.mapping.add(inputBinding);
|
|
105826
|
-
}
|
|
105827
|
-
|
|
105828
|
-
return ic;
|
|
105829
|
-
}
|
|
105830
|
-
}
|
|
105831
|
-
|
|
105832
|
-
InputController.typeName = "InputController";
|
|
105833
|
-
InputController.serializable = false;
|
|
105834
|
-
|
|
105835
105603
|
/**
|
|
105836
105604
|
*
|
|
105837
105605
|
* @param {number} camera_entity
|
|
@@ -108162,7 +107930,7 @@ class MaxRectanglesPacker {
|
|
|
108162
107930
|
return -Math.min(box.getWidth(), box.getHeight());
|
|
108163
107931
|
}
|
|
108164
107932
|
|
|
108165
|
-
const heap = new
|
|
107933
|
+
const heap = new BinaryHeap(scoreBoxByMinSide);
|
|
108166
107934
|
|
|
108167
107935
|
for (let i = 0; i < numBoxes; i++) {
|
|
108168
107936
|
heap.push(i);
|