melonjs 10.4.0 → 10.5.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/dist/melonjs.js +774 -244
- package/dist/melonjs.min.js +4 -4
- package/dist/melonjs.module.d.ts +141 -175
- package/dist/melonjs.module.js +768 -242
- package/package.json +9 -8
- package/src/index.js +5 -12
- package/src/lang/deprecated.js +40 -0
- package/src/level/tiled/TMXTileMap.js +2 -0
- package/src/physics/body.js +2 -1
- package/src/physics/detector.js +4 -3
- package/src/renderable/dragndrop.js +224 -0
- package/src/renderable/renderable.js +2 -3
- package/src/video/texture_cache.js +23 -5
- package/src/video/video.js +1 -1
- package/src/video/webgl/webgl_compositor.js +11 -0
- package/src/video/webgl/webgl_renderer.js +12 -0
- package/src/entity/draggable.js +0 -129
- package/src/entity/droptarget.js +0 -99
package/dist/melonjs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* melonJS Game Engine - v10.
|
|
2
|
+
* melonJS Game Engine - v10.5.2
|
|
3
3
|
* http://www.melonjs.org
|
|
4
4
|
* melonjs is licensed under the MIT License.
|
|
5
5
|
* http://www.opensource.org/licenses/mit-license
|
|
@@ -13665,7 +13665,7 @@
|
|
|
13665
13665
|
* @param {number} dt time since the last update in milliseconds.
|
|
13666
13666
|
* @returns {boolean} true if the renderable is dirty
|
|
13667
13667
|
*/
|
|
13668
|
-
Renderable.prototype.update = function update (
|
|
13668
|
+
Renderable.prototype.update = function update (dt) { // eslint-disable-line no-unused-vars
|
|
13669
13669
|
return this.isDirty;
|
|
13670
13670
|
};
|
|
13671
13671
|
|
|
@@ -13813,7 +13813,7 @@
|
|
|
13813
13813
|
* @protected
|
|
13814
13814
|
* @param {CanvasRenderer|WebGLRenderer} renderer a renderer object
|
|
13815
13815
|
*/
|
|
13816
|
-
Renderable.prototype.draw = function draw (
|
|
13816
|
+
Renderable.prototype.draw = function draw (renderer) { // eslint-disable-line no-unused-vars
|
|
13817
13817
|
// empty one !
|
|
13818
13818
|
};
|
|
13819
13819
|
|
|
@@ -13827,7 +13827,6 @@
|
|
|
13827
13827
|
* @param {CanvasRenderer|WebGLRenderer} renderer a renderer object
|
|
13828
13828
|
*/
|
|
13829
13829
|
Renderable.prototype.postDraw = function postDraw (renderer) {
|
|
13830
|
-
|
|
13831
13830
|
// remove the previously applied tint
|
|
13832
13831
|
renderer.clearTint();
|
|
13833
13832
|
|
|
@@ -14707,7 +14706,8 @@
|
|
|
14707
14706
|
function shouldCollide(a, b) {
|
|
14708
14707
|
return (
|
|
14709
14708
|
a.isKinematic !== true && b.isKinematic !== true &&
|
|
14710
|
-
a.body && b.body &&
|
|
14709
|
+
typeof a.body === "object" && typeof b.body === "object" &&
|
|
14710
|
+
!(a.body.isStatic === true && b.body.isStatic === true) &&
|
|
14711
14711
|
(a.body.collisionMask & b.body.collisionType) !== 0 &&
|
|
14712
14712
|
(a.body.collisionType & b.body.collisionMask) !== 0
|
|
14713
14713
|
);
|
|
@@ -14820,10 +14820,10 @@
|
|
|
14820
14820
|
response.indexShapeB = indexB;
|
|
14821
14821
|
|
|
14822
14822
|
// execute the onCollision callback
|
|
14823
|
-
if (objA.onCollision && objA.onCollision(response, objB) !== false) {
|
|
14823
|
+
if (objA.onCollision && objA.onCollision(response, objB) !== false && objA.body.isStatic === false) {
|
|
14824
14824
|
objA.body.respondToCollision.call(objA.body, response);
|
|
14825
14825
|
}
|
|
14826
|
-
if (objB.onCollision && objB.onCollision(response, objA) !== false) {
|
|
14826
|
+
if (objB.onCollision && objB.onCollision(response, objA) !== false && objB.body.isStatic === false) {
|
|
14827
14827
|
objB.body.respondToCollision.call(objB.body, response);
|
|
14828
14828
|
}
|
|
14829
14829
|
}
|
|
@@ -15183,7 +15183,8 @@
|
|
|
15183
15183
|
|
|
15184
15184
|
|
|
15185
15185
|
/**
|
|
15186
|
-
*
|
|
15186
|
+
* Either this body is a static body or not.
|
|
15187
|
+
* A static body is completely fixed and can never change position or angle.
|
|
15187
15188
|
* @readonly
|
|
15188
15189
|
* @public
|
|
15189
15190
|
* @type {boolean}
|
|
@@ -19523,12 +19524,462 @@
|
|
|
19523
19524
|
}
|
|
19524
19525
|
}
|
|
19525
19526
|
|
|
19527
|
+
var src = {};
|
|
19528
|
+
|
|
19529
|
+
var arraymultimap = {};
|
|
19530
|
+
|
|
19531
|
+
var multimap = {};
|
|
19532
|
+
|
|
19533
|
+
var __generator = (commonjsGlobal && commonjsGlobal.__generator) || function (thisArg, body) {
|
|
19534
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) { throw t[1]; } return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
19535
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
19536
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
19537
|
+
function step(op) {
|
|
19538
|
+
if (f) { throw new TypeError("Generator is already executing."); }
|
|
19539
|
+
while (_) { try {
|
|
19540
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) { return t; }
|
|
19541
|
+
if (y = 0, t) { op = [op[0] & 2, t.value]; }
|
|
19542
|
+
switch (op[0]) {
|
|
19543
|
+
case 0: case 1: t = op; break;
|
|
19544
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
19545
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
19546
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
19547
|
+
default:
|
|
19548
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
19549
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
19550
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
19551
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
19552
|
+
if (t[2]) { _.ops.pop(); }
|
|
19553
|
+
_.trys.pop(); continue;
|
|
19554
|
+
}
|
|
19555
|
+
op = body.call(thisArg, _);
|
|
19556
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } }
|
|
19557
|
+
if (op[0] & 5) { throw op[1]; } return { value: op[0] ? op[1] : void 0, done: true };
|
|
19558
|
+
}
|
|
19559
|
+
};
|
|
19560
|
+
var __values = (commonjsGlobal && commonjsGlobal.__values) || function(o) {
|
|
19561
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
19562
|
+
if (m) { return m.call(o); }
|
|
19563
|
+
if (o && typeof o.length === "number") { return {
|
|
19564
|
+
next: function () {
|
|
19565
|
+
if (o && i >= o.length) { o = void 0; }
|
|
19566
|
+
return { value: o && o[i++], done: !o };
|
|
19567
|
+
}
|
|
19568
|
+
}; }
|
|
19569
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
19570
|
+
};
|
|
19571
|
+
var __read = (commonjsGlobal && commonjsGlobal.__read) || function (o, n) {
|
|
19572
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
19573
|
+
if (!m) { return o; }
|
|
19574
|
+
var i = m.call(o), r, ar = [], e;
|
|
19575
|
+
try {
|
|
19576
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) { ar.push(r.value); }
|
|
19577
|
+
}
|
|
19578
|
+
catch (error) { e = { error: error }; }
|
|
19579
|
+
finally {
|
|
19580
|
+
try {
|
|
19581
|
+
if (r && !r.done && (m = i["return"])) { m.call(i); }
|
|
19582
|
+
}
|
|
19583
|
+
finally { if (e) { throw e.error; } }
|
|
19584
|
+
}
|
|
19585
|
+
return ar;
|
|
19586
|
+
};
|
|
19587
|
+
Object.defineProperty(multimap, "__esModule", { value: true });
|
|
19588
|
+
multimap.Multimap = void 0;
|
|
19589
|
+
var Multimap = /** @class */ (function () {
|
|
19590
|
+
function Multimap(operator, iterable) {
|
|
19591
|
+
var e_1, _a;
|
|
19592
|
+
this.size_ = 0;
|
|
19593
|
+
this.map = new Map();
|
|
19594
|
+
this.operator = operator;
|
|
19595
|
+
if (iterable) {
|
|
19596
|
+
try {
|
|
19597
|
+
for (var iterable_1 = __values(iterable), iterable_1_1 = iterable_1.next(); !iterable_1_1.done; iterable_1_1 = iterable_1.next()) {
|
|
19598
|
+
var _b = __read(iterable_1_1.value, 2), key = _b[0], value = _b[1];
|
|
19599
|
+
this.put(key, value);
|
|
19600
|
+
}
|
|
19601
|
+
}
|
|
19602
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
19603
|
+
finally {
|
|
19604
|
+
try {
|
|
19605
|
+
if (iterable_1_1 && !iterable_1_1.done && (_a = iterable_1.return)) { _a.call(iterable_1); }
|
|
19606
|
+
}
|
|
19607
|
+
finally { if (e_1) { throw e_1.error; } }
|
|
19608
|
+
}
|
|
19609
|
+
}
|
|
19610
|
+
return this;
|
|
19611
|
+
}
|
|
19612
|
+
Object.defineProperty(Multimap.prototype, "size", {
|
|
19613
|
+
get: function () {
|
|
19614
|
+
return this.size_;
|
|
19615
|
+
},
|
|
19616
|
+
enumerable: false,
|
|
19617
|
+
configurable: true
|
|
19618
|
+
});
|
|
19619
|
+
Multimap.prototype.get = function (key) {
|
|
19620
|
+
var values = this.map.get(key);
|
|
19621
|
+
if (values) {
|
|
19622
|
+
return this.operator.clone(values);
|
|
19623
|
+
}
|
|
19624
|
+
else {
|
|
19625
|
+
return this.operator.create();
|
|
19626
|
+
}
|
|
19627
|
+
};
|
|
19628
|
+
Multimap.prototype.put = function (key, value) {
|
|
19629
|
+
var values = this.map.get(key);
|
|
19630
|
+
if (!values) {
|
|
19631
|
+
values = this.operator.create();
|
|
19632
|
+
}
|
|
19633
|
+
if (!this.operator.add(value, values)) {
|
|
19634
|
+
return false;
|
|
19635
|
+
}
|
|
19636
|
+
this.map.set(key, values);
|
|
19637
|
+
this.size_++;
|
|
19638
|
+
return true;
|
|
19639
|
+
};
|
|
19640
|
+
Multimap.prototype.putAll = function (arg1, arg2) {
|
|
19641
|
+
var e_2, _a, e_3, _b;
|
|
19642
|
+
var pushed = 0;
|
|
19643
|
+
if (arg2) {
|
|
19644
|
+
var key = arg1;
|
|
19645
|
+
var values = arg2;
|
|
19646
|
+
try {
|
|
19647
|
+
for (var values_1 = __values(values), values_1_1 = values_1.next(); !values_1_1.done; values_1_1 = values_1.next()) {
|
|
19648
|
+
var value = values_1_1.value;
|
|
19649
|
+
this.put(key, value);
|
|
19650
|
+
pushed++;
|
|
19651
|
+
}
|
|
19652
|
+
}
|
|
19653
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
19654
|
+
finally {
|
|
19655
|
+
try {
|
|
19656
|
+
if (values_1_1 && !values_1_1.done && (_a = values_1.return)) { _a.call(values_1); }
|
|
19657
|
+
}
|
|
19658
|
+
finally { if (e_2) { throw e_2.error; } }
|
|
19659
|
+
}
|
|
19660
|
+
}
|
|
19661
|
+
else if (arg1 instanceof Multimap) {
|
|
19662
|
+
try {
|
|
19663
|
+
for (var _c = __values(arg1.entries()), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
19664
|
+
var _e = __read(_d.value, 2), key = _e[0], value = _e[1];
|
|
19665
|
+
this.put(key, value);
|
|
19666
|
+
pushed++;
|
|
19667
|
+
}
|
|
19668
|
+
}
|
|
19669
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
19670
|
+
finally {
|
|
19671
|
+
try {
|
|
19672
|
+
if (_d && !_d.done && (_b = _c.return)) { _b.call(_c); }
|
|
19673
|
+
}
|
|
19674
|
+
finally { if (e_3) { throw e_3.error; } }
|
|
19675
|
+
}
|
|
19676
|
+
}
|
|
19677
|
+
else {
|
|
19678
|
+
throw new TypeError("unexpected arguments");
|
|
19679
|
+
}
|
|
19680
|
+
return pushed > 0;
|
|
19681
|
+
};
|
|
19682
|
+
Multimap.prototype.has = function (key) {
|
|
19683
|
+
return this.map.has(key);
|
|
19684
|
+
};
|
|
19685
|
+
Multimap.prototype.hasEntry = function (key, value) {
|
|
19686
|
+
return this.operator.has(value, this.get(key));
|
|
19687
|
+
};
|
|
19688
|
+
Multimap.prototype.delete = function (key) {
|
|
19689
|
+
this.size_ -= this.operator.size(this.get(key));
|
|
19690
|
+
return this.map.delete(key);
|
|
19691
|
+
};
|
|
19692
|
+
Multimap.prototype.deleteEntry = function (key, value) {
|
|
19693
|
+
var current = this.get(key);
|
|
19694
|
+
if (!this.operator.delete(value, current)) {
|
|
19695
|
+
return false;
|
|
19696
|
+
}
|
|
19697
|
+
this.map.set(key, current);
|
|
19698
|
+
this.size_--;
|
|
19699
|
+
return true;
|
|
19700
|
+
};
|
|
19701
|
+
Multimap.prototype.clear = function () {
|
|
19702
|
+
this.map.clear();
|
|
19703
|
+
this.size_ = 0;
|
|
19704
|
+
};
|
|
19705
|
+
Multimap.prototype.keys = function () {
|
|
19706
|
+
return this.map.keys();
|
|
19707
|
+
};
|
|
19708
|
+
Multimap.prototype.entries = function () {
|
|
19709
|
+
var self = this;
|
|
19710
|
+
function gen() {
|
|
19711
|
+
var _a, _b, _c, key, values, values_2, values_2_1, value, e_4_1, e_5_1;
|
|
19712
|
+
var e_5, _d, e_4, _e;
|
|
19713
|
+
return __generator(this, function (_f) {
|
|
19714
|
+
switch (_f.label) {
|
|
19715
|
+
case 0:
|
|
19716
|
+
_f.trys.push([0, 11, 12, 13]);
|
|
19717
|
+
_a = __values(self.map.entries()), _b = _a.next();
|
|
19718
|
+
_f.label = 1;
|
|
19719
|
+
case 1:
|
|
19720
|
+
if (!!_b.done) { return [3 /*break*/, 10]; }
|
|
19721
|
+
_c = __read(_b.value, 2), key = _c[0], values = _c[1];
|
|
19722
|
+
_f.label = 2;
|
|
19723
|
+
case 2:
|
|
19724
|
+
_f.trys.push([2, 7, 8, 9]);
|
|
19725
|
+
values_2 = (e_4 = void 0, __values(values)), values_2_1 = values_2.next();
|
|
19726
|
+
_f.label = 3;
|
|
19727
|
+
case 3:
|
|
19728
|
+
if (!!values_2_1.done) { return [3 /*break*/, 6]; }
|
|
19729
|
+
value = values_2_1.value;
|
|
19730
|
+
return [4 /*yield*/, [key, value]];
|
|
19731
|
+
case 4:
|
|
19732
|
+
_f.sent();
|
|
19733
|
+
_f.label = 5;
|
|
19734
|
+
case 5:
|
|
19735
|
+
values_2_1 = values_2.next();
|
|
19736
|
+
return [3 /*break*/, 3];
|
|
19737
|
+
case 6: return [3 /*break*/, 9];
|
|
19738
|
+
case 7:
|
|
19739
|
+
e_4_1 = _f.sent();
|
|
19740
|
+
e_4 = { error: e_4_1 };
|
|
19741
|
+
return [3 /*break*/, 9];
|
|
19742
|
+
case 8:
|
|
19743
|
+
try {
|
|
19744
|
+
if (values_2_1 && !values_2_1.done && (_e = values_2.return)) { _e.call(values_2); }
|
|
19745
|
+
}
|
|
19746
|
+
finally { if (e_4) { throw e_4.error; } }
|
|
19747
|
+
return [7 /*endfinally*/];
|
|
19748
|
+
case 9:
|
|
19749
|
+
_b = _a.next();
|
|
19750
|
+
return [3 /*break*/, 1];
|
|
19751
|
+
case 10: return [3 /*break*/, 13];
|
|
19752
|
+
case 11:
|
|
19753
|
+
e_5_1 = _f.sent();
|
|
19754
|
+
e_5 = { error: e_5_1 };
|
|
19755
|
+
return [3 /*break*/, 13];
|
|
19756
|
+
case 12:
|
|
19757
|
+
try {
|
|
19758
|
+
if (_b && !_b.done && (_d = _a.return)) { _d.call(_a); }
|
|
19759
|
+
}
|
|
19760
|
+
finally { if (e_5) { throw e_5.error; } }
|
|
19761
|
+
return [7 /*endfinally*/];
|
|
19762
|
+
case 13: return [2 /*return*/];
|
|
19763
|
+
}
|
|
19764
|
+
});
|
|
19765
|
+
}
|
|
19766
|
+
return gen();
|
|
19767
|
+
};
|
|
19768
|
+
Multimap.prototype.values = function () {
|
|
19769
|
+
var self = this;
|
|
19770
|
+
function gen() {
|
|
19771
|
+
var _a, _b, _c, value, e_6_1;
|
|
19772
|
+
var e_6, _d;
|
|
19773
|
+
return __generator(this, function (_e) {
|
|
19774
|
+
switch (_e.label) {
|
|
19775
|
+
case 0:
|
|
19776
|
+
_e.trys.push([0, 5, 6, 7]);
|
|
19777
|
+
_a = __values(self.entries()), _b = _a.next();
|
|
19778
|
+
_e.label = 1;
|
|
19779
|
+
case 1:
|
|
19780
|
+
if (!!_b.done) { return [3 /*break*/, 4]; }
|
|
19781
|
+
_c = __read(_b.value, 2), value = _c[1];
|
|
19782
|
+
return [4 /*yield*/, value];
|
|
19783
|
+
case 2:
|
|
19784
|
+
_e.sent();
|
|
19785
|
+
_e.label = 3;
|
|
19786
|
+
case 3:
|
|
19787
|
+
_b = _a.next();
|
|
19788
|
+
return [3 /*break*/, 1];
|
|
19789
|
+
case 4: return [3 /*break*/, 7];
|
|
19790
|
+
case 5:
|
|
19791
|
+
e_6_1 = _e.sent();
|
|
19792
|
+
e_6 = { error: e_6_1 };
|
|
19793
|
+
return [3 /*break*/, 7];
|
|
19794
|
+
case 6:
|
|
19795
|
+
try {
|
|
19796
|
+
if (_b && !_b.done && (_d = _a.return)) { _d.call(_a); }
|
|
19797
|
+
}
|
|
19798
|
+
finally { if (e_6) { throw e_6.error; } }
|
|
19799
|
+
return [7 /*endfinally*/];
|
|
19800
|
+
case 7: return [2 /*return*/];
|
|
19801
|
+
}
|
|
19802
|
+
});
|
|
19803
|
+
}
|
|
19804
|
+
return gen();
|
|
19805
|
+
};
|
|
19806
|
+
Multimap.prototype.forEach = function (callback, thisArg) {
|
|
19807
|
+
var e_7, _a;
|
|
19808
|
+
try {
|
|
19809
|
+
for (var _b = __values(this.entries()), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
19810
|
+
var _d = __read(_c.value, 2), key = _d[0], value = _d[1];
|
|
19811
|
+
callback.call(thisArg === undefined ? this : thisArg, value, key, this);
|
|
19812
|
+
}
|
|
19813
|
+
}
|
|
19814
|
+
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
19815
|
+
finally {
|
|
19816
|
+
try {
|
|
19817
|
+
if (_c && !_c.done && (_a = _b.return)) { _a.call(_b); }
|
|
19818
|
+
}
|
|
19819
|
+
finally { if (e_7) { throw e_7.error; } }
|
|
19820
|
+
}
|
|
19821
|
+
};
|
|
19822
|
+
Multimap.prototype[Symbol.iterator] = function () {
|
|
19823
|
+
return this.entries();
|
|
19824
|
+
};
|
|
19825
|
+
Multimap.prototype.asMap = function () {
|
|
19826
|
+
var e_8, _a;
|
|
19827
|
+
var ret = new Map();
|
|
19828
|
+
try {
|
|
19829
|
+
for (var _b = __values(this.keys()), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
19830
|
+
var key = _c.value;
|
|
19831
|
+
ret.set(key, this.operator.clone(this.get(key)));
|
|
19832
|
+
}
|
|
19833
|
+
}
|
|
19834
|
+
catch (e_8_1) { e_8 = { error: e_8_1 }; }
|
|
19835
|
+
finally {
|
|
19836
|
+
try {
|
|
19837
|
+
if (_c && !_c.done && (_a = _b.return)) { _a.call(_b); }
|
|
19838
|
+
}
|
|
19839
|
+
finally { if (e_8) { throw e_8.error; } }
|
|
19840
|
+
}
|
|
19841
|
+
return ret;
|
|
19842
|
+
};
|
|
19843
|
+
return Multimap;
|
|
19844
|
+
}());
|
|
19845
|
+
multimap.Multimap = Multimap;
|
|
19846
|
+
|
|
19847
|
+
var __extends$1 = (commonjsGlobal && commonjsGlobal.__extends) || (function () {
|
|
19848
|
+
var extendStatics = function (d, b) {
|
|
19849
|
+
extendStatics = Object.setPrototypeOf ||
|
|
19850
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
19851
|
+
function (d, b) { for (var p in b) { if (Object.prototype.hasOwnProperty.call(b, p)) { d[p] = b[p]; } } };
|
|
19852
|
+
return extendStatics(d, b);
|
|
19853
|
+
};
|
|
19854
|
+
return function (d, b) {
|
|
19855
|
+
extendStatics(d, b);
|
|
19856
|
+
function __() { this.constructor = d; }
|
|
19857
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
19858
|
+
};
|
|
19859
|
+
})();
|
|
19860
|
+
Object.defineProperty(arraymultimap, "__esModule", { value: true });
|
|
19861
|
+
arraymultimap.ArrayMultimap = void 0;
|
|
19862
|
+
var multimap_1$1 = multimap;
|
|
19863
|
+
var ArrayMultimap = /** @class */ (function (_super) {
|
|
19864
|
+
__extends$1(ArrayMultimap, _super);
|
|
19865
|
+
function ArrayMultimap(iterable) {
|
|
19866
|
+
return _super.call(this, new ArrayOperator(), iterable) || this;
|
|
19867
|
+
}
|
|
19868
|
+
Object.defineProperty(ArrayMultimap.prototype, Symbol.toStringTag, {
|
|
19869
|
+
get: function () {
|
|
19870
|
+
return "ArrayMultimap";
|
|
19871
|
+
},
|
|
19872
|
+
enumerable: false,
|
|
19873
|
+
configurable: true
|
|
19874
|
+
});
|
|
19875
|
+
return ArrayMultimap;
|
|
19876
|
+
}(multimap_1$1.Multimap));
|
|
19877
|
+
arraymultimap.ArrayMultimap = ArrayMultimap;
|
|
19878
|
+
var ArrayOperator = /** @class */ (function () {
|
|
19879
|
+
function ArrayOperator() {
|
|
19880
|
+
}
|
|
19881
|
+
ArrayOperator.prototype.create = function () {
|
|
19882
|
+
return [];
|
|
19883
|
+
};
|
|
19884
|
+
ArrayOperator.prototype.clone = function (collection) {
|
|
19885
|
+
return collection.slice();
|
|
19886
|
+
};
|
|
19887
|
+
ArrayOperator.prototype.add = function (value, collection) {
|
|
19888
|
+
collection.push(value);
|
|
19889
|
+
return true;
|
|
19890
|
+
};
|
|
19891
|
+
ArrayOperator.prototype.size = function (collection) {
|
|
19892
|
+
return collection.length;
|
|
19893
|
+
};
|
|
19894
|
+
ArrayOperator.prototype.delete = function (value, collection) {
|
|
19895
|
+
var index = collection.indexOf(value);
|
|
19896
|
+
if (index > -1) {
|
|
19897
|
+
collection.splice(index, 1);
|
|
19898
|
+
return true;
|
|
19899
|
+
}
|
|
19900
|
+
return false;
|
|
19901
|
+
};
|
|
19902
|
+
ArrayOperator.prototype.has = function (value, collection) {
|
|
19903
|
+
return collection.includes(value);
|
|
19904
|
+
};
|
|
19905
|
+
return ArrayOperator;
|
|
19906
|
+
}());
|
|
19907
|
+
|
|
19908
|
+
var setmultimap = {};
|
|
19909
|
+
|
|
19910
|
+
var __extends = (commonjsGlobal && commonjsGlobal.__extends) || (function () {
|
|
19911
|
+
var extendStatics = function (d, b) {
|
|
19912
|
+
extendStatics = Object.setPrototypeOf ||
|
|
19913
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
19914
|
+
function (d, b) { for (var p in b) { if (Object.prototype.hasOwnProperty.call(b, p)) { d[p] = b[p]; } } };
|
|
19915
|
+
return extendStatics(d, b);
|
|
19916
|
+
};
|
|
19917
|
+
return function (d, b) {
|
|
19918
|
+
extendStatics(d, b);
|
|
19919
|
+
function __() { this.constructor = d; }
|
|
19920
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
19921
|
+
};
|
|
19922
|
+
})();
|
|
19923
|
+
Object.defineProperty(setmultimap, "__esModule", { value: true });
|
|
19924
|
+
setmultimap.SetMultimap = void 0;
|
|
19925
|
+
var multimap_1 = multimap;
|
|
19926
|
+
var SetMultimap = /** @class */ (function (_super) {
|
|
19927
|
+
__extends(SetMultimap, _super);
|
|
19928
|
+
function SetMultimap(iterable) {
|
|
19929
|
+
return _super.call(this, new SetOperator(), iterable) || this;
|
|
19930
|
+
}
|
|
19931
|
+
Object.defineProperty(SetMultimap.prototype, Symbol.toStringTag, {
|
|
19932
|
+
get: function () {
|
|
19933
|
+
return "SetMultimap";
|
|
19934
|
+
},
|
|
19935
|
+
enumerable: false,
|
|
19936
|
+
configurable: true
|
|
19937
|
+
});
|
|
19938
|
+
return SetMultimap;
|
|
19939
|
+
}(multimap_1.Multimap));
|
|
19940
|
+
setmultimap.SetMultimap = SetMultimap;
|
|
19941
|
+
var SetOperator = /** @class */ (function () {
|
|
19942
|
+
function SetOperator() {
|
|
19943
|
+
}
|
|
19944
|
+
SetOperator.prototype.create = function () {
|
|
19945
|
+
return new Set();
|
|
19946
|
+
};
|
|
19947
|
+
SetOperator.prototype.clone = function (collection) {
|
|
19948
|
+
return new Set(collection);
|
|
19949
|
+
};
|
|
19950
|
+
SetOperator.prototype.add = function (value, collection) {
|
|
19951
|
+
var prev = collection.size;
|
|
19952
|
+
collection.add(value);
|
|
19953
|
+
return prev !== collection.size;
|
|
19954
|
+
};
|
|
19955
|
+
SetOperator.prototype.size = function (collection) {
|
|
19956
|
+
return collection.size;
|
|
19957
|
+
};
|
|
19958
|
+
SetOperator.prototype.delete = function (value, collection) {
|
|
19959
|
+
return collection.delete(value);
|
|
19960
|
+
};
|
|
19961
|
+
SetOperator.prototype.has = function (value, collection) {
|
|
19962
|
+
return collection.has(value);
|
|
19963
|
+
};
|
|
19964
|
+
return SetOperator;
|
|
19965
|
+
}());
|
|
19966
|
+
|
|
19967
|
+
(function (exports) {
|
|
19968
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19969
|
+
exports.SetMultimap = exports.ArrayMultimap = void 0;
|
|
19970
|
+
var arraymultimap_1 = arraymultimap;
|
|
19971
|
+
Object.defineProperty(exports, "ArrayMultimap", { enumerable: true, get: function () { return arraymultimap_1.ArrayMultimap; } });
|
|
19972
|
+
var setmultimap_1 = setmultimap;
|
|
19973
|
+
Object.defineProperty(exports, "SetMultimap", { enumerable: true, get: function () { return setmultimap_1.SetMultimap; } });
|
|
19974
|
+
}(src));
|
|
19975
|
+
|
|
19526
19976
|
/**
|
|
19527
19977
|
* a basic texture cache object
|
|
19528
19978
|
* @ignore
|
|
19529
19979
|
*/
|
|
19530
19980
|
var TextureCache = function TextureCache(max_size) {
|
|
19531
|
-
|
|
19981
|
+
// cache uses an array to allow for duplicated key
|
|
19982
|
+
this.cache = new src.ArrayMultimap();
|
|
19532
19983
|
this.tinted = new Map();
|
|
19533
19984
|
this.units = new Map();
|
|
19534
19985
|
this.max_size = max_size || Infinity;
|
|
@@ -19562,13 +20013,29 @@
|
|
|
19562
20013
|
* @ignore
|
|
19563
20014
|
*/
|
|
19564
20015
|
TextureCache.prototype.get = function get (image, atlas) {
|
|
19565
|
-
|
|
20016
|
+
var entry;
|
|
20017
|
+
|
|
20018
|
+
if (typeof atlas === "undefined") {
|
|
20019
|
+
entry = this.cache.get(image)[0];
|
|
20020
|
+
} else {
|
|
20021
|
+
// manage cases where a specific atlas is specified
|
|
20022
|
+
this.cache.forEach(function (value, key) {
|
|
20023
|
+
var _atlas = value.getAtlas();
|
|
20024
|
+
if (key === image && _atlas[0].width === atlas.framewidth && _atlas[0].height === atlas.frameheight) {
|
|
20025
|
+
entry = value;
|
|
20026
|
+
}
|
|
20027
|
+
});
|
|
20028
|
+
}
|
|
20029
|
+
|
|
20030
|
+
if (typeof entry === "undefined") {
|
|
19566
20031
|
if (!atlas) {
|
|
19567
20032
|
atlas = createAtlas(image.width, image.height, image.src ? getBasename(image.src) : undefined);
|
|
19568
20033
|
}
|
|
19569
|
-
|
|
20034
|
+
entry = new TextureAtlas(atlas, image, false);
|
|
20035
|
+
this.set(image, entry);
|
|
19570
20036
|
}
|
|
19571
|
-
|
|
20037
|
+
|
|
20038
|
+
return entry;
|
|
19572
20039
|
};
|
|
19573
20040
|
|
|
19574
20041
|
/**
|
|
@@ -19613,7 +20080,7 @@
|
|
|
19613
20080
|
"(" + width + "x" + height + ")"
|
|
19614
20081
|
);
|
|
19615
20082
|
}
|
|
19616
|
-
this.cache.
|
|
20083
|
+
return this.cache.put(image, texture);
|
|
19617
20084
|
};
|
|
19618
20085
|
|
|
19619
20086
|
/**
|
|
@@ -25425,6 +25892,8 @@
|
|
|
25425
25892
|
if (isCollisionGroup && !settings.name && obj.body) {
|
|
25426
25893
|
// configure the body accordingly
|
|
25427
25894
|
obj.body.collisionType = collision.types.WORLD_SHAPE;
|
|
25895
|
+
// mark collision shapes as static
|
|
25896
|
+
obj.body.isStatic = true;
|
|
25428
25897
|
}
|
|
25429
25898
|
|
|
25430
25899
|
//apply group opacity value to the child objects if group are merged
|
|
@@ -29163,6 +29632,17 @@
|
|
|
29163
29632
|
return this.currentTextureUnit;
|
|
29164
29633
|
};
|
|
29165
29634
|
|
|
29635
|
+
/**
|
|
29636
|
+
* set/change the current projection matrix
|
|
29637
|
+
* @name setProjection
|
|
29638
|
+
* @memberof WebGLCompositor
|
|
29639
|
+
* @function
|
|
29640
|
+
* @param {Matrix3d} matrix
|
|
29641
|
+
*/
|
|
29642
|
+
WebGLCompositor.prototype.setProjection = function setProjection (matrix) {
|
|
29643
|
+
this.activeShader.setUniform("uProjectionMatrix", matrix);
|
|
29644
|
+
};
|
|
29645
|
+
|
|
29166
29646
|
/**
|
|
29167
29647
|
* Select the shader to use for compositing
|
|
29168
29648
|
* @name useShader
|
|
@@ -29639,6 +30119,18 @@
|
|
|
29639
30119
|
this.currentCompositor.flush();
|
|
29640
30120
|
};
|
|
29641
30121
|
|
|
30122
|
+
/**
|
|
30123
|
+
* set/change the current projection matrix (WebGL only)
|
|
30124
|
+
* @name setProjection
|
|
30125
|
+
* @memberof WebGLRenderer.prototype
|
|
30126
|
+
* @function
|
|
30127
|
+
* @param {Matrix3d} matrix
|
|
30128
|
+
*/
|
|
30129
|
+
WebGLRenderer.prototype.setProjection = function setProjection (matrix) {
|
|
30130
|
+
Renderer.prototype.setProjection.call(this, matrix);
|
|
30131
|
+
this.currentCompositor.setProjection(matrix);
|
|
30132
|
+
};
|
|
30133
|
+
|
|
29642
30134
|
/**
|
|
29643
30135
|
* Clears the gl context with the given color.
|
|
29644
30136
|
* @name clearColor
|
|
@@ -30752,7 +31244,7 @@
|
|
|
30752
31244
|
|
|
30753
31245
|
// default scaled size value
|
|
30754
31246
|
settings.zoomX = width * scaleRatio.x;
|
|
30755
|
-
settings.zoomY =
|
|
31247
|
+
settings.zoomY = height * scaleRatio.y;
|
|
30756
31248
|
|
|
30757
31249
|
//add a channel for the onresize/onorientationchange event
|
|
30758
31250
|
window.addEventListener(
|
|
@@ -31430,10 +31922,10 @@
|
|
|
31430
31922
|
* this can be overridden by the plugin
|
|
31431
31923
|
* @public
|
|
31432
31924
|
* @type {string}
|
|
31433
|
-
* @default "10.
|
|
31925
|
+
* @default "10.5.2"
|
|
31434
31926
|
* @name plugin.Base#version
|
|
31435
31927
|
*/
|
|
31436
|
-
this.version = "10.
|
|
31928
|
+
this.version = "10.5.2";
|
|
31437
31929
|
};
|
|
31438
31930
|
|
|
31439
31931
|
/**
|
|
@@ -34459,6 +34951,227 @@
|
|
|
34459
34951
|
return Trigger;
|
|
34460
34952
|
}(Renderable));
|
|
34461
34953
|
|
|
34954
|
+
/**
|
|
34955
|
+
* @classdesc
|
|
34956
|
+
* A Draggable base object
|
|
34957
|
+
* @see DropTarget
|
|
34958
|
+
* @augments Renderable
|
|
34959
|
+
*/
|
|
34960
|
+
var Draggable = /*@__PURE__*/(function (Renderable) {
|
|
34961
|
+
function Draggable(x, y, width, height) {
|
|
34962
|
+
Renderable.call(this, x, y, width, height);
|
|
34963
|
+
this.isKinematic = false;
|
|
34964
|
+
this.dragging = false;
|
|
34965
|
+
this.dragId = null;
|
|
34966
|
+
this.grabOffset = new Vector2d(0, 0);
|
|
34967
|
+
this.initEvents();
|
|
34968
|
+
}
|
|
34969
|
+
|
|
34970
|
+
if ( Renderable ) Draggable.__proto__ = Renderable;
|
|
34971
|
+
Draggable.prototype = Object.create( Renderable && Renderable.prototype );
|
|
34972
|
+
Draggable.prototype.constructor = Draggable;
|
|
34973
|
+
|
|
34974
|
+
/**
|
|
34975
|
+
* Initializes the events the modules needs to listen to
|
|
34976
|
+
* It translates the pointer events to me.events
|
|
34977
|
+
* in order to make them pass through the system and to make
|
|
34978
|
+
* this module testable. Then we subscribe this module to the
|
|
34979
|
+
* transformed events.
|
|
34980
|
+
* @name initEvents
|
|
34981
|
+
* @memberof Draggable
|
|
34982
|
+
* @function
|
|
34983
|
+
* @private
|
|
34984
|
+
*/
|
|
34985
|
+
Draggable.prototype.initEvents = function initEvents () {
|
|
34986
|
+
var this$1$1 = this;
|
|
34987
|
+
|
|
34988
|
+
registerPointerEvent("pointerdown", this, function (e) { emit(DRAGSTART, e, this$1$1); });
|
|
34989
|
+
registerPointerEvent("pointerup", this, function (e) { emit(DRAGEND, e, this$1$1); });
|
|
34990
|
+
registerPointerEvent("pointercancel", this, function (e) { emit(DRAGEND, e, this$1$1); });
|
|
34991
|
+
on(POINTERMOVE, this.dragMove.bind(this));
|
|
34992
|
+
on(DRAGSTART, function (e, draggable) {
|
|
34993
|
+
if (draggable === this$1$1) {
|
|
34994
|
+
this$1$1.dragStart(e);
|
|
34995
|
+
}
|
|
34996
|
+
});
|
|
34997
|
+
on(DRAGEND, function (e, draggable) {
|
|
34998
|
+
if (draggable === this$1$1) {
|
|
34999
|
+
this$1$1.dragEnd(e);
|
|
35000
|
+
}
|
|
35001
|
+
});
|
|
35002
|
+
};
|
|
35003
|
+
|
|
35004
|
+
/**
|
|
35005
|
+
* Gets called when the user starts dragging the entity
|
|
35006
|
+
* @name dragStart
|
|
35007
|
+
* @memberof Draggable
|
|
35008
|
+
* @function
|
|
35009
|
+
* @param {object} e the pointer event
|
|
35010
|
+
* @returns {boolean} false if the object is being dragged
|
|
35011
|
+
*/
|
|
35012
|
+
Draggable.prototype.dragStart = function dragStart (e) {
|
|
35013
|
+
if (this.dragging === false) {
|
|
35014
|
+
this.dragging = true;
|
|
35015
|
+
this.grabOffset.set(e.gameX, e.gameY);
|
|
35016
|
+
this.grabOffset.sub(this.pos);
|
|
35017
|
+
return false;
|
|
35018
|
+
}
|
|
35019
|
+
};
|
|
35020
|
+
|
|
35021
|
+
/**
|
|
35022
|
+
* Gets called when the user drags this entity around
|
|
35023
|
+
* @name dragMove
|
|
35024
|
+
* @memberof Draggable
|
|
35025
|
+
* @function
|
|
35026
|
+
* @param {object} e the pointer event
|
|
35027
|
+
*/
|
|
35028
|
+
Draggable.prototype.dragMove = function dragMove (e) {
|
|
35029
|
+
if (this.dragging === true) {
|
|
35030
|
+
this.pos.set(e.gameX, e.gameY, this.pos.z); //TODO : z ?
|
|
35031
|
+
this.pos.sub(this.grabOffset);
|
|
35032
|
+
}
|
|
35033
|
+
};
|
|
35034
|
+
|
|
35035
|
+
/**
|
|
35036
|
+
* Gets called when the user stops dragging the entity
|
|
35037
|
+
* @name dragEnd
|
|
35038
|
+
* @memberof Draggable
|
|
35039
|
+
* @function
|
|
35040
|
+
* @returns {boolean} false if the object stopped being dragged
|
|
35041
|
+
*/
|
|
35042
|
+
Draggable.prototype.dragEnd = function dragEnd () {
|
|
35043
|
+
if (this.dragging === true) {
|
|
35044
|
+
this.dragging = false;
|
|
35045
|
+
return false;
|
|
35046
|
+
}
|
|
35047
|
+
};
|
|
35048
|
+
|
|
35049
|
+
/**
|
|
35050
|
+
* Destructor
|
|
35051
|
+
* @name destroy
|
|
35052
|
+
* @memberof Draggable
|
|
35053
|
+
* @function
|
|
35054
|
+
* @ignore
|
|
35055
|
+
*/
|
|
35056
|
+
Draggable.prototype.destroy = function destroy () {
|
|
35057
|
+
off(POINTERMOVE, this.dragMove);
|
|
35058
|
+
off(DRAGSTART, this.dragStart);
|
|
35059
|
+
off(DRAGEND, this.dragEnd);
|
|
35060
|
+
releasePointerEvent("pointerdown", this);
|
|
35061
|
+
releasePointerEvent("pointerup", this);
|
|
35062
|
+
releasePointerEvent("pointercancel", this);
|
|
35063
|
+
Renderable.prototype.destroy.call(this);
|
|
35064
|
+
};
|
|
35065
|
+
|
|
35066
|
+
return Draggable;
|
|
35067
|
+
}(Renderable));
|
|
35068
|
+
/**
|
|
35069
|
+
* @classdesc
|
|
35070
|
+
* a base drop target object
|
|
35071
|
+
* @see Draggable
|
|
35072
|
+
* @augments Renderable
|
|
35073
|
+
*/
|
|
35074
|
+
var DropTarget = /*@__PURE__*/(function (Renderable) {
|
|
35075
|
+
function DropTarget(x, y, width, height) {
|
|
35076
|
+
Renderable.call(this, x, y, width, height);
|
|
35077
|
+
|
|
35078
|
+
this.isKinematic = false;
|
|
35079
|
+
|
|
35080
|
+
/**
|
|
35081
|
+
* constant for the overlaps method
|
|
35082
|
+
* @public
|
|
35083
|
+
* @constant
|
|
35084
|
+
* @type {string}
|
|
35085
|
+
* @name CHECKMETHOD_OVERLAP
|
|
35086
|
+
* @memberof DropTarget
|
|
35087
|
+
*/
|
|
35088
|
+
this.CHECKMETHOD_OVERLAP = "overlaps";
|
|
35089
|
+
|
|
35090
|
+
/**
|
|
35091
|
+
* constant for the contains method
|
|
35092
|
+
* @public
|
|
35093
|
+
* @constant
|
|
35094
|
+
* @type {string}
|
|
35095
|
+
* @name CHECKMETHOD_CONTAINS
|
|
35096
|
+
* @memberof DropTarget
|
|
35097
|
+
*/
|
|
35098
|
+
this.CHECKMETHOD_CONTAINS = "contains";
|
|
35099
|
+
|
|
35100
|
+
/**
|
|
35101
|
+
* the checkmethod we want to use
|
|
35102
|
+
* @public
|
|
35103
|
+
* @constant
|
|
35104
|
+
* @type {string}
|
|
35105
|
+
* @name checkMethod
|
|
35106
|
+
* @default "overlaps"
|
|
35107
|
+
* @memberof DropTarget
|
|
35108
|
+
*/
|
|
35109
|
+
this.checkMethod = this.CHECKMETHOD_OVERLAP;
|
|
35110
|
+
|
|
35111
|
+
on(DRAGEND, this.checkOnMe, this);
|
|
35112
|
+
|
|
35113
|
+
}
|
|
35114
|
+
|
|
35115
|
+
if ( Renderable ) DropTarget.__proto__ = Renderable;
|
|
35116
|
+
DropTarget.prototype = Object.create( Renderable && Renderable.prototype );
|
|
35117
|
+
DropTarget.prototype.constructor = DropTarget;
|
|
35118
|
+
|
|
35119
|
+
/**
|
|
35120
|
+
* Sets the collision method which is going to be used to check a valid drop
|
|
35121
|
+
* @name setCheckMethod
|
|
35122
|
+
* @memberof DropTarget
|
|
35123
|
+
* @function
|
|
35124
|
+
* @param {string} checkMethod the checkmethod (defaults to CHECKMETHOD_OVERLAP)
|
|
35125
|
+
*/
|
|
35126
|
+
DropTarget.prototype.setCheckMethod = function setCheckMethod (checkMethod) {
|
|
35127
|
+
// We can improve this check,
|
|
35128
|
+
// because now you can use every method in theory
|
|
35129
|
+
if (typeof(this.getBounds()[this.checkMethod]) === "function") {
|
|
35130
|
+
this.checkMethod = checkMethod;
|
|
35131
|
+
}
|
|
35132
|
+
};
|
|
35133
|
+
|
|
35134
|
+
/**
|
|
35135
|
+
* Checks if a dropped entity is dropped on the current entity
|
|
35136
|
+
* @name checkOnMe
|
|
35137
|
+
* @memberof DropTarget
|
|
35138
|
+
* @function
|
|
35139
|
+
* @param {object} e the triggering event
|
|
35140
|
+
* @param {Draggable} draggable the draggable object that is dropped
|
|
35141
|
+
*/
|
|
35142
|
+
DropTarget.prototype.checkOnMe = function checkOnMe (e, draggable) {
|
|
35143
|
+
if (draggable && this.getBounds()[this.checkMethod](draggable.getBounds())) {
|
|
35144
|
+
// call the drop method on the current entity
|
|
35145
|
+
this.drop(draggable);
|
|
35146
|
+
}
|
|
35147
|
+
};
|
|
35148
|
+
|
|
35149
|
+
/**
|
|
35150
|
+
* Gets called when a draggable entity is dropped on the current entity
|
|
35151
|
+
* @name drop
|
|
35152
|
+
* @memberof DropTarget
|
|
35153
|
+
* @function
|
|
35154
|
+
* @param {Draggable} draggable the draggable object that is dropped
|
|
35155
|
+
*/
|
|
35156
|
+
DropTarget.prototype.drop = function drop () {
|
|
35157
|
+
|
|
35158
|
+
};
|
|
35159
|
+
|
|
35160
|
+
/**
|
|
35161
|
+
* Destructor
|
|
35162
|
+
* @name destroy
|
|
35163
|
+
* @memberof DropTarget
|
|
35164
|
+
* @function
|
|
35165
|
+
* @ignore
|
|
35166
|
+
*/
|
|
35167
|
+
DropTarget.prototype.destroy = function destroy () {
|
|
35168
|
+
off(DRAGEND, this.checkOnMe);
|
|
35169
|
+
Renderable.prototype.destroy.call(this);
|
|
35170
|
+
};
|
|
35171
|
+
|
|
35172
|
+
return DropTarget;
|
|
35173
|
+
}(Renderable));
|
|
35174
|
+
|
|
34462
35175
|
/**
|
|
34463
35176
|
* @classdesc
|
|
34464
35177
|
* Particle Container Object.
|
|
@@ -35517,228 +36230,6 @@
|
|
|
35517
36230
|
return Entity;
|
|
35518
36231
|
}(Renderable));
|
|
35519
36232
|
|
|
35520
|
-
/**
|
|
35521
|
-
* @classdesc
|
|
35522
|
-
* Used to make a game entity draggable
|
|
35523
|
-
* @augments Entity
|
|
35524
|
-
*/
|
|
35525
|
-
var DraggableEntity = /*@__PURE__*/(function (Entity) {
|
|
35526
|
-
function DraggableEntity(x, y, settings) {
|
|
35527
|
-
Entity.call(this, x, y, settings);
|
|
35528
|
-
this.dragging = false;
|
|
35529
|
-
this.dragId = null;
|
|
35530
|
-
this.grabOffset = new Vector2d(0, 0);
|
|
35531
|
-
this.onPointerEvent = registerPointerEvent;
|
|
35532
|
-
this.removePointerEvent = releasePointerEvent;
|
|
35533
|
-
this.initEvents();
|
|
35534
|
-
}
|
|
35535
|
-
|
|
35536
|
-
if ( Entity ) DraggableEntity.__proto__ = Entity;
|
|
35537
|
-
DraggableEntity.prototype = Object.create( Entity && Entity.prototype );
|
|
35538
|
-
DraggableEntity.prototype.constructor = DraggableEntity;
|
|
35539
|
-
|
|
35540
|
-
/**
|
|
35541
|
-
* Initializes the events the modules needs to listen to
|
|
35542
|
-
* It translates the pointer events to me.events
|
|
35543
|
-
* in order to make them pass through the system and to make
|
|
35544
|
-
* this module testable. Then we subscribe this module to the
|
|
35545
|
-
* transformed events.
|
|
35546
|
-
* @name initEvents
|
|
35547
|
-
* @memberof DraggableEntity
|
|
35548
|
-
* @function
|
|
35549
|
-
*/
|
|
35550
|
-
DraggableEntity.prototype.initEvents = function initEvents () {
|
|
35551
|
-
/**
|
|
35552
|
-
* @ignore
|
|
35553
|
-
*/
|
|
35554
|
-
this.mouseDown = function (e) {
|
|
35555
|
-
this.translatePointerEvent(e, DRAGSTART);
|
|
35556
|
-
};
|
|
35557
|
-
/**
|
|
35558
|
-
* @ignore
|
|
35559
|
-
*/
|
|
35560
|
-
this.mouseUp = function (e) {
|
|
35561
|
-
this.translatePointerEvent(e, DRAGEND);
|
|
35562
|
-
};
|
|
35563
|
-
this.onPointerEvent("pointerdown", this, this.mouseDown.bind(this));
|
|
35564
|
-
this.onPointerEvent("pointerup", this, this.mouseUp.bind(this));
|
|
35565
|
-
this.onPointerEvent("pointercancel", this, this.mouseUp.bind(this));
|
|
35566
|
-
on(POINTERMOVE, this.dragMove, this);
|
|
35567
|
-
on(DRAGSTART, this.dragStart, this);
|
|
35568
|
-
on(DRAGEND, this.dragEnd, this);
|
|
35569
|
-
};
|
|
35570
|
-
|
|
35571
|
-
/**
|
|
35572
|
-
* Translates a pointer event to a me.event
|
|
35573
|
-
* @name translatePointerEvent
|
|
35574
|
-
* @memberof DraggableEntity
|
|
35575
|
-
* @function
|
|
35576
|
-
* @param {object} e the pointer event you want to translate
|
|
35577
|
-
* @param {string} translation the me.event you want to translate the event to
|
|
35578
|
-
*/
|
|
35579
|
-
DraggableEntity.prototype.translatePointerEvent = function translatePointerEvent (e, translation) {
|
|
35580
|
-
emit(translation, e);
|
|
35581
|
-
};
|
|
35582
|
-
|
|
35583
|
-
/**
|
|
35584
|
-
* Gets called when the user starts dragging the entity
|
|
35585
|
-
* @name dragStart
|
|
35586
|
-
* @memberof DraggableEntity
|
|
35587
|
-
* @function
|
|
35588
|
-
* @param {object} e the pointer event
|
|
35589
|
-
* @returns {boolean} false if the object is being dragged
|
|
35590
|
-
*/
|
|
35591
|
-
DraggableEntity.prototype.dragStart = function dragStart (e) {
|
|
35592
|
-
if (this.dragging === false) {
|
|
35593
|
-
this.dragging = true;
|
|
35594
|
-
this.grabOffset.set(e.gameX, e.gameY);
|
|
35595
|
-
this.grabOffset.sub(this.pos);
|
|
35596
|
-
return false;
|
|
35597
|
-
}
|
|
35598
|
-
};
|
|
35599
|
-
|
|
35600
|
-
/**
|
|
35601
|
-
* Gets called when the user drags this entity around
|
|
35602
|
-
* @name dragMove
|
|
35603
|
-
* @memberof DraggableEntity
|
|
35604
|
-
* @function
|
|
35605
|
-
* @param {object} e the pointer event
|
|
35606
|
-
*/
|
|
35607
|
-
DraggableEntity.prototype.dragMove = function dragMove (e) {
|
|
35608
|
-
if (this.dragging === true) {
|
|
35609
|
-
this.pos.set(e.gameX, e.gameY, this.pos.z); //TODO : z ?
|
|
35610
|
-
this.pos.sub(this.grabOffset);
|
|
35611
|
-
}
|
|
35612
|
-
};
|
|
35613
|
-
|
|
35614
|
-
/**
|
|
35615
|
-
* Gets called when the user stops dragging the entity
|
|
35616
|
-
* @name dragEnd
|
|
35617
|
-
* @memberof DraggableEntity
|
|
35618
|
-
* @function
|
|
35619
|
-
* @returns {boolean} false if the object stopped being dragged
|
|
35620
|
-
*/
|
|
35621
|
-
DraggableEntity.prototype.dragEnd = function dragEnd () {
|
|
35622
|
-
if (this.dragging === true) {
|
|
35623
|
-
this.dragging = false;
|
|
35624
|
-
return false;
|
|
35625
|
-
}
|
|
35626
|
-
};
|
|
35627
|
-
|
|
35628
|
-
/**
|
|
35629
|
-
* Destructor
|
|
35630
|
-
* @name destroy
|
|
35631
|
-
* @memberof DraggableEntity
|
|
35632
|
-
* @function
|
|
35633
|
-
*/
|
|
35634
|
-
DraggableEntity.prototype.destroy = function destroy () {
|
|
35635
|
-
off(POINTERMOVE, this.dragMove);
|
|
35636
|
-
off(DRAGSTART, this.dragStart);
|
|
35637
|
-
off(DRAGEND, this.dragEnd);
|
|
35638
|
-
this.removePointerEvent("pointerdown", this);
|
|
35639
|
-
this.removePointerEvent("pointerup", this);
|
|
35640
|
-
};
|
|
35641
|
-
|
|
35642
|
-
return DraggableEntity;
|
|
35643
|
-
}(Entity));
|
|
35644
|
-
|
|
35645
|
-
/**
|
|
35646
|
-
* @classdesc
|
|
35647
|
-
* Used to make a game entity a droptarget
|
|
35648
|
-
* @augments Entity
|
|
35649
|
-
*/
|
|
35650
|
-
var DroptargetEntity = /*@__PURE__*/(function (Entity) {
|
|
35651
|
-
function DroptargetEntity(x, y, settings) {
|
|
35652
|
-
Entity.call(this, x, y, settings);
|
|
35653
|
-
/**
|
|
35654
|
-
* constant for the overlaps method
|
|
35655
|
-
* @public
|
|
35656
|
-
* @constant
|
|
35657
|
-
* @type {string}
|
|
35658
|
-
* @name CHECKMETHOD_OVERLAP
|
|
35659
|
-
* @memberof DroptargetEntity
|
|
35660
|
-
*/
|
|
35661
|
-
this.CHECKMETHOD_OVERLAP = "overlaps";
|
|
35662
|
-
/**
|
|
35663
|
-
* constant for the contains method
|
|
35664
|
-
* @public
|
|
35665
|
-
* @constant
|
|
35666
|
-
* @type {string}
|
|
35667
|
-
* @name CHECKMETHOD_CONTAINS
|
|
35668
|
-
* @memberof DroptargetEntity
|
|
35669
|
-
*/
|
|
35670
|
-
this.CHECKMETHOD_CONTAINS = "contains";
|
|
35671
|
-
/**
|
|
35672
|
-
* the checkmethod we want to use
|
|
35673
|
-
* @public
|
|
35674
|
-
* @constant
|
|
35675
|
-
* @type {string}
|
|
35676
|
-
* @name checkMethod
|
|
35677
|
-
* @memberof DroptargetEntity
|
|
35678
|
-
*/
|
|
35679
|
-
this.checkMethod = null;
|
|
35680
|
-
on(DRAGEND, this.checkOnMe, this);
|
|
35681
|
-
this.checkMethod = this[this.CHECKMETHOD_OVERLAP];
|
|
35682
|
-
}
|
|
35683
|
-
|
|
35684
|
-
if ( Entity ) DroptargetEntity.__proto__ = Entity;
|
|
35685
|
-
DroptargetEntity.prototype = Object.create( Entity && Entity.prototype );
|
|
35686
|
-
DroptargetEntity.prototype.constructor = DroptargetEntity;
|
|
35687
|
-
|
|
35688
|
-
/**
|
|
35689
|
-
* Sets the collision method which is going to be used to check a valid drop
|
|
35690
|
-
* @name setCheckMethod
|
|
35691
|
-
* @memberof DroptargetEntity
|
|
35692
|
-
* @function
|
|
35693
|
-
* @param {string} checkMethod the checkmethod (defaults to CHECKMETHOD_OVERLAP)
|
|
35694
|
-
*/
|
|
35695
|
-
DroptargetEntity.prototype.setCheckMethod = function setCheckMethod (checkMethod) {
|
|
35696
|
-
// We can improve this check,
|
|
35697
|
-
// because now you can use every method in theory
|
|
35698
|
-
if (typeof(this[checkMethod]) !== "undefined") {
|
|
35699
|
-
this.checkMethod = this[checkMethod];
|
|
35700
|
-
}
|
|
35701
|
-
};
|
|
35702
|
-
|
|
35703
|
-
/**
|
|
35704
|
-
* Checks if a dropped entity is dropped on the current entity
|
|
35705
|
-
* @name checkOnMe
|
|
35706
|
-
* @memberof DroptargetEntity
|
|
35707
|
-
* @function
|
|
35708
|
-
* @param {object} e the triggering event
|
|
35709
|
-
* @param {object} draggableEntity the draggable entity that is dropped
|
|
35710
|
-
*/
|
|
35711
|
-
DroptargetEntity.prototype.checkOnMe = function checkOnMe (e, draggableEntity) {
|
|
35712
|
-
if (draggableEntity && this.checkMethod(draggableEntity.getBounds())) {
|
|
35713
|
-
// call the drop method on the current entity
|
|
35714
|
-
this.drop(draggableEntity);
|
|
35715
|
-
}
|
|
35716
|
-
};
|
|
35717
|
-
|
|
35718
|
-
/**
|
|
35719
|
-
* Gets called when a draggable entity is dropped on the current entity
|
|
35720
|
-
* @name drop
|
|
35721
|
-
* @memberof DroptargetEntity
|
|
35722
|
-
* @function
|
|
35723
|
-
* @param {object} draggableEntity the draggable entity that is dropped
|
|
35724
|
-
*/
|
|
35725
|
-
DroptargetEntity.prototype.drop = function drop () {
|
|
35726
|
-
|
|
35727
|
-
};
|
|
35728
|
-
|
|
35729
|
-
/**
|
|
35730
|
-
* Destructor
|
|
35731
|
-
* @name destroy
|
|
35732
|
-
* @memberof DroptargetEntity
|
|
35733
|
-
* @function
|
|
35734
|
-
*/
|
|
35735
|
-
DroptargetEntity.prototype.destroy = function destroy () {
|
|
35736
|
-
off(DRAGEND, this.checkOnMe);
|
|
35737
|
-
};
|
|
35738
|
-
|
|
35739
|
-
return DroptargetEntity;
|
|
35740
|
-
}(Entity));
|
|
35741
|
-
|
|
35742
36233
|
/**
|
|
35743
36234
|
* placeholder for all deprecated classes and corresponding alias for backward compatibility
|
|
35744
36235
|
*/
|
|
@@ -35822,13 +36313,50 @@
|
|
|
35822
36313
|
}
|
|
35823
36314
|
});
|
|
35824
36315
|
|
|
35825
|
-
|
|
35826
|
-
|
|
35827
|
-
|
|
35828
|
-
|
|
36316
|
+
|
|
36317
|
+
/**
|
|
36318
|
+
* @classdesc
|
|
36319
|
+
* Used to make a game entity draggable
|
|
36320
|
+
* @augments Entity
|
|
36321
|
+
* @deprecated since 10.5.0
|
|
36322
|
+
* @see Draggable
|
|
36323
|
+
*/
|
|
36324
|
+
var DraggableEntity = /*@__PURE__*/(function (Draggable) {
|
|
36325
|
+
function DraggableEntity(x, y, settings) {
|
|
36326
|
+
warning("DraggableEntity", "Draggable", "10.5.0");
|
|
36327
|
+
Draggable.call(this, x, y, settings.width, settings.height);
|
|
36328
|
+
}
|
|
36329
|
+
|
|
36330
|
+
if ( Draggable ) DraggableEntity.__proto__ = Draggable;
|
|
36331
|
+
DraggableEntity.prototype = Object.create( Draggable && Draggable.prototype );
|
|
36332
|
+
DraggableEntity.prototype.constructor = DraggableEntity;
|
|
36333
|
+
|
|
36334
|
+
return DraggableEntity;
|
|
36335
|
+
}(Draggable));
|
|
36336
|
+
|
|
36337
|
+
/**
|
|
36338
|
+
* @classdesc
|
|
36339
|
+
* Used to make a game entity a droptarget
|
|
36340
|
+
* @augments Entity
|
|
36341
|
+
* @deprecated since 10.5.0
|
|
36342
|
+
* @see DropTarget
|
|
36343
|
+
*/
|
|
36344
|
+
var DroptargetEntity = /*@__PURE__*/(function (DropTarget) {
|
|
36345
|
+
function DroptargetEntity(x, y, settings) {
|
|
36346
|
+
warning("DroptargetEntity", "DropTarget", "10.5.0");
|
|
36347
|
+
DropTarget.call(this, x, y, settings.width, settings.height);
|
|
36348
|
+
}
|
|
36349
|
+
|
|
36350
|
+
if ( DropTarget ) DroptargetEntity.__proto__ = DropTarget;
|
|
36351
|
+
DroptargetEntity.prototype = Object.create( DropTarget && DropTarget.prototype );
|
|
36352
|
+
DroptargetEntity.prototype.constructor = DroptargetEntity;
|
|
36353
|
+
|
|
36354
|
+
return DroptargetEntity;
|
|
36355
|
+
}(DropTarget));
|
|
35829
36356
|
|
|
35830
36357
|
// ES5 polyfills
|
|
35831
36358
|
|
|
36359
|
+
|
|
35832
36360
|
/**
|
|
35833
36361
|
* current melonJS version
|
|
35834
36362
|
* @static
|
|
@@ -35836,7 +36364,7 @@
|
|
|
35836
36364
|
* @name version
|
|
35837
36365
|
* @type {string}
|
|
35838
36366
|
*/
|
|
35839
|
-
var version = "10.
|
|
36367
|
+
var version = "10.5.2";
|
|
35840
36368
|
|
|
35841
36369
|
|
|
35842
36370
|
/**
|
|
@@ -35953,7 +36481,9 @@
|
|
|
35953
36481
|
exports.Color = Color;
|
|
35954
36482
|
exports.ColorLayer = ColorLayer;
|
|
35955
36483
|
exports.Container = Container;
|
|
36484
|
+
exports.Draggable = Draggable;
|
|
35956
36485
|
exports.DraggableEntity = DraggableEntity;
|
|
36486
|
+
exports.DropTarget = DropTarget;
|
|
35957
36487
|
exports.DroptargetEntity = DroptargetEntity;
|
|
35958
36488
|
exports.Ellipse = Ellipse;
|
|
35959
36489
|
exports.Entity = Entity;
|
|
@@ -36000,7 +36530,6 @@
|
|
|
36000
36530
|
exports.audio = audio;
|
|
36001
36531
|
exports.boot = boot;
|
|
36002
36532
|
exports.collision = collision;
|
|
36003
|
-
exports.deprecated = deprecated;
|
|
36004
36533
|
exports.device = device$1;
|
|
36005
36534
|
exports.event = event;
|
|
36006
36535
|
exports.game = game;
|
|
@@ -36017,6 +36546,7 @@
|
|
|
36017
36546
|
exports.utils = utils;
|
|
36018
36547
|
exports.version = version;
|
|
36019
36548
|
exports.video = video;
|
|
36549
|
+
exports.warning = warning;
|
|
36020
36550
|
|
|
36021
36551
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
36022
36552
|
|