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