melonjs 13.3.0 → 13.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/melonjs.js +82 -59
- package/dist/melonjs.min.js +3 -3
- package/dist/melonjs.module.js +82 -59
- package/package.json +8 -8
- package/src/text/bitmaptext.js +25 -18
- package/src/text/textmetrics.js +5 -3
package/dist/melonjs.module.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* melonJS Game Engine - v13.
|
|
2
|
+
* melonJS Game Engine - v13.4.0
|
|
3
3
|
* http://www.melonjs.org
|
|
4
4
|
* melonjs is licensed under the MIT License.
|
|
5
5
|
* http://www.opensource.org/licenses/mit-license
|
|
@@ -13,7 +13,7 @@ var check = function (it) {
|
|
|
13
13
|
|
|
14
14
|
// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
|
|
15
15
|
var global$c =
|
|
16
|
-
// eslint-disable-next-line es
|
|
16
|
+
// eslint-disable-next-line es/no-global-this -- safe
|
|
17
17
|
check(typeof globalThis == 'object' && globalThis) ||
|
|
18
18
|
check(typeof window == 'object' && window) ||
|
|
19
19
|
// eslint-disable-next-line no-restricted-globals -- safe
|
|
@@ -36,14 +36,14 @@ var fails$8 = fails$9;
|
|
|
36
36
|
|
|
37
37
|
// Detect IE8's incomplete defineProperty implementation
|
|
38
38
|
var descriptors = !fails$8(function () {
|
|
39
|
-
// eslint-disable-next-line es
|
|
39
|
+
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
|
40
40
|
return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;
|
|
41
41
|
});
|
|
42
42
|
|
|
43
43
|
var fails$7 = fails$9;
|
|
44
44
|
|
|
45
45
|
var functionBindNative = !fails$7(function () {
|
|
46
|
-
// eslint-disable-next-line es
|
|
46
|
+
// eslint-disable-next-line es/no-function-prototype-bind -- safe
|
|
47
47
|
var test = (function () { /* empty */ }).bind();
|
|
48
48
|
// eslint-disable-next-line no-prototype-builtins -- safe
|
|
49
49
|
return typeof test != 'function' || test.hasOwnProperty('prototype');
|
|
@@ -60,7 +60,7 @@ var functionCall = NATIVE_BIND$1 ? call$4.bind(call$4) : function () {
|
|
|
60
60
|
var objectPropertyIsEnumerable = {};
|
|
61
61
|
|
|
62
62
|
var $propertyIsEnumerable = {}.propertyIsEnumerable;
|
|
63
|
-
// eslint-disable-next-line es
|
|
63
|
+
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
64
64
|
var getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
|
|
65
65
|
|
|
66
66
|
// Nashorn ~ JDK8 bug
|
|
@@ -147,20 +147,34 @@ var toIndexedObject$3 = function (it) {
|
|
|
147
147
|
return IndexedObject(requireObjectCoercible$2(it));
|
|
148
148
|
};
|
|
149
149
|
|
|
150
|
+
var documentAll$2 = typeof document == 'object' && document.all;
|
|
151
|
+
|
|
152
|
+
// https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot
|
|
153
|
+
var IS_HTMLDDA = typeof documentAll$2 == 'undefined' && documentAll$2 !== undefined;
|
|
154
|
+
|
|
155
|
+
var documentAll_1 = {
|
|
156
|
+
all: documentAll$2,
|
|
157
|
+
IS_HTMLDDA: IS_HTMLDDA
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
var $documentAll$1 = documentAll_1;
|
|
161
|
+
|
|
162
|
+
var documentAll$1 = $documentAll$1.all;
|
|
163
|
+
|
|
150
164
|
// `IsCallable` abstract operation
|
|
151
165
|
// https://tc39.es/ecma262/#sec-iscallable
|
|
152
|
-
var isCallable$b = function (argument) {
|
|
166
|
+
var isCallable$b = $documentAll$1.IS_HTMLDDA ? function (argument) {
|
|
167
|
+
return typeof argument == 'function' || argument === documentAll$1;
|
|
168
|
+
} : function (argument) {
|
|
153
169
|
return typeof argument == 'function';
|
|
154
170
|
};
|
|
155
171
|
|
|
156
172
|
var isCallable$a = isCallable$b;
|
|
173
|
+
var $documentAll = documentAll_1;
|
|
157
174
|
|
|
158
|
-
var documentAll =
|
|
159
|
-
|
|
160
|
-
// https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot
|
|
161
|
-
var SPECIAL_DOCUMENT_ALL = typeof documentAll == 'undefined' && documentAll !== undefined;
|
|
175
|
+
var documentAll = $documentAll.all;
|
|
162
176
|
|
|
163
|
-
var isObject$5 =
|
|
177
|
+
var isObject$5 = $documentAll.IS_HTMLDDA ? function (it) {
|
|
164
178
|
return typeof it == 'object' ? it !== null : isCallable$a(it) || it === documentAll;
|
|
165
179
|
} : function (it) {
|
|
166
180
|
return typeof it == 'object' ? it !== null : isCallable$a(it);
|
|
@@ -213,12 +227,12 @@ if (!version$1 && userAgent) {
|
|
|
213
227
|
|
|
214
228
|
var engineV8Version = version$1;
|
|
215
229
|
|
|
216
|
-
/* eslint-disable es
|
|
230
|
+
/* eslint-disable es/no-symbol -- required for testing */
|
|
217
231
|
|
|
218
232
|
var V8_VERSION = engineV8Version;
|
|
219
233
|
var fails$5 = fails$9;
|
|
220
234
|
|
|
221
|
-
// eslint-disable-next-line es
|
|
235
|
+
// eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing
|
|
222
236
|
var symbolConstructorDetection = !!Object.getOwnPropertySymbols && !fails$5(function () {
|
|
223
237
|
var symbol = Symbol();
|
|
224
238
|
// Chrome 38 Symbol has incorrect toString conversion
|
|
@@ -228,7 +242,7 @@ var symbolConstructorDetection = !!Object.getOwnPropertySymbols && !fails$5(func
|
|
|
228
242
|
!Symbol.sham && V8_VERSION && V8_VERSION < 41;
|
|
229
243
|
});
|
|
230
244
|
|
|
231
|
-
/* eslint-disable es
|
|
245
|
+
/* eslint-disable es/no-symbol -- required for testing */
|
|
232
246
|
|
|
233
247
|
var NATIVE_SYMBOL$1 = symbolConstructorDetection;
|
|
234
248
|
|
|
@@ -301,7 +315,7 @@ var shared$3 = {exports: {}};
|
|
|
301
315
|
|
|
302
316
|
var global$9 = global$c;
|
|
303
317
|
|
|
304
|
-
// eslint-disable-next-line es
|
|
318
|
+
// eslint-disable-next-line es/no-object-defineproperty -- safe
|
|
305
319
|
var defineProperty$1 = Object.defineProperty;
|
|
306
320
|
|
|
307
321
|
var defineGlobalProperty$3 = function (key, value) {
|
|
@@ -325,10 +339,10 @@ var store$2 = sharedStore;
|
|
|
325
339
|
(shared$3.exports = function (key, value) {
|
|
326
340
|
return store$2[key] || (store$2[key] = value !== undefined ? value : {});
|
|
327
341
|
})('versions', []).push({
|
|
328
|
-
version: '3.25.
|
|
342
|
+
version: '3.25.3',
|
|
329
343
|
mode: 'global',
|
|
330
344
|
copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',
|
|
331
|
-
license: 'https://github.com/zloirock/core-js/blob/v3.25.
|
|
345
|
+
license: 'https://github.com/zloirock/core-js/blob/v3.25.3/LICENSE',
|
|
332
346
|
source: 'https://github.com/zloirock/core-js'
|
|
333
347
|
});
|
|
334
348
|
|
|
@@ -349,7 +363,7 @@ var hasOwnProperty = uncurryThis$7({}.hasOwnProperty);
|
|
|
349
363
|
|
|
350
364
|
// `HasOwnProperty` abstract operation
|
|
351
365
|
// https://tc39.es/ecma262/#sec-hasownproperty
|
|
352
|
-
// eslint-disable-next-line es
|
|
366
|
+
// eslint-disable-next-line es/no-object-hasown -- safe
|
|
353
367
|
var hasOwnProperty_1 = Object.hasOwn || function hasOwn(it, key) {
|
|
354
368
|
return hasOwnProperty(toObject(it), key);
|
|
355
369
|
};
|
|
@@ -442,7 +456,7 @@ var createElement = documentCreateElement;
|
|
|
442
456
|
|
|
443
457
|
// Thanks to IE8 for its funny defineProperty
|
|
444
458
|
var ie8DomDefine = !DESCRIPTORS$6 && !fails$4(function () {
|
|
445
|
-
// eslint-disable-next-line es
|
|
459
|
+
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
|
446
460
|
return Object.defineProperty(createElement('div'), 'a', {
|
|
447
461
|
get: function () { return 7; }
|
|
448
462
|
}).a != 7;
|
|
@@ -457,7 +471,7 @@ var toPropertyKey$1 = toPropertyKey$2;
|
|
|
457
471
|
var hasOwn$5 = hasOwnProperty_1;
|
|
458
472
|
var IE8_DOM_DEFINE$1 = ie8DomDefine;
|
|
459
473
|
|
|
460
|
-
// eslint-disable-next-line es
|
|
474
|
+
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
461
475
|
var $getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
|
|
462
476
|
|
|
463
477
|
// `Object.getOwnPropertyDescriptor` method
|
|
@@ -479,7 +493,7 @@ var fails$3 = fails$9;
|
|
|
479
493
|
// V8 ~ Chrome 36-
|
|
480
494
|
// https://bugs.chromium.org/p/v8/issues/detail?id=3334
|
|
481
495
|
var v8PrototypeDefineBug = DESCRIPTORS$4 && fails$3(function () {
|
|
482
|
-
// eslint-disable-next-line es
|
|
496
|
+
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
|
483
497
|
return Object.defineProperty(function () { /* empty */ }, 'prototype', {
|
|
484
498
|
value: 42,
|
|
485
499
|
writable: false
|
|
@@ -504,9 +518,9 @@ var anObject$1 = anObject$2;
|
|
|
504
518
|
var toPropertyKey = toPropertyKey$2;
|
|
505
519
|
|
|
506
520
|
var $TypeError = TypeError;
|
|
507
|
-
// eslint-disable-next-line es
|
|
521
|
+
// eslint-disable-next-line es/no-object-defineproperty -- safe
|
|
508
522
|
var $defineProperty = Object.defineProperty;
|
|
509
|
-
// eslint-disable-next-line es
|
|
523
|
+
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
510
524
|
var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
511
525
|
var ENUMERABLE = 'enumerable';
|
|
512
526
|
var CONFIGURABLE$1 = 'configurable';
|
|
@@ -558,7 +572,7 @@ var DESCRIPTORS$1 = descriptors;
|
|
|
558
572
|
var hasOwn$4 = hasOwnProperty_1;
|
|
559
573
|
|
|
560
574
|
var FunctionPrototype = Function.prototype;
|
|
561
|
-
// eslint-disable-next-line es
|
|
575
|
+
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
562
576
|
var getDescriptor = DESCRIPTORS$1 && Object.getOwnPropertyDescriptor;
|
|
563
577
|
|
|
564
578
|
var EXISTS = hasOwn$4(FunctionPrototype, 'name');
|
|
@@ -685,7 +699,7 @@ var InternalStateModule = internalState;
|
|
|
685
699
|
|
|
686
700
|
var enforceInternalState = InternalStateModule.enforce;
|
|
687
701
|
var getInternalState = InternalStateModule.get;
|
|
688
|
-
// eslint-disable-next-line es
|
|
702
|
+
// eslint-disable-next-line es/no-object-defineproperty -- safe
|
|
689
703
|
var defineProperty = Object.defineProperty;
|
|
690
704
|
|
|
691
705
|
var CONFIGURABLE_LENGTH = DESCRIPTORS && !fails$2(function () {
|
|
@@ -760,7 +774,7 @@ var floor = Math.floor;
|
|
|
760
774
|
|
|
761
775
|
// `Math.trunc` method
|
|
762
776
|
// https://tc39.es/ecma262/#sec-math.trunc
|
|
763
|
-
// eslint-disable-next-line es
|
|
777
|
+
// eslint-disable-next-line es/no-math-trunc -- safe
|
|
764
778
|
var mathTrunc = Math.trunc || function trunc(x) {
|
|
765
779
|
var n = +x;
|
|
766
780
|
return (n > 0 ? floor : ceil)(n);
|
|
@@ -879,14 +893,14 @@ var hiddenKeys = enumBugKeys.concat('length', 'prototype');
|
|
|
879
893
|
|
|
880
894
|
// `Object.getOwnPropertyNames` method
|
|
881
895
|
// https://tc39.es/ecma262/#sec-object.getownpropertynames
|
|
882
|
-
// eslint-disable-next-line es
|
|
896
|
+
// eslint-disable-next-line es/no-object-getownpropertynames -- safe
|
|
883
897
|
objectGetOwnPropertyNames.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
|
|
884
898
|
return internalObjectKeys(O, hiddenKeys);
|
|
885
899
|
};
|
|
886
900
|
|
|
887
901
|
var objectGetOwnPropertySymbols = {};
|
|
888
902
|
|
|
889
|
-
// eslint-disable-next-line es
|
|
903
|
+
// eslint-disable-next-line es/no-object-getownpropertysymbols -- safe
|
|
890
904
|
objectGetOwnPropertySymbols.f = Object.getOwnPropertySymbols;
|
|
891
905
|
|
|
892
906
|
var getBuiltIn = getBuiltIn$3;
|
|
@@ -1004,7 +1018,7 @@ var global$2 = global$c;
|
|
|
1004
1018
|
|
|
1005
1019
|
// `globalThis` object
|
|
1006
1020
|
// https://tc39.es/ecma262/#sec-globalthis
|
|
1007
|
-
$$4({ global: true }, {
|
|
1021
|
+
$$4({ global: true, forced: global$2.globalThis !== global$2 }, {
|
|
1008
1022
|
globalThis: global$2
|
|
1009
1023
|
});
|
|
1010
1024
|
|
|
@@ -1116,7 +1130,7 @@ var forcedStringTrimMethod$1 = stringTrimForced;
|
|
|
1116
1130
|
// https://tc39.es/ecma262/#String.prototype.trimleft
|
|
1117
1131
|
var stringTrimStart = forcedStringTrimMethod$1('trimStart') ? function trimStart() {
|
|
1118
1132
|
return $trimStart(this);
|
|
1119
|
-
// eslint-disable-next-line es
|
|
1133
|
+
// eslint-disable-next-line es/no-string-prototype-trimstart-trimend -- safe
|
|
1120
1134
|
} : ''.trimStart;
|
|
1121
1135
|
|
|
1122
1136
|
var $$3 = _export;
|
|
@@ -1124,7 +1138,7 @@ var trimStart$1 = stringTrimStart;
|
|
|
1124
1138
|
|
|
1125
1139
|
// `String.prototype.trimLeft` method
|
|
1126
1140
|
// https://tc39.es/ecma262/#sec-string.prototype.trimleft
|
|
1127
|
-
// eslint-disable-next-line es
|
|
1141
|
+
// eslint-disable-next-line es/no-string-prototype-trimleft-trimright -- safe
|
|
1128
1142
|
$$3({ target: 'String', proto: true, name: 'trimStart', forced: ''.trimLeft !== trimStart$1 }, {
|
|
1129
1143
|
trimLeft: trimStart$1
|
|
1130
1144
|
});
|
|
@@ -1136,7 +1150,7 @@ var trimStart = stringTrimStart;
|
|
|
1136
1150
|
|
|
1137
1151
|
// `String.prototype.trimStart` method
|
|
1138
1152
|
// https://tc39.es/ecma262/#sec-string.prototype.trimstart
|
|
1139
|
-
// eslint-disable-next-line es
|
|
1153
|
+
// eslint-disable-next-line es/no-string-prototype-trimstart-trimend -- safe
|
|
1140
1154
|
$$2({ target: 'String', proto: true, name: 'trimStart', forced: ''.trimStart !== trimStart }, {
|
|
1141
1155
|
trimStart: trimStart
|
|
1142
1156
|
});
|
|
@@ -1160,7 +1174,7 @@ var forcedStringTrimMethod = stringTrimForced;
|
|
|
1160
1174
|
// https://tc39.es/ecma262/#String.prototype.trimright
|
|
1161
1175
|
var stringTrimEnd = forcedStringTrimMethod('trimEnd') ? function trimEnd() {
|
|
1162
1176
|
return $trimEnd(this);
|
|
1163
|
-
// eslint-disable-next-line es
|
|
1177
|
+
// eslint-disable-next-line es/no-string-prototype-trimstart-trimend -- safe
|
|
1164
1178
|
} : ''.trimEnd;
|
|
1165
1179
|
|
|
1166
1180
|
var $$1 = _export;
|
|
@@ -1168,7 +1182,7 @@ var trimEnd$1 = stringTrimEnd;
|
|
|
1168
1182
|
|
|
1169
1183
|
// `String.prototype.trimRight` method
|
|
1170
1184
|
// https://tc39.es/ecma262/#sec-string.prototype.trimend
|
|
1171
|
-
// eslint-disable-next-line es
|
|
1185
|
+
// eslint-disable-next-line es/no-string-prototype-trimleft-trimright -- safe
|
|
1172
1186
|
$$1({ target: 'String', proto: true, name: 'trimEnd', forced: ''.trimRight !== trimEnd$1 }, {
|
|
1173
1187
|
trimRight: trimEnd$1
|
|
1174
1188
|
});
|
|
@@ -1180,7 +1194,7 @@ var trimEnd = stringTrimEnd;
|
|
|
1180
1194
|
|
|
1181
1195
|
// `String.prototype.trimEnd` method
|
|
1182
1196
|
// https://tc39.es/ecma262/#sec-string.prototype.trimend
|
|
1183
|
-
// eslint-disable-next-line es
|
|
1197
|
+
// eslint-disable-next-line es/no-string-prototype-trimstart-trimend -- safe
|
|
1184
1198
|
$({ target: 'String', proto: true, name: 'trimEnd', forced: ''.trimEnd !== trimEnd }, {
|
|
1185
1199
|
trimEnd: trimEnd
|
|
1186
1200
|
});
|
|
@@ -32894,10 +32908,10 @@ class BasePlugin {
|
|
|
32894
32908
|
* this can be overridden by the plugin
|
|
32895
32909
|
* @public
|
|
32896
32910
|
* @type {string}
|
|
32897
|
-
* @default "13.
|
|
32911
|
+
* @default "13.4.0"
|
|
32898
32912
|
* @name plugin.Base#version
|
|
32899
32913
|
*/
|
|
32900
|
-
this.version = "13.
|
|
32914
|
+
this.version = "13.4.0";
|
|
32901
32915
|
}
|
|
32902
32916
|
}
|
|
32903
32917
|
|
|
@@ -34105,9 +34119,11 @@ class TextMetrics extends Bounds {
|
|
|
34105
34119
|
for (var i = 0; i < characters.length; i++) {
|
|
34106
34120
|
var ch = characters[i].charCodeAt(0);
|
|
34107
34121
|
var glyph = this.ancestor.fontData.glyphs[ch];
|
|
34108
|
-
|
|
34109
|
-
|
|
34110
|
-
|
|
34122
|
+
if (typeof glyph !== "undefined") {
|
|
34123
|
+
var kerning = (lastGlyph && lastGlyph.kerning) ? lastGlyph.getKerning(ch) : 0;
|
|
34124
|
+
width += (glyph.xadvance + kerning) * this.ancestor.fontScale.x;
|
|
34125
|
+
lastGlyph = glyph;
|
|
34126
|
+
}
|
|
34111
34127
|
}
|
|
34112
34128
|
return width;
|
|
34113
34129
|
}
|
|
@@ -34938,25 +34954,32 @@ class BitmapText extends Renderable {
|
|
|
34938
34954
|
// calculate the char index
|
|
34939
34955
|
var ch = string.charCodeAt(c);
|
|
34940
34956
|
var glyph = this.fontData.glyphs[ch];
|
|
34941
|
-
var glyphWidth = glyph.width;
|
|
34942
|
-
var glyphHeight = glyph.height;
|
|
34943
|
-
var kerning = (lastGlyph && lastGlyph.kerning) ? lastGlyph.getKerning(ch) : 0;
|
|
34944
|
-
|
|
34945
|
-
// draw it
|
|
34946
|
-
if (glyphWidth !== 0 && glyphHeight !== 0) {
|
|
34947
|
-
// some browser throw an exception when drawing a 0 width or height image
|
|
34948
|
-
renderer.drawImage(this.fontImage,
|
|
34949
|
-
glyph.x, glyph.y,
|
|
34950
|
-
glyphWidth, glyphHeight,
|
|
34951
|
-
x + glyph.xoffset,
|
|
34952
|
-
y + glyph.yoffset * this.fontScale.y,
|
|
34953
|
-
glyphWidth * this.fontScale.x, glyphHeight * this.fontScale.y
|
|
34954
|
-
);
|
|
34955
|
-
}
|
|
34956
34957
|
|
|
34957
|
-
|
|
34958
|
-
|
|
34959
|
-
|
|
34958
|
+
if (typeof glyph !== "undefined") {
|
|
34959
|
+
var glyphWidth = glyph.width;
|
|
34960
|
+
var glyphHeight = glyph.height;
|
|
34961
|
+
var kerning = (lastGlyph && lastGlyph.kerning) ? lastGlyph.getKerning(ch) : 0;
|
|
34962
|
+
var scaleX = this.fontScale.x;
|
|
34963
|
+
var scaleY = this.fontScale.y;
|
|
34964
|
+
|
|
34965
|
+
// draw it
|
|
34966
|
+
if (glyphWidth !== 0 && glyphHeight !== 0) {
|
|
34967
|
+
// some browser throw an exception when drawing a 0 width or height image
|
|
34968
|
+
renderer.drawImage(this.fontImage,
|
|
34969
|
+
glyph.x, glyph.y,
|
|
34970
|
+
glyphWidth, glyphHeight,
|
|
34971
|
+
x + glyph.xoffset * scaleX,
|
|
34972
|
+
y + glyph.yoffset * scaleY,
|
|
34973
|
+
glyphWidth * scaleX, glyphHeight * scaleY
|
|
34974
|
+
);
|
|
34975
|
+
}
|
|
34976
|
+
|
|
34977
|
+
// increment position
|
|
34978
|
+
x += (glyph.xadvance + kerning) * scaleX;
|
|
34979
|
+
lastGlyph = glyph;
|
|
34980
|
+
} else {
|
|
34981
|
+
console.warn("BitmapText: no defined Glyph in for " + String.fromCharCode(ch));
|
|
34982
|
+
}
|
|
34960
34983
|
}
|
|
34961
34984
|
// increment line
|
|
34962
34985
|
y += stringHeight;
|
|
@@ -37706,7 +37729,7 @@ Renderer.prototype.getScreenContext = function() {
|
|
|
37706
37729
|
* @name version
|
|
37707
37730
|
* @type {string}
|
|
37708
37731
|
*/
|
|
37709
|
-
const version = "13.
|
|
37732
|
+
const version = "13.4.0";
|
|
37710
37733
|
|
|
37711
37734
|
|
|
37712
37735
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "melonjs",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.4.0",
|
|
4
4
|
"description": "melonJS Game Engine",
|
|
5
5
|
"homepage": "http://www.melonjs.org/",
|
|
6
6
|
"keywords": [
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
],
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"@teppeis/multimaps": "^2.0.0",
|
|
55
|
-
"core-js": "^3.25.
|
|
55
|
+
"core-js": "^3.25.3",
|
|
56
56
|
"earcut": "2.2.4",
|
|
57
57
|
"eventemitter3": "^4.0.7",
|
|
58
58
|
"howler": "2.2.3"
|
|
@@ -62,24 +62,24 @@
|
|
|
62
62
|
"@rollup/plugin-buble": "^0.21.3",
|
|
63
63
|
"@rollup/plugin-commonjs": "^22.0.2",
|
|
64
64
|
"@rollup/plugin-image": "^2.1.1",
|
|
65
|
-
"@rollup/plugin-node-resolve": "^
|
|
65
|
+
"@rollup/plugin-node-resolve": "^14.1.0",
|
|
66
66
|
"@rollup/plugin-replace": "^4.0.0",
|
|
67
67
|
"@types/offscreencanvas": "^2019.7.0",
|
|
68
68
|
"@webdoc/cli": "^2.1.2",
|
|
69
69
|
"del-cli": "^5.0.0",
|
|
70
|
-
"eslint": "^8.
|
|
71
|
-
"jasmine-core": "^4.
|
|
72
|
-
"karma": "^6.4.
|
|
70
|
+
"eslint": "^8.24.0",
|
|
71
|
+
"jasmine-core": "^4.4.0",
|
|
72
|
+
"karma": "^6.4.1",
|
|
73
73
|
"karma-chrome-launcher": "^3.1.1",
|
|
74
74
|
"karma-coverage": "^2.2.0",
|
|
75
75
|
"karma-html-detailed-reporter": "^2.1.0",
|
|
76
76
|
"karma-jasmine": "^5.1.0",
|
|
77
77
|
"karma-nyan-reporter": "0.2.5",
|
|
78
|
-
"rollup": "^2.
|
|
78
|
+
"rollup": "^2.79.1",
|
|
79
79
|
"rollup-plugin-bundle-size": "^1.0.3",
|
|
80
80
|
"rollup-plugin-string": "^3.0.0",
|
|
81
81
|
"terser": "^5.15.0",
|
|
82
|
-
"typescript": "^4.8.
|
|
82
|
+
"typescript": "^4.8.3"
|
|
83
83
|
},
|
|
84
84
|
"scripts": {
|
|
85
85
|
"build": "npm run lint && rollup -c --silent",
|
package/src/text/bitmaptext.js
CHANGED
|
@@ -302,25 +302,32 @@ class BitmapText extends Renderable {
|
|
|
302
302
|
// calculate the char index
|
|
303
303
|
var ch = string.charCodeAt(c);
|
|
304
304
|
var glyph = this.fontData.glyphs[ch];
|
|
305
|
-
var glyphWidth = glyph.width;
|
|
306
|
-
var glyphHeight = glyph.height;
|
|
307
|
-
var kerning = (lastGlyph && lastGlyph.kerning) ? lastGlyph.getKerning(ch) : 0;
|
|
308
|
-
|
|
309
|
-
// draw it
|
|
310
|
-
if (glyphWidth !== 0 && glyphHeight !== 0) {
|
|
311
|
-
// some browser throw an exception when drawing a 0 width or height image
|
|
312
|
-
renderer.drawImage(this.fontImage,
|
|
313
|
-
glyph.x, glyph.y,
|
|
314
|
-
glyphWidth, glyphHeight,
|
|
315
|
-
x + glyph.xoffset,
|
|
316
|
-
y + glyph.yoffset * this.fontScale.y,
|
|
317
|
-
glyphWidth * this.fontScale.x, glyphHeight * this.fontScale.y
|
|
318
|
-
);
|
|
319
|
-
}
|
|
320
305
|
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
306
|
+
if (typeof glyph !== "undefined") {
|
|
307
|
+
var glyphWidth = glyph.width;
|
|
308
|
+
var glyphHeight = glyph.height;
|
|
309
|
+
var kerning = (lastGlyph && lastGlyph.kerning) ? lastGlyph.getKerning(ch) : 0;
|
|
310
|
+
var scaleX = this.fontScale.x;
|
|
311
|
+
var scaleY = this.fontScale.y;
|
|
312
|
+
|
|
313
|
+
// draw it
|
|
314
|
+
if (glyphWidth !== 0 && glyphHeight !== 0) {
|
|
315
|
+
// some browser throw an exception when drawing a 0 width or height image
|
|
316
|
+
renderer.drawImage(this.fontImage,
|
|
317
|
+
glyph.x, glyph.y,
|
|
318
|
+
glyphWidth, glyphHeight,
|
|
319
|
+
x + glyph.xoffset * scaleX,
|
|
320
|
+
y + glyph.yoffset * scaleY,
|
|
321
|
+
glyphWidth * scaleX, glyphHeight * scaleY
|
|
322
|
+
);
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
// increment position
|
|
326
|
+
x += (glyph.xadvance + kerning) * scaleX;
|
|
327
|
+
lastGlyph = glyph;
|
|
328
|
+
} else {
|
|
329
|
+
console.warn("BitmapText: no defined Glyph in for " + String.fromCharCode(ch));
|
|
330
|
+
}
|
|
324
331
|
}
|
|
325
332
|
// increment line
|
|
326
333
|
y += stringHeight;
|
package/src/text/textmetrics.js
CHANGED
|
@@ -56,9 +56,11 @@ class TextMetrics extends Bounds {
|
|
|
56
56
|
for (var i = 0; i < characters.length; i++) {
|
|
57
57
|
var ch = characters[i].charCodeAt(0);
|
|
58
58
|
var glyph = this.ancestor.fontData.glyphs[ch];
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
if (typeof glyph !== "undefined") {
|
|
60
|
+
var kerning = (lastGlyph && lastGlyph.kerning) ? lastGlyph.getKerning(ch) : 0;
|
|
61
|
+
width += (glyph.xadvance + kerning) * this.ancestor.fontScale.x;
|
|
62
|
+
lastGlyph = glyph;
|
|
63
|
+
}
|
|
62
64
|
}
|
|
63
65
|
return width;
|
|
64
66
|
}
|