@woosh/meep-engine 2.47.1 → 2.47.2
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 +194 -283
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +194 -283
- package/package.json +1 -1
- package/src/core/collection/list/List.js +8 -0
- package/src/core/geom/Rectangle.js +178 -168
- package/src/core/model/node-graph/NodeGraph.js +10 -1
- package/src/core/model/node-graph/node/NodeInstance.js +83 -15
- package/src/engine/ecs/fow/serialization/FogOfWarSerializationAdapter.js +7 -2
- package/src/engine/graphics/texture/sampler/Sampler2D.js +8 -116
- package/src/engine/graphics/texture/sampler/Sampler2D2Canvas.js +1 -1
- package/src/engine/graphics/texture/sampler/sampler2d_make_array_filler_function.js +65 -0
- package/src/engine/ui/tiles2d/computeTileGridMove.js +2 -2
package/build/meep.module.js
CHANGED
|
@@ -48198,11 +48198,6 @@ class Sampler2D {
|
|
|
48198
48198
|
* @type {number}
|
|
48199
48199
|
*/
|
|
48200
48200
|
this.version = 0;
|
|
48201
|
-
/**
|
|
48202
|
-
* @readonly
|
|
48203
|
-
* @type {boolean}
|
|
48204
|
-
*/
|
|
48205
|
-
this.isSampler2D = true;
|
|
48206
48201
|
}
|
|
48207
48202
|
|
|
48208
48203
|
/**
|
|
@@ -48233,7 +48228,7 @@ class Sampler2D {
|
|
|
48233
48228
|
|
|
48234
48229
|
if (l === 0) {
|
|
48235
48230
|
//no data
|
|
48236
|
-
return
|
|
48231
|
+
return;
|
|
48237
48232
|
}
|
|
48238
48233
|
|
|
48239
48234
|
let bestValue = data[channel];
|
|
@@ -48259,8 +48254,6 @@ class Sampler2D {
|
|
|
48259
48254
|
if (resultCount < result.length) {
|
|
48260
48255
|
result.splice(resultCount, result.length - resultCount);
|
|
48261
48256
|
}
|
|
48262
|
-
|
|
48263
|
-
return;
|
|
48264
48257
|
}
|
|
48265
48258
|
|
|
48266
48259
|
/**
|
|
@@ -48759,73 +48752,6 @@ class Sampler2D {
|
|
|
48759
48752
|
result.set(x, y);
|
|
48760
48753
|
}
|
|
48761
48754
|
|
|
48762
|
-
/**
|
|
48763
|
-
*
|
|
48764
|
-
* @param {number} scale
|
|
48765
|
-
* @param {number} offset
|
|
48766
|
-
* @return {function(index:int, array:ArrayLike, x:int, y:int)}
|
|
48767
|
-
*/
|
|
48768
|
-
makeArrayFiller(scale, offset) {
|
|
48769
|
-
scale = scale || 255;
|
|
48770
|
-
offset = offset || 0;
|
|
48771
|
-
|
|
48772
|
-
const sampler = this;
|
|
48773
|
-
const v4 = [1 / scale, 1 / scale, 1 / scale, 1 / scale];
|
|
48774
|
-
|
|
48775
|
-
//
|
|
48776
|
-
function fillDD1(index, array, x, y) {
|
|
48777
|
-
const val = (sampler.sampleChannelBilinear(x, y, 0) + offset) * scale | 0;
|
|
48778
|
-
array[index] = val;
|
|
48779
|
-
array[index + 1] = val;
|
|
48780
|
-
array[index + 2] = val;
|
|
48781
|
-
array[index + 3] = 255;
|
|
48782
|
-
}
|
|
48783
|
-
|
|
48784
|
-
function fillDD2(index, array, x, y) {
|
|
48785
|
-
sampler.sampleBilinear(x, y, v4, 0);
|
|
48786
|
-
const val = (v4[0] + offset) * scale | 0;
|
|
48787
|
-
array.fill(val, index, index + 3);
|
|
48788
|
-
array[index + 3] = (v4[1] + offset) * scale | 0;
|
|
48789
|
-
}
|
|
48790
|
-
|
|
48791
|
-
function fillDD3(index, array, x, y) {
|
|
48792
|
-
|
|
48793
|
-
sampler.sampleBilinear(x, y, v4, 0);
|
|
48794
|
-
|
|
48795
|
-
array[index] = (v4[0] + offset) * scale | 0;
|
|
48796
|
-
array[index + 1] = (v4[1] + offset) * scale | 0;
|
|
48797
|
-
array[index + 2] = (v4[2] + offset) * scale | 0;
|
|
48798
|
-
array[index + 3] = 255;
|
|
48799
|
-
}
|
|
48800
|
-
|
|
48801
|
-
function fillDD4(index, array, x, y) {
|
|
48802
|
-
sampler.sampleBilinear(x, y, v4, 0);
|
|
48803
|
-
array[index] = (v4[0] + offset) * scale | 0;
|
|
48804
|
-
array[index + 1] = (v4[1] + offset) * scale | 0;
|
|
48805
|
-
array[index + 2] = (v4[2] + offset) * scale | 0;
|
|
48806
|
-
array[index + 3] = (v4[3] + offset) * scale | 0;
|
|
48807
|
-
}
|
|
48808
|
-
|
|
48809
|
-
let fillDD;
|
|
48810
|
-
switch (sampler.itemSize) {
|
|
48811
|
-
case 1:
|
|
48812
|
-
fillDD = fillDD1;
|
|
48813
|
-
break;
|
|
48814
|
-
case 2:
|
|
48815
|
-
fillDD = fillDD2;
|
|
48816
|
-
break;
|
|
48817
|
-
case 3:
|
|
48818
|
-
fillDD = fillDD3;
|
|
48819
|
-
break;
|
|
48820
|
-
case 4:
|
|
48821
|
-
fillDD = fillDD4;
|
|
48822
|
-
break;
|
|
48823
|
-
default :
|
|
48824
|
-
throw new Error("unsupported item size");
|
|
48825
|
-
}
|
|
48826
|
-
return fillDD;
|
|
48827
|
-
}
|
|
48828
|
-
|
|
48829
48755
|
/**
|
|
48830
48756
|
* Copy a patch from another sampler with a margin.
|
|
48831
48757
|
* This is useful for texture rendering where filtering can cause bleeding along the edges of the patch.
|
|
@@ -49402,28 +49328,7 @@ class Sampler2D {
|
|
|
49402
49328
|
* @param {BinaryBuffer} buffer
|
|
49403
49329
|
*/
|
|
49404
49330
|
toBinaryBuffer(buffer) {
|
|
49405
|
-
|
|
49406
|
-
const height = this.height;
|
|
49407
|
-
|
|
49408
|
-
const itemSize = this.itemSize;
|
|
49409
|
-
|
|
49410
|
-
buffer.writeUint16(width);
|
|
49411
|
-
buffer.writeUint16(height);
|
|
49412
|
-
|
|
49413
|
-
buffer.writeUint8(itemSize);
|
|
49414
|
-
|
|
49415
|
-
if (this.data instanceof Uint8Array) {
|
|
49416
|
-
//data type
|
|
49417
|
-
buffer.writeUint8(0);
|
|
49418
|
-
|
|
49419
|
-
|
|
49420
|
-
const byteSize = width * height * itemSize;
|
|
49421
|
-
|
|
49422
|
-
buffer.writeBytes(this.data, 0, byteSize);
|
|
49423
|
-
|
|
49424
|
-
} else {
|
|
49425
|
-
throw new TypeError(`Unsupported data type`);
|
|
49426
|
-
}
|
|
49331
|
+
throw new Error('Deprecated, use Sampler2DSerializationAdapter instead');
|
|
49427
49332
|
}
|
|
49428
49333
|
|
|
49429
49334
|
/**
|
|
@@ -49431,24 +49336,7 @@ class Sampler2D {
|
|
|
49431
49336
|
* @param {BinaryBuffer} buffer
|
|
49432
49337
|
*/
|
|
49433
49338
|
fromBinaryBuffer(buffer) {
|
|
49434
|
-
|
|
49435
|
-
this.height = buffer.readUint16();
|
|
49436
|
-
|
|
49437
|
-
this.itemSize = buffer.readUint8();
|
|
49438
|
-
|
|
49439
|
-
const dataType = buffer.readUint8();
|
|
49440
|
-
|
|
49441
|
-
if (dataType === 0) {
|
|
49442
|
-
|
|
49443
|
-
const numBytes = this.height * this.width * this.itemSize;
|
|
49444
|
-
this.data = new Uint8Array(numBytes);
|
|
49445
|
-
|
|
49446
|
-
buffer.readBytes(this.data, 0, numBytes);
|
|
49447
|
-
|
|
49448
|
-
this.version++;
|
|
49449
|
-
} else {
|
|
49450
|
-
throw new TypeError(`Unsupported data type (${dataType})`);
|
|
49451
|
-
}
|
|
49339
|
+
throw new Error('Deprecated, use Sampler2DSerializationAdapter instead');
|
|
49452
49340
|
}
|
|
49453
49341
|
|
|
49454
49342
|
/**
|
|
@@ -49693,6 +49581,11 @@ class Sampler2D {
|
|
|
49693
49581
|
|
|
49694
49582
|
}
|
|
49695
49583
|
|
|
49584
|
+
/**
|
|
49585
|
+
* @readonly
|
|
49586
|
+
* @type {boolean}
|
|
49587
|
+
*/
|
|
49588
|
+
Sampler2D.prototype.isSampler2D = true;
|
|
49696
49589
|
|
|
49697
49590
|
/**
|
|
49698
49591
|
* Based on code from reddit https://www.reddit.com/r/javascript/comments/jxa8x/bicubic_interpolation/
|
|
@@ -62651,6 +62544,10 @@ List.prototype.toBinaryBuffer = function (buffer) {
|
|
|
62651
62544
|
for (let i = 0; i < n; i++) {
|
|
62652
62545
|
const item = this.data[i];
|
|
62653
62546
|
|
|
62547
|
+
if(typeof item.toBinaryBuffer !== "function"){
|
|
62548
|
+
throw new Error('item.toBinaryBuffer is not a function');
|
|
62549
|
+
}
|
|
62550
|
+
|
|
62654
62551
|
item.toBinaryBuffer(buffer);
|
|
62655
62552
|
}
|
|
62656
62553
|
};
|
|
@@ -62665,6 +62562,10 @@ List.prototype.fromBinaryBuffer = function (buffer, constructor) {
|
|
|
62665
62562
|
|
|
62666
62563
|
const el = new constructor();
|
|
62667
62564
|
|
|
62565
|
+
if(typeof el.fromBinaryBuffer !== "function"){
|
|
62566
|
+
throw new Error('item.fromBinaryBuffer is not a function');
|
|
62567
|
+
}
|
|
62568
|
+
|
|
62668
62569
|
el.fromBinaryBuffer(buffer);
|
|
62669
62570
|
|
|
62670
62571
|
return el;
|
|
@@ -105704,213 +105605,223 @@ class TooltipManager {
|
|
|
105704
105605
|
*/
|
|
105705
105606
|
|
|
105706
105607
|
|
|
105707
|
-
|
|
105708
|
-
|
|
105709
|
-
|
|
105710
|
-
|
|
105711
|
-
|
|
105712
|
-
|
|
105713
|
-
|
|
105714
|
-
|
|
105715
|
-
|
|
105608
|
+
class Rectangle {
|
|
105609
|
+
/**
|
|
105610
|
+
*
|
|
105611
|
+
* @param {number} x
|
|
105612
|
+
* @param {number} y
|
|
105613
|
+
* @param {number} width
|
|
105614
|
+
* @param {number} height
|
|
105615
|
+
* @constructor
|
|
105616
|
+
*/
|
|
105617
|
+
constructor(x = 0, y = 0, width = 0, height = 0) {
|
|
105618
|
+
|
|
105619
|
+
/**
|
|
105620
|
+
* @readonly
|
|
105621
|
+
* @type {Vector2}
|
|
105622
|
+
*/
|
|
105623
|
+
this.position = new Vector2(x, y);
|
|
105624
|
+
|
|
105625
|
+
/**
|
|
105626
|
+
* @readonly
|
|
105627
|
+
* @type {Vector2}
|
|
105628
|
+
*/
|
|
105629
|
+
this.size = new Vector2(width, height);
|
|
105630
|
+
}
|
|
105716
105631
|
|
|
105717
105632
|
/**
|
|
105718
|
-
*
|
|
105633
|
+
*
|
|
105634
|
+
* @param {number} x
|
|
105635
|
+
* @param {number} y
|
|
105636
|
+
* @param {number} width
|
|
105637
|
+
* @param {number} height
|
|
105719
105638
|
*/
|
|
105720
|
-
|
|
105639
|
+
set(x, y, width, height) {
|
|
105640
|
+
this.size.set(width, height);
|
|
105641
|
+
this.position.set(x, y);
|
|
105642
|
+
}
|
|
105721
105643
|
|
|
105722
105644
|
/**
|
|
105723
|
-
*
|
|
105645
|
+
*
|
|
105646
|
+
* @returns {Rectangle}
|
|
105724
105647
|
*/
|
|
105725
|
-
|
|
105726
|
-
|
|
105648
|
+
clone() {
|
|
105649
|
+
return new Rectangle(this.position.x, this.position.y, this.size.x, this.size.y);
|
|
105650
|
+
}
|
|
105727
105651
|
|
|
105728
|
-
/**
|
|
105729
|
-
|
|
105730
|
-
|
|
105731
|
-
|
|
105732
|
-
|
|
105733
|
-
|
|
105734
|
-
|
|
105735
|
-
|
|
105736
|
-
this.size.set(width, height);
|
|
105737
|
-
this.position.set(x, y);
|
|
105738
|
-
};
|
|
105652
|
+
/**
|
|
105653
|
+
*
|
|
105654
|
+
* @param {Rectangle} other
|
|
105655
|
+
*/
|
|
105656
|
+
copy(other) {
|
|
105657
|
+
this.position.copy(other.position);
|
|
105658
|
+
this.size.copy(other.size);
|
|
105659
|
+
}
|
|
105739
105660
|
|
|
105740
|
-
/**
|
|
105741
|
-
|
|
105742
|
-
|
|
105743
|
-
|
|
105744
|
-
|
|
105745
|
-
|
|
105746
|
-
}
|
|
105661
|
+
/**
|
|
105662
|
+
*
|
|
105663
|
+
* @param {number} x0
|
|
105664
|
+
* @param {number} y0
|
|
105665
|
+
* @param {number} x1
|
|
105666
|
+
* @param {number} y1
|
|
105667
|
+
* @returns {boolean}
|
|
105668
|
+
*/
|
|
105669
|
+
_intersects(x0, y0, x1, y1) {
|
|
105670
|
+
const p = this.position;
|
|
105671
|
+
const s = this.size;
|
|
105747
105672
|
|
|
105748
|
-
|
|
105749
|
-
|
|
105750
|
-
* @param {Rectangle} other
|
|
105751
|
-
*/
|
|
105752
|
-
Rectangle.prototype.copy = function (other) {
|
|
105753
|
-
this.position.copy(other.position);
|
|
105754
|
-
this.size.copy(other.size);
|
|
105755
|
-
};
|
|
105673
|
+
const _x0 = p.x;
|
|
105674
|
+
const _y0 = p.y;
|
|
105756
105675
|
|
|
105757
|
-
|
|
105758
|
-
|
|
105759
|
-
* @param {number} x0
|
|
105760
|
-
* @param {number} y0
|
|
105761
|
-
* @param {number} x1
|
|
105762
|
-
* @param {number} y1
|
|
105763
|
-
* @returns {boolean}
|
|
105764
|
-
*/
|
|
105765
|
-
Rectangle.prototype._intersects = function (x0, y0, x1, y1) {
|
|
105766
|
-
const p = this.position;
|
|
105767
|
-
const s = this.size;
|
|
105676
|
+
return intersects1D(x0, x1, _x0, s.x + _x0) && intersects1D(y0, y1, _y0, _y0 + s.y);
|
|
105677
|
+
}
|
|
105768
105678
|
|
|
105769
|
-
|
|
105770
|
-
|
|
105679
|
+
/**
|
|
105680
|
+
*
|
|
105681
|
+
* @param {Rectangle} other
|
|
105682
|
+
* @returns {boolean}
|
|
105683
|
+
*/
|
|
105684
|
+
intersects(other) {
|
|
105685
|
+
const x0 = other.position.x;
|
|
105686
|
+
const y0 = other.position.y;
|
|
105687
|
+
const y1 = other.size.y + y0;
|
|
105688
|
+
const x1 = other.size.x + x0;
|
|
105689
|
+
return this._intersects(x0, y0, x1, y1);
|
|
105690
|
+
}
|
|
105771
105691
|
|
|
105772
|
-
|
|
105773
|
-
|
|
105692
|
+
/**
|
|
105693
|
+
*
|
|
105694
|
+
* @param {number} x0
|
|
105695
|
+
* @param {number} y0
|
|
105696
|
+
* @param {number} x1
|
|
105697
|
+
* @param {number} y1
|
|
105698
|
+
* @returns {boolean}
|
|
105699
|
+
*/
|
|
105700
|
+
_overlaps(x0, y0, x1, y1) {
|
|
105701
|
+
const p = this.position;
|
|
105702
|
+
const s = this.size;
|
|
105774
105703
|
|
|
105775
|
-
|
|
105776
|
-
|
|
105777
|
-
* @param {Rectangle} other
|
|
105778
|
-
* @returns {boolean}
|
|
105779
|
-
*/
|
|
105780
|
-
Rectangle.prototype.intersects = function (other) {
|
|
105781
|
-
const x0 = other.position.x;
|
|
105782
|
-
const y0 = other.position.y;
|
|
105783
|
-
const y1 = other.size.y + y0;
|
|
105784
|
-
const x1 = other.size.x + x0;
|
|
105785
|
-
return this._intersects(x0, y0, x1, y1);
|
|
105786
|
-
};
|
|
105704
|
+
const _x0 = p.x;
|
|
105705
|
+
const _y0 = p.y;
|
|
105787
105706
|
|
|
105788
|
-
|
|
105789
|
-
|
|
105790
|
-
* @param {number} x0
|
|
105791
|
-
* @param {number} y0
|
|
105792
|
-
* @param {number} x1
|
|
105793
|
-
* @param {number} y1
|
|
105794
|
-
* @returns {boolean}
|
|
105795
|
-
*/
|
|
105796
|
-
Rectangle.prototype._overlaps = function (x0, y0, x1, y1) {
|
|
105797
|
-
const p = this.position;
|
|
105798
|
-
const s = this.size;
|
|
105707
|
+
return overlap1D(x0, x1, _x0, s.x + _x0) && overlap1D(y0, y1, _y0, _y0 + s.y);
|
|
105708
|
+
}
|
|
105799
105709
|
|
|
105800
|
-
|
|
105801
|
-
|
|
105710
|
+
overlaps(other) {
|
|
105711
|
+
const x0 = other.position.x;
|
|
105712
|
+
const y0 = other.position.y;
|
|
105713
|
+
const y1 = other.size.y + y0;
|
|
105714
|
+
const x1 = other.size.x + x0;
|
|
105715
|
+
return this._overlaps(x0, y0, x1, y1);
|
|
105716
|
+
}
|
|
105802
105717
|
|
|
105803
|
-
|
|
105804
|
-
|
|
105718
|
+
_resizeToFit(x0, y0, x1, y1) {
|
|
105719
|
+
const size = this.size;
|
|
105805
105720
|
|
|
105806
|
-
|
|
105807
|
-
|
|
105808
|
-
const y0 = other.position.y;
|
|
105809
|
-
const y1 = other.size.y + y0;
|
|
105810
|
-
const x1 = other.size.x + x0;
|
|
105811
|
-
return this._overlaps(x0, y0, x1, y1);
|
|
105812
|
-
};
|
|
105721
|
+
const _x0 = this.position.x;
|
|
105722
|
+
const _y0 = this.position.y;
|
|
105813
105723
|
|
|
105814
|
-
|
|
105815
|
-
|
|
105724
|
+
let _y1 = size.y + _y0;
|
|
105725
|
+
let _x1 = size.x + _x0;
|
|
105816
105726
|
|
|
105817
|
-
|
|
105818
|
-
|
|
105727
|
+
if (Number.isNaN(_x1)) {
|
|
105728
|
+
_x1 = -Infinity;
|
|
105729
|
+
}
|
|
105730
|
+
if (Number.isNaN(_y1)) {
|
|
105731
|
+
_y1 = -Infinity;
|
|
105732
|
+
}
|
|
105819
105733
|
|
|
105820
|
-
|
|
105821
|
-
|
|
105734
|
+
const nX0 = min2(x0, _x0);
|
|
105735
|
+
const nY0 = min2(y0, _y0);
|
|
105736
|
+
const nX1 = max2(x1, _x1);
|
|
105737
|
+
const nY1 = max2(y1, _y1);
|
|
105822
105738
|
|
|
105823
|
-
|
|
105824
|
-
|
|
105825
|
-
}
|
|
105826
|
-
if (Number.isNaN(_y1)) {
|
|
105827
|
-
_y1 = -Infinity;
|
|
105739
|
+
this.position.set(nX0, nY0);
|
|
105740
|
+
size.set(nX1 - nX0, nY1 - nY0);
|
|
105828
105741
|
}
|
|
105829
105742
|
|
|
105830
|
-
|
|
105831
|
-
|
|
105832
|
-
|
|
105833
|
-
|
|
105743
|
+
resizeToFit(other) {
|
|
105744
|
+
const x0 = other.position.x;
|
|
105745
|
+
const y0 = other.position.y;
|
|
105746
|
+
const y1 = other.size.y + y0;
|
|
105747
|
+
const x1 = other.size.x + x0;
|
|
105834
105748
|
|
|
105835
|
-
|
|
105836
|
-
|
|
105837
|
-
};
|
|
105749
|
+
return this._resizeToFit(x0, y0, x1, y1);
|
|
105750
|
+
}
|
|
105838
105751
|
|
|
105839
|
-
|
|
105840
|
-
|
|
105841
|
-
const y0 = other.position.y;
|
|
105842
|
-
const y1 = other.size.y + y0;
|
|
105843
|
-
const x1 = other.size.x + x0;
|
|
105752
|
+
_contains(x0, y0, x1, y1) {
|
|
105753
|
+
const size = this.size;
|
|
105844
105754
|
|
|
105845
|
-
|
|
105846
|
-
|
|
105755
|
+
const _x0 = this.position.x;
|
|
105756
|
+
const _y0 = this.position.y;
|
|
105847
105757
|
|
|
105848
|
-
|
|
105849
|
-
|
|
105758
|
+
const _y1 = size.y + _y0;
|
|
105759
|
+
const _x1 = size.x + _x0;
|
|
105850
105760
|
|
|
105851
|
-
|
|
105852
|
-
|
|
105761
|
+
return x0 >= _x0 && x1 <= _x1 && y0 >= _y0 && y1 <= _y1;
|
|
105762
|
+
}
|
|
105853
105763
|
|
|
105854
|
-
|
|
105855
|
-
|
|
105764
|
+
contains(other) {
|
|
105765
|
+
const x0 = other.position.x;
|
|
105766
|
+
const y0 = other.position.y;
|
|
105767
|
+
const y1 = other.size.y + y0;
|
|
105768
|
+
const x1 = other.size.x + x0;
|
|
105856
105769
|
|
|
105857
|
-
|
|
105858
|
-
}
|
|
105770
|
+
return this._contains(x0, y0, x1, y1);
|
|
105771
|
+
}
|
|
105859
105772
|
|
|
105860
|
-
|
|
105861
|
-
|
|
105862
|
-
|
|
105863
|
-
|
|
105864
|
-
|
|
105773
|
+
/**
|
|
105774
|
+
*
|
|
105775
|
+
* @param {Vector2} result
|
|
105776
|
+
*/
|
|
105777
|
+
computeCenter(result) {
|
|
105778
|
+
const p = this.position;
|
|
105779
|
+
const s = this.size;
|
|
105865
105780
|
|
|
105866
|
-
|
|
105867
|
-
|
|
105781
|
+
const x = p.x + s.x / 2;
|
|
105782
|
+
const y = p.y + s.y / 2;
|
|
105868
105783
|
|
|
105869
|
-
|
|
105870
|
-
|
|
105871
|
-
* @param {Vector2} result
|
|
105872
|
-
*/
|
|
105873
|
-
Rectangle.prototype.computeCenter = function (result) {
|
|
105874
|
-
const p = this.position;
|
|
105875
|
-
const s = this.size;
|
|
105784
|
+
result.set(x, y);
|
|
105785
|
+
}
|
|
105876
105786
|
|
|
105877
|
-
|
|
105878
|
-
|
|
105787
|
+
/**
|
|
105788
|
+
*
|
|
105789
|
+
* @return {number}
|
|
105790
|
+
*/
|
|
105791
|
+
computeArea() {
|
|
105792
|
+
return this.size.x * this.size.y;
|
|
105793
|
+
}
|
|
105879
105794
|
|
|
105880
|
-
|
|
105881
|
-
|
|
105795
|
+
/**
|
|
105796
|
+
*
|
|
105797
|
+
* @param {Array.<number>|Float32Array|Float64Array|Uint8Array} target
|
|
105798
|
+
* @param {number} [targetOffset=0]
|
|
105799
|
+
*/
|
|
105800
|
+
toArray(target, targetOffset = 0) {
|
|
105801
|
+
target[targetOffset] = this.position.x;
|
|
105802
|
+
target[targetOffset + 1] = this.position.y;
|
|
105803
|
+
target[targetOffset + 2] = this.size.x;
|
|
105804
|
+
target[targetOffset + 3] = this.size.y;
|
|
105805
|
+
}
|
|
105882
105806
|
|
|
105883
|
-
|
|
105884
|
-
|
|
105885
|
-
|
|
105886
|
-
|
|
105887
|
-
|
|
105888
|
-
|
|
105889
|
-
|
|
105807
|
+
toJSON() {
|
|
105808
|
+
return {
|
|
105809
|
+
position: this.position.toJSON(),
|
|
105810
|
+
size: this.size.toJSON()
|
|
105811
|
+
};
|
|
105812
|
+
}
|
|
105813
|
+
|
|
105814
|
+
fromJSON(json) {
|
|
105815
|
+
this.position.fromJSON(json.position);
|
|
105816
|
+
this.size.fromJSON(json.size);
|
|
105817
|
+
}
|
|
105818
|
+
}
|
|
105890
105819
|
|
|
105891
105820
|
/**
|
|
105892
|
-
*
|
|
105893
|
-
* @
|
|
105894
|
-
* @param {number} [targetOffset=0]
|
|
105821
|
+
* @readonly
|
|
105822
|
+
* @type {boolean}
|
|
105895
105823
|
*/
|
|
105896
|
-
Rectangle.prototype.
|
|
105897
|
-
target[targetOffset] = this.position.x;
|
|
105898
|
-
target[targetOffset + 1] = this.position.y;
|
|
105899
|
-
target[targetOffset + 2] = this.size.x;
|
|
105900
|
-
target[targetOffset + 3] = this.size.y;
|
|
105901
|
-
};
|
|
105902
|
-
|
|
105903
|
-
Rectangle.prototype.toJSON = function () {
|
|
105904
|
-
return {
|
|
105905
|
-
position: this.position.toJSON(),
|
|
105906
|
-
size: this.size.toJSON()
|
|
105907
|
-
};
|
|
105908
|
-
};
|
|
105909
|
-
|
|
105910
|
-
Rectangle.prototype.fromJSON = function (json) {
|
|
105911
|
-
this.position.fromJSON(json.position);
|
|
105912
|
-
this.size.fromJSON(json.size);
|
|
105913
|
-
};
|
|
105824
|
+
Rectangle.prototype.isRectangle = true;
|
|
105914
105825
|
|
|
105915
105826
|
class VisualTip {
|
|
105916
105827
|
/**
|
package/package.json
CHANGED
|
@@ -777,6 +777,10 @@ List.prototype.toBinaryBuffer = function (buffer) {
|
|
|
777
777
|
for (let i = 0; i < n; i++) {
|
|
778
778
|
const item = this.data[i];
|
|
779
779
|
|
|
780
|
+
if(typeof item.toBinaryBuffer !== "function"){
|
|
781
|
+
throw new Error('item.toBinaryBuffer is not a function');
|
|
782
|
+
}
|
|
783
|
+
|
|
780
784
|
item.toBinaryBuffer(buffer);
|
|
781
785
|
}
|
|
782
786
|
};
|
|
@@ -791,6 +795,10 @@ List.prototype.fromBinaryBuffer = function (buffer, constructor) {
|
|
|
791
795
|
|
|
792
796
|
const el = new constructor();
|
|
793
797
|
|
|
798
|
+
if(typeof el.fromBinaryBuffer !== "function"){
|
|
799
|
+
throw new Error('item.fromBinaryBuffer is not a function');
|
|
800
|
+
}
|
|
801
|
+
|
|
794
802
|
el.fromBinaryBuffer(buffer);
|
|
795
803
|
|
|
796
804
|
return el;
|