@woosh/meep-engine 2.109.24 → 2.109.26
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 +248 -117
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +248 -117
- package/package.json +1 -1
- package/src/core/collection/heap/{FastBinaryHeap.d.ts → BinaryHeap.d.ts} +16 -9
- package/src/core/collection/heap/BinaryHeap.d.ts.map +1 -0
- package/src/core/collection/heap/{FastBinaryHeap.js → BinaryHeap.js} +31 -21
- 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} +1 -1
- 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/collection/table/RowFirstTable.d.ts +10 -7
- package/src/core/collection/table/RowFirstTable.d.ts.map +1 -1
- package/src/core/collection/table/RowFirstTable.js +23 -6
- package/src/core/geom/3d/normal/octahedron/encode_unit_to_octahedron.js +2 -2
- 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 +1 -1
- 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/engine/animation/async/TimeSeries.d.ts.map +1 -1
- package/src/engine/animation/async/TimeSeries.js +6 -2
- package/src/engine/animation/async/table_find_min_index_in_ordered_column.d.ts +9 -0
- package/src/engine/animation/async/table_find_min_index_in_ordered_column.d.ts.map +1 -0
- package/src/engine/animation/async/{findSampleIndex.js → table_find_min_index_in_ordered_column.js} +5 -4
- package/src/engine/asset/AssetManager.js +2 -2
- package/src/engine/graphics/sh3/gi/material/common.glsl +46 -55
- 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 +1 -1
- 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 +19 -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/InputDeviceSwitch.d.ts.map +1 -1
- package/src/engine/input/devices/InputDeviceSwitch.js +18 -0
- package/src/engine/input/devices/KeyboardDevice.d.ts.map +1 -1
- package/src/engine/input/devices/KeyboardDevice.js +4 -41
- package/src/engine/input/devices/LocationalInteractionMetadata.d.ts +11 -0
- package/src/engine/input/devices/LocationalInteractionMetadata.d.ts.map +1 -0
- package/src/engine/input/devices/LocationalInteractionMetadata.js +18 -0
- package/src/engine/input/devices/PointerDevice.d.ts.map +1 -1
- package/src/engine/input/devices/PointerDevice.js +90 -37
- package/src/engine/input/devices/events/eventToSourceIdentifier.d.ts +7 -0
- package/src/engine/input/devices/events/eventToSourceIdentifier.d.ts.map +1 -0
- package/src/engine/input/devices/events/eventToSourceIdentifier.js +36 -0
- package/src/engine/input/devices/isHTMLElementFocusable.d.ts +6 -0
- package/src/engine/input/devices/isHTMLElementFocusable.d.ts.map +1 -0
- package/src/engine/input/devices/isHTMLElementFocusable.js +34 -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 +1 -1
- package/src/generation/grid/generation/discrete/layer/GridTaskBuildSourceDistanceMap.d.ts.map +1 -1
- package/src/generation/grid/generation/discrete/layer/GridTaskBuildSourceDistanceMap.js +4 -4
- package/src/generation/grid/generation/discrete/layer/GridTaskDistanceToMarkers.d.ts.map +1 -1
- package/src/generation/grid/generation/discrete/layer/GridTaskDistanceToMarkers.js +2 -2
- package/src/generation/grid/generation/road/GridTaskGenerateRoads.js +1 -1
- 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/animation/async/findSampleIndex.d.ts +0 -9
- package/src/engine/animation/async/findSampleIndex.d.ts.map +0 -1
- /package/src/core/collection/heap/{Uin32Heap.spec.js → Uint32Heap.spec.js} +0 -0
package/build/meep.module.js
CHANGED
|
@@ -71547,6 +71547,23 @@ class EntityObserver {
|
|
|
71547
71547
|
}
|
|
71548
71548
|
}
|
|
71549
71549
|
|
|
71550
|
+
/**
|
|
71551
|
+
* Given an object and a value, find the first property with matching value and returns name of that property
|
|
71552
|
+
* Useful for working with ENUM-like objects
|
|
71553
|
+
* @param {Object<T>} object
|
|
71554
|
+
* @param {T} value
|
|
71555
|
+
* @returns {string|undefined} name of the property, or undefined if property not found
|
|
71556
|
+
*/
|
|
71557
|
+
function objectKeyByValue(object, value) {
|
|
71558
|
+
for (let i in object) {
|
|
71559
|
+
if (object[i] === value) {
|
|
71560
|
+
return i;
|
|
71561
|
+
}
|
|
71562
|
+
}
|
|
71563
|
+
|
|
71564
|
+
return undefined;
|
|
71565
|
+
}
|
|
71566
|
+
|
|
71550
71567
|
/**
|
|
71551
71568
|
*
|
|
71552
71569
|
* @enum {number}
|
|
@@ -71663,6 +71680,10 @@ class Edge {
|
|
|
71663
71680
|
return [this.first, this.second];
|
|
71664
71681
|
}
|
|
71665
71682
|
|
|
71683
|
+
toString() {
|
|
71684
|
+
return `Edge:{ first=${this.first}, second=${this.second}, direction=${objectKeyByValue(EdgeDirectionType, this.direction)} }`
|
|
71685
|
+
}
|
|
71686
|
+
|
|
71666
71687
|
}
|
|
71667
71688
|
|
|
71668
71689
|
/**
|
|
@@ -78580,23 +78601,6 @@ class ShadedGeometrySystem extends System {
|
|
|
78580
78601
|
}
|
|
78581
78602
|
}
|
|
78582
78603
|
|
|
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
78604
|
/**
|
|
78601
78605
|
*
|
|
78602
78606
|
* @enum {string}
|
|
@@ -84588,10 +84592,23 @@ class ViewStack extends View {
|
|
|
84588
84592
|
}
|
|
84589
84593
|
|
|
84590
84594
|
/**
|
|
84591
|
-
* Min-Heap implementation with a score function.
|
|
84595
|
+
* Min-Heap implementation with a score function.
|
|
84596
|
+
* The data structure is a binary heap where elements are removed in order defined by scoring function
|
|
84592
84597
|
* @template T
|
|
84593
84598
|
*/
|
|
84594
84599
|
class BinaryHeap {
|
|
84600
|
+
/**
|
|
84601
|
+
* @private
|
|
84602
|
+
* @type {T[]}
|
|
84603
|
+
*/
|
|
84604
|
+
data = [];
|
|
84605
|
+
|
|
84606
|
+
/**
|
|
84607
|
+
* @private
|
|
84608
|
+
* @type {number}
|
|
84609
|
+
*/
|
|
84610
|
+
length = 0;
|
|
84611
|
+
|
|
84595
84612
|
/**
|
|
84596
84613
|
* @template T
|
|
84597
84614
|
* @param {function(el:T):number} scoreFunction
|
|
@@ -84605,17 +84622,6 @@ class BinaryHeap {
|
|
|
84605
84622
|
*/
|
|
84606
84623
|
this.scoreFunction = scoreFunction;
|
|
84607
84624
|
|
|
84608
|
-
/**
|
|
84609
|
-
*
|
|
84610
|
-
* @type {T[]}
|
|
84611
|
-
*/
|
|
84612
|
-
this.data = [];
|
|
84613
|
-
|
|
84614
|
-
/**
|
|
84615
|
-
* @private
|
|
84616
|
-
* @type {number}
|
|
84617
|
-
*/
|
|
84618
|
-
this.length = 0;
|
|
84619
84625
|
}
|
|
84620
84626
|
|
|
84621
84627
|
/**
|
|
@@ -84685,19 +84691,19 @@ class BinaryHeap {
|
|
|
84685
84691
|
if (right >= length) {
|
|
84686
84692
|
//right node doesn't exist
|
|
84687
84693
|
|
|
84688
|
-
|
|
84689
84694
|
if (scoreLeft >= scoreMin) {
|
|
84690
84695
|
break;
|
|
84691
84696
|
} else {
|
|
84692
84697
|
minIndex = left;
|
|
84693
84698
|
dataMin = dataLeft;
|
|
84694
84699
|
}
|
|
84700
|
+
|
|
84695
84701
|
} else {
|
|
84702
|
+
|
|
84696
84703
|
//both left and right nodes exist
|
|
84697
84704
|
const dataRight = data[right];
|
|
84698
84705
|
const scoreRight = this.scoreFunction(dataRight);
|
|
84699
84706
|
|
|
84700
|
-
//
|
|
84701
84707
|
if (scoreLeft <= scoreRight) {
|
|
84702
84708
|
if (scoreLeft >= scoreMin) {
|
|
84703
84709
|
break;
|
|
@@ -84713,6 +84719,7 @@ class BinaryHeap {
|
|
|
84713
84719
|
dataMin = dataRight;
|
|
84714
84720
|
}
|
|
84715
84721
|
}
|
|
84722
|
+
|
|
84716
84723
|
}
|
|
84717
84724
|
|
|
84718
84725
|
//swap positions
|
|
@@ -84730,7 +84737,6 @@ class BinaryHeap {
|
|
|
84730
84737
|
*/
|
|
84731
84738
|
pop() {
|
|
84732
84739
|
|
|
84733
|
-
|
|
84734
84740
|
this.length--;
|
|
84735
84741
|
|
|
84736
84742
|
const new_length = this.length;
|
|
@@ -84739,19 +84745,20 @@ class BinaryHeap {
|
|
|
84739
84745
|
|
|
84740
84746
|
if (new_length === 0) {
|
|
84741
84747
|
|
|
84748
|
+
// this was the last element in the heap
|
|
84749
|
+
|
|
84742
84750
|
return last;
|
|
84743
84751
|
|
|
84744
|
-
}
|
|
84752
|
+
}
|
|
84745
84753
|
|
|
84746
|
-
|
|
84754
|
+
const ret = this.data[0];
|
|
84747
84755
|
|
|
84748
|
-
|
|
84756
|
+
this.data[0] = last;
|
|
84749
84757
|
|
|
84750
|
-
|
|
84758
|
+
this.bubbleDown(0);
|
|
84751
84759
|
|
|
84752
|
-
|
|
84760
|
+
return ret;
|
|
84753
84761
|
|
|
84754
|
-
}
|
|
84755
84762
|
}
|
|
84756
84763
|
|
|
84757
84764
|
/**
|
|
@@ -84853,7 +84860,14 @@ class BinaryHeap {
|
|
|
84853
84860
|
|
|
84854
84861
|
this.bubbleUp(position);
|
|
84855
84862
|
}
|
|
84856
|
-
}
|
|
84863
|
+
}
|
|
84864
|
+
|
|
84865
|
+
/**
|
|
84866
|
+
* Useful for type checks
|
|
84867
|
+
* @readonly
|
|
84868
|
+
* @type {boolean}
|
|
84869
|
+
*/
|
|
84870
|
+
BinaryHeap.prototype.isBinaryHeap = true;
|
|
84857
84871
|
|
|
84858
84872
|
/**
|
|
84859
84873
|
* Decorator that wraps another map and lets you observe mutations
|
|
@@ -91137,6 +91151,59 @@ class InputDeviceSwitch {
|
|
|
91137
91151
|
* @type {boolean}
|
|
91138
91152
|
*/
|
|
91139
91153
|
is_down = false
|
|
91154
|
+
|
|
91155
|
+
press() {
|
|
91156
|
+
if (this.is_down) {
|
|
91157
|
+
return;
|
|
91158
|
+
}
|
|
91159
|
+
|
|
91160
|
+
this.is_down = true;
|
|
91161
|
+
this.down.send0();
|
|
91162
|
+
}
|
|
91163
|
+
|
|
91164
|
+
release() {
|
|
91165
|
+
if (!this.is_down) {
|
|
91166
|
+
return;
|
|
91167
|
+
}
|
|
91168
|
+
|
|
91169
|
+
this.is_down = false;
|
|
91170
|
+
this.up.send0();
|
|
91171
|
+
}
|
|
91172
|
+
}
|
|
91173
|
+
|
|
91174
|
+
/**
|
|
91175
|
+
*
|
|
91176
|
+
* @param thing
|
|
91177
|
+
* @param klass
|
|
91178
|
+
* @returns {boolean}
|
|
91179
|
+
*/
|
|
91180
|
+
function isInstanceOf$1(thing, klass) {
|
|
91181
|
+
if (klass === undefined) {
|
|
91182
|
+
return false;
|
|
91183
|
+
}
|
|
91184
|
+
if (klass === null) {
|
|
91185
|
+
return false;
|
|
91186
|
+
}
|
|
91187
|
+
|
|
91188
|
+
if (typeof klass !== "object") {
|
|
91189
|
+
return false;
|
|
91190
|
+
}
|
|
91191
|
+
|
|
91192
|
+
|
|
91193
|
+
return thing instanceof klass;
|
|
91194
|
+
}
|
|
91195
|
+
|
|
91196
|
+
/**
|
|
91197
|
+
* Based on the article about focusable events: https://stackoverflow.com/questions/1599660/which-html-elements-can-receive-focus
|
|
91198
|
+
* @param {Element} el
|
|
91199
|
+
*/
|
|
91200
|
+
function isHTMLElementFocusable(el) {
|
|
91201
|
+
return isInstanceOf$1(el, HTMLInputElement)
|
|
91202
|
+
|| isInstanceOf$1(el, HTMLSelectElement)
|
|
91203
|
+
|| isInstanceOf$1(el, HTMLTextAreaElement)
|
|
91204
|
+
|| isInstanceOf$1(el, HTMLAnchorElement)
|
|
91205
|
+
|| isInstanceOf$1(el, HTMLButtonElement)
|
|
91206
|
+
|| isInstanceOf$1(el, HTMLAreaElement)
|
|
91140
91207
|
}
|
|
91141
91208
|
|
|
91142
91209
|
/**
|
|
@@ -91246,41 +91313,6 @@ const KeyCodes = {
|
|
|
91246
91313
|
'back_quote': 223
|
|
91247
91314
|
};
|
|
91248
91315
|
|
|
91249
|
-
/**
|
|
91250
|
-
*
|
|
91251
|
-
* @param thing
|
|
91252
|
-
* @param klass
|
|
91253
|
-
* @returns {boolean}
|
|
91254
|
-
*/
|
|
91255
|
-
function isInstanceOf$1(thing, klass) {
|
|
91256
|
-
if (klass === undefined) {
|
|
91257
|
-
return false;
|
|
91258
|
-
}
|
|
91259
|
-
if (klass === null) {
|
|
91260
|
-
return false;
|
|
91261
|
-
}
|
|
91262
|
-
|
|
91263
|
-
if (typeof klass !== "object") {
|
|
91264
|
-
return false;
|
|
91265
|
-
}
|
|
91266
|
-
|
|
91267
|
-
|
|
91268
|
-
return thing instanceof klass;
|
|
91269
|
-
}
|
|
91270
|
-
|
|
91271
|
-
/**
|
|
91272
|
-
* Based on the article about focusable events: https://stackoverflow.com/questions/1599660/which-html-elements-can-receive-focus
|
|
91273
|
-
* @param {Element} el
|
|
91274
|
-
*/
|
|
91275
|
-
function isFocusable(el) {
|
|
91276
|
-
return isInstanceOf$1(el, HTMLInputElement)
|
|
91277
|
-
|| isInstanceOf$1(el, HTMLSelectElement)
|
|
91278
|
-
|| isInstanceOf$1(el, HTMLTextAreaElement)
|
|
91279
|
-
|| isInstanceOf$1(el, HTMLAnchorElement)
|
|
91280
|
-
|| isInstanceOf$1(el, HTMLButtonElement)
|
|
91281
|
-
|| isInstanceOf$1(el, HTMLAreaElement)
|
|
91282
|
-
}
|
|
91283
|
-
|
|
91284
91316
|
/**
|
|
91285
91317
|
* @readonly
|
|
91286
91318
|
* @type {string[]}
|
|
@@ -91313,7 +91345,7 @@ class KeyboardDevice {
|
|
|
91313
91345
|
Only element in focus receives keyboard events, so the element supplied here must be focusable in order to be able to receive events
|
|
91314
91346
|
*/
|
|
91315
91347
|
if (
|
|
91316
|
-
!
|
|
91348
|
+
!isHTMLElementFocusable(domElement)
|
|
91317
91349
|
&& domElement.getAttribute('tabindex') === null
|
|
91318
91350
|
) ;
|
|
91319
91351
|
|
|
@@ -91357,9 +91389,7 @@ class KeyboardDevice {
|
|
|
91357
91389
|
if (keyName !== undefined) {
|
|
91358
91390
|
const button = this.keys[keyName];
|
|
91359
91391
|
|
|
91360
|
-
button.
|
|
91361
|
-
button.down.send1(event);
|
|
91362
|
-
|
|
91392
|
+
button.press();
|
|
91363
91393
|
}
|
|
91364
91394
|
}
|
|
91365
91395
|
|
|
@@ -91379,8 +91409,7 @@ class KeyboardDevice {
|
|
|
91379
91409
|
if (keyName !== undefined) {
|
|
91380
91410
|
const button = this.keys[keyName];
|
|
91381
91411
|
|
|
91382
|
-
button.
|
|
91383
|
-
button.up.send1(event);
|
|
91412
|
+
button.release();
|
|
91384
91413
|
}
|
|
91385
91414
|
}
|
|
91386
91415
|
|
|
@@ -91395,6 +91424,43 @@ class KeyboardDevice {
|
|
|
91395
91424
|
}
|
|
91396
91425
|
}
|
|
91397
91426
|
|
|
91427
|
+
/**
|
|
91428
|
+
*
|
|
91429
|
+
* @param {TouchEvent|MouseEvent} event
|
|
91430
|
+
* @returns {number}
|
|
91431
|
+
*/
|
|
91432
|
+
function eventToSourceIdentifier(event) {
|
|
91433
|
+
let device_id = 0;
|
|
91434
|
+
let source_id = 0;
|
|
91435
|
+
|
|
91436
|
+
if (event instanceof MouseEvent) {
|
|
91437
|
+
|
|
91438
|
+
// mouse
|
|
91439
|
+
|
|
91440
|
+
device_id = 1;
|
|
91441
|
+
source_id = event.button;
|
|
91442
|
+
|
|
91443
|
+
} else if (event instanceof TouchEvent) {
|
|
91444
|
+
|
|
91445
|
+
// touch
|
|
91446
|
+
|
|
91447
|
+
device_id = 2;
|
|
91448
|
+
const touches = event.changedTouches;
|
|
91449
|
+
const num_changes = touches.length;
|
|
91450
|
+
|
|
91451
|
+
if (num_changes > 0) {
|
|
91452
|
+
const touch = touches.item(0);
|
|
91453
|
+
|
|
91454
|
+
source_id = touch.identifier;
|
|
91455
|
+
}
|
|
91456
|
+
|
|
91457
|
+
}
|
|
91458
|
+
|
|
91459
|
+
return ((device_id & 0b11) << 29)
|
|
91460
|
+
| (source_id & 0b11111111111111111111111111111)
|
|
91461
|
+
;
|
|
91462
|
+
}
|
|
91463
|
+
|
|
91398
91464
|
/**
|
|
91399
91465
|
* Event names for DOM {@link EventTarget} related to mouse.
|
|
91400
91466
|
* useful for .addEventListener and .removeEventListener
|
|
@@ -91427,6 +91493,23 @@ const TouchEvents = {
|
|
|
91427
91493
|
Cancel: "touchcancel",
|
|
91428
91494
|
};
|
|
91429
91495
|
|
|
91496
|
+
class LocationalInteractionMetadata {
|
|
91497
|
+
timestamp = performance.now()
|
|
91498
|
+
position = new Vector2()
|
|
91499
|
+
|
|
91500
|
+
/**
|
|
91501
|
+
*
|
|
91502
|
+
* @param {Vector2} p
|
|
91503
|
+
*/
|
|
91504
|
+
static from(p) {
|
|
91505
|
+
const r = new LocationalInteractionMetadata();
|
|
91506
|
+
|
|
91507
|
+
r.position.copy(p);
|
|
91508
|
+
|
|
91509
|
+
return r;
|
|
91510
|
+
}
|
|
91511
|
+
}
|
|
91512
|
+
|
|
91430
91513
|
/**
|
|
91431
91514
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/buttons
|
|
91432
91515
|
* @see https://w3c.github.io/uievents/#widl-MouseEvent-buttons
|
|
@@ -91504,6 +91587,7 @@ function getTouchCenter(touchList, result) {
|
|
|
91504
91587
|
|
|
91505
91588
|
}
|
|
91506
91589
|
|
|
91590
|
+
|
|
91507
91591
|
/**
|
|
91508
91592
|
*
|
|
91509
91593
|
* @param {Signal} up
|
|
@@ -91512,13 +91596,49 @@ function getTouchCenter(touchList, result) {
|
|
|
91512
91596
|
* @param {number} maxDistance
|
|
91513
91597
|
* @param {Signal} signal
|
|
91514
91598
|
*/
|
|
91515
|
-
function observeTap(
|
|
91599
|
+
function observeTap(
|
|
91600
|
+
up,
|
|
91601
|
+
down,
|
|
91602
|
+
move,
|
|
91603
|
+
maxDistance,
|
|
91604
|
+
signal
|
|
91605
|
+
) {
|
|
91516
91606
|
|
|
91517
|
-
|
|
91607
|
+
/**
|
|
91608
|
+
*
|
|
91609
|
+
* @type {Map<number, LocationalInteractionMetadata>}
|
|
91610
|
+
*/
|
|
91611
|
+
const active = new Map();
|
|
91612
|
+
|
|
91613
|
+
/**
|
|
91614
|
+
*
|
|
91615
|
+
* @param {number} id
|
|
91616
|
+
*/
|
|
91617
|
+
function reset(id) {
|
|
91518
91618
|
|
|
91619
|
+
if (active.delete(id)) {
|
|
91620
|
+
up.remove(handleUp);
|
|
91621
|
+
move.remove(handleMove);
|
|
91622
|
+
}
|
|
91623
|
+
}
|
|
91624
|
+
|
|
91625
|
+
/**
|
|
91626
|
+
*
|
|
91627
|
+
* @param {Vector2} position
|
|
91628
|
+
* @param {MouseEvent|TouchEvent} event
|
|
91629
|
+
*/
|
|
91519
91630
|
function handleUp(position, event) {
|
|
91520
|
-
|
|
91521
|
-
|
|
91631
|
+
const id = eventToSourceIdentifier(event);
|
|
91632
|
+
|
|
91633
|
+
const meta = active.get(id);
|
|
91634
|
+
|
|
91635
|
+
if (meta === undefined) {
|
|
91636
|
+
// this should not happen
|
|
91637
|
+
return;
|
|
91638
|
+
}
|
|
91639
|
+
|
|
91640
|
+
reset(id);
|
|
91641
|
+
|
|
91522
91642
|
signal.send2(position, event);
|
|
91523
91643
|
}
|
|
91524
91644
|
|
|
@@ -91528,20 +91648,42 @@ function observeTap(up, down, move, maxDistance, signal) {
|
|
|
91528
91648
|
* @param {MouseEvent|TouchEvent} event
|
|
91529
91649
|
*/
|
|
91530
91650
|
function handleMove(position, event) {
|
|
91531
|
-
|
|
91532
|
-
//we moved too far, abort tap
|
|
91533
|
-
move.remove(handleMove);
|
|
91651
|
+
const id = eventToSourceIdentifier(event);
|
|
91534
91652
|
|
|
91535
|
-
|
|
91653
|
+
const meta = active.get(id);
|
|
91654
|
+
|
|
91655
|
+
if (meta === undefined) {
|
|
91656
|
+
// this should not happen
|
|
91657
|
+
|
|
91658
|
+
reset(id);
|
|
91659
|
+
|
|
91660
|
+
return;
|
|
91536
91661
|
}
|
|
91662
|
+
|
|
91663
|
+
if (meta.position.distanceTo(position) > maxDistance) {
|
|
91664
|
+
//we moved too far, abort tap
|
|
91665
|
+
reset(id);
|
|
91666
|
+
}
|
|
91667
|
+
|
|
91537
91668
|
}
|
|
91538
91669
|
|
|
91539
|
-
|
|
91670
|
+
/**
|
|
91671
|
+
*
|
|
91672
|
+
* @param {Vector2} position
|
|
91673
|
+
* @param {TouchEvent|MouseEvent} event
|
|
91674
|
+
*/
|
|
91675
|
+
function handleDown(position, event) {
|
|
91676
|
+
const id = eventToSourceIdentifier(event);
|
|
91677
|
+
|
|
91678
|
+
// make sure to cancel previous pending resolution
|
|
91679
|
+
reset(id);
|
|
91680
|
+
|
|
91681
|
+
active.set(id, LocationalInteractionMetadata.from(position));
|
|
91682
|
+
|
|
91540
91683
|
up.addOne(handleUp);
|
|
91684
|
+
|
|
91541
91685
|
//track move
|
|
91542
91686
|
move.add(handleMove);
|
|
91543
|
-
|
|
91544
|
-
origin.copy(position);
|
|
91545
91687
|
}
|
|
91546
91688
|
|
|
91547
91689
|
down.add(handleDown);
|
|
@@ -91852,17 +91994,11 @@ class PointerDevice {
|
|
|
91852
91994
|
this.#domElement = domElement;
|
|
91853
91995
|
|
|
91854
91996
|
|
|
91855
|
-
this.#touchStart.add(
|
|
91856
|
-
this.on.down.send3(param0, param1, param2);
|
|
91857
|
-
});
|
|
91997
|
+
this.#touchStart.add(this.on.down.send3, this.on.down);
|
|
91858
91998
|
|
|
91859
|
-
this.#touchEnd.add(
|
|
91860
|
-
this.on.up.send3(param0, param1, param2);
|
|
91861
|
-
});
|
|
91862
|
-
this.#touchMove.add((param0, param1, param2) => {
|
|
91863
|
-
this.on.move.send3(param0, param1, param2);
|
|
91864
|
-
});
|
|
91999
|
+
this.#touchEnd.add(this.on.up.send3, this.on.up);
|
|
91865
92000
|
|
|
92001
|
+
this.#touchMove.add(this.on.move.send3, this.on.move);
|
|
91866
92002
|
|
|
91867
92003
|
//constructed events
|
|
91868
92004
|
observeTap(this.on.up, this.on.down, this.on.move, 10, this.on.tap);
|
|
@@ -91878,6 +92014,16 @@ class PointerDevice {
|
|
|
91878
92014
|
});
|
|
91879
92015
|
}
|
|
91880
92016
|
|
|
92017
|
+
|
|
92018
|
+
/**
|
|
92019
|
+
*
|
|
92020
|
+
* @param {TouchEvent} event
|
|
92021
|
+
*/
|
|
92022
|
+
#eventHandlerGlobalTouchEnd = (event) => {
|
|
92023
|
+
getTouchCenter(event.touches, this.position);
|
|
92024
|
+
this.#globalUp.send2(this.position, event);
|
|
92025
|
+
}
|
|
92026
|
+
|
|
91881
92027
|
/**
|
|
91882
92028
|
*
|
|
91883
92029
|
* @param {MouseEvent} event
|
|
@@ -91891,19 +92037,7 @@ class PointerDevice {
|
|
|
91891
92037
|
|
|
91892
92038
|
const button = this.buttons[button_index];
|
|
91893
92039
|
|
|
91894
|
-
|
|
91895
|
-
button.is_down = true;
|
|
91896
|
-
button.down.send0();
|
|
91897
|
-
}
|
|
91898
|
-
}
|
|
91899
|
-
|
|
91900
|
-
/**
|
|
91901
|
-
*
|
|
91902
|
-
* @param {TouchEvent} event
|
|
91903
|
-
*/
|
|
91904
|
-
#eventHandlerGlobalTouchEnd = (event) => {
|
|
91905
|
-
getTouchCenter(event.touches, this.position);
|
|
91906
|
-
this.#globalUp.send2(this.position, event);
|
|
92040
|
+
button?.press();
|
|
91907
92041
|
}
|
|
91908
92042
|
|
|
91909
92043
|
/**
|
|
@@ -91928,10 +92062,7 @@ class PointerDevice {
|
|
|
91928
92062
|
|
|
91929
92063
|
const button = this.buttons[button_index];
|
|
91930
92064
|
|
|
91931
|
-
|
|
91932
|
-
button.is_down = false;
|
|
91933
|
-
button.up.send0();
|
|
91934
|
-
}
|
|
92065
|
+
button?.release();
|
|
91935
92066
|
}
|
|
91936
92067
|
|
|
91937
92068
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export default BinaryHeap;
|
|
2
2
|
/**
|
|
3
|
-
* Min-Heap implementation with a score function.
|
|
3
|
+
* Min-Heap implementation with a score function.
|
|
4
|
+
* The data structure is a binary heap where elements are removed in order defined by scoring function
|
|
4
5
|
* @template T
|
|
5
6
|
*/
|
|
6
7
|
declare class BinaryHeap<T> {
|
|
@@ -11,20 +12,20 @@ declare class BinaryHeap<T> {
|
|
|
11
12
|
*/
|
|
12
13
|
constructor(scoreFunction: any);
|
|
13
14
|
/**
|
|
14
|
-
*
|
|
15
|
-
* @type {function(T): number}
|
|
16
|
-
*/
|
|
17
|
-
scoreFunction: (arg0: T_1) => number;
|
|
18
|
-
/**
|
|
19
|
-
*
|
|
15
|
+
* @private
|
|
20
16
|
* @type {T[]}
|
|
21
17
|
*/
|
|
22
|
-
data
|
|
18
|
+
private data;
|
|
23
19
|
/**
|
|
24
20
|
* @private
|
|
25
21
|
* @type {number}
|
|
26
22
|
*/
|
|
27
23
|
private length;
|
|
24
|
+
/**
|
|
25
|
+
*
|
|
26
|
+
* @type {function(T): number}
|
|
27
|
+
*/
|
|
28
|
+
scoreFunction: (arg0: T_1) => number;
|
|
28
29
|
/**
|
|
29
30
|
* @private
|
|
30
31
|
* @param {number} pos
|
|
@@ -87,5 +88,11 @@ declare class BinaryHeap<T> {
|
|
|
87
88
|
* @param {T} el
|
|
88
89
|
*/
|
|
89
90
|
push(el: T): void;
|
|
91
|
+
/**
|
|
92
|
+
* Useful for type checks
|
|
93
|
+
* @readonly
|
|
94
|
+
* @type {boolean}
|
|
95
|
+
*/
|
|
96
|
+
readonly isBinaryHeap: boolean;
|
|
90
97
|
}
|
|
91
|
-
//# sourceMappingURL=
|
|
98
|
+
//# sourceMappingURL=BinaryHeap.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BinaryHeap.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/heap/BinaryHeap.js"],"names":[],"mappings":";AAEA;;;;GAIG;AACH;IAaI;;;;OAIG;IACH,gCAQC;IAzBD;;;OAGG;IACH,aAAU;IAEV;;;OAGG;IACH,eAAW;IASP;;;OAGG;IACH,8BAFuB,MAAM,CAEK;IAItC;;;OAGG;IACH,iBA8BC;IAED;;;OAGG;IACH,mBAmEC;IAED;;;OAGG;IACH,OAFY,CAAC,CA0BZ;IAED;;;OAGG;IACH,QAFa,CAAC,GAAC,SAAS,CAIvB;IAED;;;;OAIG;IACH,aAHW,CAAC,GACC,OAAO,CAYnB;IAED;;;OAGG;IACH,iBAFW,MAAM,QAOhB;IAED;;OAEG;IACH,cAGC;IAED;;;;OAIG;IACH,eAHW,CAAC,GACC,OAAO,CAKnB;IAED;;;OAGG;IACH,WAFa,OAAO,CAInB;IAED;;;OAGG;IACH,QAFa,MAAM,CAIlB;IAED;;;;OAIG;IACH,yBAHW,CAAC,GACC,OAAO,CAWnB;IAED;;;OAGG;IACH,SAFW,CAAC,QAUX;IAGL;;;;OAIG;IACH,uBAFU,OAAO,CAEgB;CAPhC"}
|