melonjs 15.1.3 → 15.1.4
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.mjs/_virtual/_commonjsHelpers.js +1 -1
- package/dist/melonjs.mjs/_virtual/earcut.js +1 -1
- package/dist/melonjs.mjs/_virtual/howler.js +1 -1
- package/dist/melonjs.mjs/_virtual/index.js +1 -1
- package/dist/melonjs.mjs/application/application.js +1 -1
- package/dist/melonjs.mjs/application/header.js +1 -1
- package/dist/melonjs.mjs/application/resize.js +1 -1
- package/dist/melonjs.mjs/application/settings.js +1 -1
- package/dist/melonjs.mjs/audio/audio.js +3 -3
- package/dist/melonjs.mjs/camera/camera2d.js +1 -1
- package/dist/melonjs.mjs/const.js +2 -2
- package/dist/melonjs.mjs/entity/entity.js +1 -1
- package/dist/melonjs.mjs/geometries/ellipse.js +1 -1
- package/dist/melonjs.mjs/geometries/line.js +1 -1
- package/dist/melonjs.mjs/geometries/path2d.js +1 -1
- package/dist/melonjs.mjs/geometries/point.js +1 -1
- package/dist/melonjs.mjs/geometries/poly.js +1 -1
- package/dist/melonjs.mjs/geometries/rectangle.js +1 -1
- package/dist/melonjs.mjs/geometries/roundrect.js +1 -1
- package/dist/melonjs.mjs/index.js +2 -2
- package/dist/melonjs.mjs/input/gamepad.js +1 -1
- package/dist/melonjs.mjs/input/input.js +1 -1
- package/dist/melonjs.mjs/input/keyboard.js +1 -1
- package/dist/melonjs.mjs/input/pointer.js +1 -1
- package/dist/melonjs.mjs/input/pointerevent.js +1 -1
- package/dist/melonjs.mjs/lang/console.js +1 -1
- package/dist/melonjs.mjs/lang/deprecated.js +1 -1
- package/dist/melonjs.mjs/level/level.js +1 -1
- package/dist/melonjs.mjs/level/tiled/TMXGroup.js +1 -1
- package/dist/melonjs.mjs/level/tiled/TMXLayer.js +1 -1
- package/dist/melonjs.mjs/level/tiled/TMXObject.js +1 -1
- package/dist/melonjs.mjs/level/tiled/TMXTile.js +1 -1
- package/dist/melonjs.mjs/level/tiled/TMXTileMap.js +1 -1
- package/dist/melonjs.mjs/level/tiled/TMXTileset.js +1 -1
- package/dist/melonjs.mjs/level/tiled/TMXTilesetGroup.js +1 -1
- package/dist/melonjs.mjs/level/tiled/TMXUtils.js +1 -1
- package/dist/melonjs.mjs/level/tiled/constants.js +1 -1
- package/dist/melonjs.mjs/level/tiled/renderer/TMXHexagonalRenderer.js +1 -1
- package/dist/melonjs.mjs/level/tiled/renderer/TMXIsometricRenderer.js +1 -1
- package/dist/melonjs.mjs/level/tiled/renderer/TMXOrthogonalRenderer.js +1 -1
- package/dist/melonjs.mjs/level/tiled/renderer/TMXRenderer.js +1 -1
- package/dist/melonjs.mjs/level/tiled/renderer/TMXStaggeredRenderer.js +1 -1
- package/dist/melonjs.mjs/level/tiled/renderer/autodetect.js +1 -1
- package/dist/melonjs.mjs/loader/cache.js +1 -1
- package/dist/melonjs.mjs/loader/loader.js +52 -67
- package/dist/melonjs.mjs/loader/loadingscreen.js +1 -1
- package/dist/melonjs.mjs/loader/melonjs_logo.png.js +1 -1
- package/dist/melonjs.mjs/loader/parser.js +1 -1
- package/dist/melonjs.mjs/loader/settings.js +1 -1
- package/dist/melonjs.mjs/math/color.js +1 -1
- package/dist/melonjs.mjs/math/math.js +1 -1
- package/dist/melonjs.mjs/math/matrix2.js +1 -1
- package/dist/melonjs.mjs/math/matrix3.js +1 -1
- package/dist/melonjs.mjs/math/observable_vector2.js +1 -1
- package/dist/melonjs.mjs/math/observable_vector3.js +1 -1
- package/dist/melonjs.mjs/math/vector2.js +1 -1
- package/dist/melonjs.mjs/math/vector3.js +1 -1
- package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/esm/arraymultimap.js +1 -1
- package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/esm/multimap.js +1 -1
- package/dist/melonjs.mjs/node_modules/earcut/src/earcut.js +1 -1
- package/dist/melonjs.mjs/node_modules/eventemitter3/index.js +1 -1
- package/dist/melonjs.mjs/node_modules/eventemitter3/index2.js +1 -1
- package/dist/melonjs.mjs/node_modules/howler/dist/howler.js +1 -1
- package/dist/melonjs.mjs/particles/emitter.js +1 -1
- package/dist/melonjs.mjs/particles/particle.js +1 -1
- package/dist/melonjs.mjs/particles/settings.js +1 -1
- package/dist/melonjs.mjs/physics/body.js +1 -1
- package/dist/melonjs.mjs/physics/bounds.js +1 -1
- package/dist/melonjs.mjs/physics/collision.js +1 -1
- package/dist/melonjs.mjs/physics/detector.js +1 -1
- package/dist/melonjs.mjs/physics/quadtree.js +1 -1
- package/dist/melonjs.mjs/physics/response.js +1 -1
- package/dist/melonjs.mjs/physics/sat.js +1 -1
- package/dist/melonjs.mjs/physics/world.js +1 -1
- package/dist/melonjs.mjs/plugin/plugin.js +3 -3
- package/dist/melonjs.mjs/renderable/collectable.js +1 -1
- package/dist/melonjs.mjs/renderable/colorlayer.js +1 -1
- package/dist/melonjs.mjs/renderable/container.js +1 -1
- package/dist/melonjs.mjs/renderable/dragndrop.js +1 -1
- package/dist/melonjs.mjs/renderable/imagelayer.js +1 -1
- package/dist/melonjs.mjs/renderable/light2d.js +1 -1
- package/dist/melonjs.mjs/renderable/nineslicesprite.js +1 -1
- package/dist/melonjs.mjs/renderable/renderable.js +1 -1
- package/dist/melonjs.mjs/renderable/sprite.js +1 -1
- package/dist/melonjs.mjs/renderable/trigger.js +1 -1
- package/dist/melonjs.mjs/renderable/ui/uibaseelement.js +1 -1
- package/dist/melonjs.mjs/renderable/ui/uispriteelement.js +1 -1
- package/dist/melonjs.mjs/renderable/ui/uitextbutton.js +1 -1
- package/dist/melonjs.mjs/state/stage.js +1 -1
- package/dist/melonjs.mjs/state/state.js +1 -1
- package/dist/melonjs.mjs/system/device.js +1 -1
- package/dist/melonjs.mjs/system/dom.js +1 -1
- package/dist/melonjs.mjs/system/event.js +1 -1
- package/dist/melonjs.mjs/system/platform.js +1 -1
- package/dist/melonjs.mjs/system/pooling.js +1 -1
- package/dist/melonjs.mjs/system/save.js +1 -1
- package/dist/melonjs.mjs/system/timer.js +1 -1
- package/dist/melonjs.mjs/text/bitmaptext.js +1 -1
- package/dist/melonjs.mjs/text/bitmaptextdata.js +1 -1
- package/dist/melonjs.mjs/text/glyph.js +1 -1
- package/dist/melonjs.mjs/text/text.js +1 -1
- package/dist/melonjs.mjs/text/textmetrics.js +1 -1
- package/dist/melonjs.mjs/text/textstyle.js +1 -1
- package/dist/melonjs.mjs/tweens/easing.js +1 -1
- package/dist/melonjs.mjs/tweens/interpolation.js +1 -1
- package/dist/melonjs.mjs/tweens/tween.js +1 -1
- package/dist/melonjs.mjs/utils/agent.js +1 -1
- package/dist/melonjs.mjs/utils/array.js +1 -1
- package/dist/melonjs.mjs/utils/file.js +1 -1
- package/dist/melonjs.mjs/utils/function.js +1 -1
- package/dist/melonjs.mjs/utils/string.js +1 -1
- package/dist/melonjs.mjs/utils/utils.js +1 -1
- package/dist/melonjs.mjs/video/canvas/canvas_renderer.js +1 -1
- package/dist/melonjs.mjs/video/renderer.js +1 -1
- package/dist/melonjs.mjs/video/texture/atlas.js +1 -1
- package/dist/melonjs.mjs/video/texture/cache.js +1 -1
- package/dist/melonjs.mjs/video/texture/canvas_texture.js +1 -1
- package/dist/melonjs.mjs/video/utils/autodetect.js +1 -1
- package/dist/melonjs.mjs/video/video.js +10 -3
- package/dist/melonjs.mjs/video/webgl/buffer/vertex.js +1 -1
- package/dist/melonjs.mjs/video/webgl/compositors/compositor.js +1 -1
- package/dist/melonjs.mjs/video/webgl/compositors/primitive_compositor.js +1 -1
- package/dist/melonjs.mjs/video/webgl/compositors/quad_compositor.js +1 -1
- package/dist/melonjs.mjs/video/webgl/glshader.js +1 -1
- package/dist/melonjs.mjs/video/webgl/shaders/primitive.frag.js +1 -1
- package/dist/melonjs.mjs/video/webgl/shaders/primitive.vert.js +1 -1
- package/dist/melonjs.mjs/video/webgl/shaders/quad.frag.js +1 -1
- package/dist/melonjs.mjs/video/webgl/shaders/quad.vert.js +1 -1
- package/dist/melonjs.mjs/video/webgl/utils/attributes.js +1 -1
- package/dist/melonjs.mjs/video/webgl/utils/precision.js +1 -1
- package/dist/melonjs.mjs/video/webgl/utils/program.js +1 -1
- package/dist/melonjs.mjs/video/webgl/utils/string.js +1 -1
- package/dist/melonjs.mjs/video/webgl/utils/uniforms.js +1 -1
- package/dist/melonjs.mjs/video/webgl/webgl_renderer.js +1 -1
- package/dist/melonjs.module.js +59 -74
- package/dist/types/audio/audio.d.ts +2 -2
- package/dist/types/const.d.ts +2 -2
- package/dist/types/loader/loader.d.ts +49 -55
- package/dist/types/video/video.d.ts +1 -1
- package/package.json +4 -4
- package/src/audio/audio.js +2 -2
- package/src/const.js +1 -1
- package/src/loader/loader.js +51 -66
- package/src/video/video.js +1 -1
package/src/loader/loader.js
CHANGED
|
@@ -17,9 +17,9 @@ export * from "./settings.js";
|
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* onload callback
|
|
20
|
-
* @name onload
|
|
21
20
|
* @default undefined
|
|
22
21
|
* @memberof loader
|
|
22
|
+
* @type {function}
|
|
23
23
|
* @example
|
|
24
24
|
* // set a callback when everything is loaded
|
|
25
25
|
* me.loader.onload = this.loaded.bind(this);
|
|
@@ -30,9 +30,9 @@ export let onload;
|
|
|
30
30
|
* onProgress callback<br>
|
|
31
31
|
* each time a resource is loaded, the loader will fire the specified function,
|
|
32
32
|
* giving the actual progress [0 ... 1], as argument, and an object describing the resource loaded
|
|
33
|
-
* @name onProgress
|
|
34
33
|
* @default undefined
|
|
35
34
|
* @memberof loader
|
|
35
|
+
* @type {function}
|
|
36
36
|
* @example
|
|
37
37
|
* // set a callback for progress notification
|
|
38
38
|
* me.loader.onProgress = this.updateProgress.bind(this);
|
|
@@ -101,19 +101,24 @@ function onLoadingError(res) {
|
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
/**
|
|
104
|
-
*
|
|
105
|
-
* @
|
|
104
|
+
* an asset definition to be used with the loader
|
|
105
|
+
* @typedef {object} loader.Asset
|
|
106
|
+
* @property {string} name - name of the asset
|
|
107
|
+
* @property {string} type - the type of the asset : "audio", binary", "image", "json","js", "tmx", "tsx", "fontface"
|
|
108
|
+
* @property {string} src - path and/or file name of the resource (for audio assets only the path is required)
|
|
109
|
+
* @property {boolean} [stream] - Set to true to force HTML5 Audio, which allows not to wait for large file to be downloaded before playing.
|
|
110
|
+
* @see loader.preload
|
|
111
|
+
* @see loader.load
|
|
112
|
+
*/
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* set all the specified game assets to be preloaded.
|
|
106
116
|
* @memberof loader
|
|
107
|
-
* @
|
|
108
|
-
* @param {
|
|
109
|
-
* @param {string} res.name - internal name of the resource
|
|
110
|
-
* @param {string} res.type - "audio", binary", "image", "json","js", "tmx", "tsx", "fontface"
|
|
111
|
-
* @param {string} res.src - path and/or file name of the resource (for audio assets only the path is required)
|
|
112
|
-
* @param {boolean} [res.stream] - Set to true to force HTML5 Audio, which allows not to wait for large file to be downloaded before playing.
|
|
113
|
-
* @param {Function} [onload=loader.onload] - function to be called when all resources are loaded
|
|
117
|
+
* @param {loader.Asset[]} assets - list of assets to load
|
|
118
|
+
* @param {Function} [onloadcb=loader.onload] - function to be called when all resources are loaded
|
|
114
119
|
* @param {boolean} [switchToLoadState=true] - automatically switch to the loading screen
|
|
115
120
|
* @example
|
|
116
|
-
*
|
|
121
|
+
* game.assets = [
|
|
117
122
|
* // PNG tileset
|
|
118
123
|
* {name: "tileset-platformer", type: "image", src: "data/map/tileset.png"},
|
|
119
124
|
* // PNG packed texture
|
|
@@ -143,15 +148,15 @@ function onLoadingError(res) {
|
|
|
143
148
|
* ];
|
|
144
149
|
* ...
|
|
145
150
|
* // set all resources to be loaded
|
|
146
|
-
* me.loader.preload(game.
|
|
151
|
+
* me.loader.preload(game.assets, () => this.loaded());
|
|
147
152
|
*/
|
|
148
|
-
export function preload(
|
|
153
|
+
export function preload(assets, onloadcb, switchToLoadState = true) {
|
|
149
154
|
// parse the resources
|
|
150
|
-
for (let i = 0; i <
|
|
155
|
+
for (let i = 0; i < assets.length; i++) {
|
|
151
156
|
resourceCount += load(
|
|
152
|
-
|
|
153
|
-
onResourceLoaded.bind(this,
|
|
154
|
-
onLoadingError.bind(this,
|
|
157
|
+
assets[i],
|
|
158
|
+
onResourceLoaded.bind(this, assets[i]),
|
|
159
|
+
onLoadingError.bind(this, assets[i])
|
|
155
160
|
);
|
|
156
161
|
}
|
|
157
162
|
// set the onload callback if defined
|
|
@@ -169,15 +174,9 @@ export function preload(res, onloadcb, switchToLoadState = true) {
|
|
|
169
174
|
}
|
|
170
175
|
|
|
171
176
|
/**
|
|
172
|
-
* Load a single
|
|
173
|
-
* @name load
|
|
177
|
+
* Load a single asset (to be used if you need to load additional asset(s) during the game)
|
|
174
178
|
* @memberof loader
|
|
175
|
-
* @
|
|
176
|
-
* @param {object} res
|
|
177
|
-
* @param {string} res.name - internal name of the resource
|
|
178
|
-
* @param {string} res.type - "audio", binary", "image", "json", "tmx", "tsx"
|
|
179
|
-
* @param {string} res.src - path and/or file name of the resource (for audio assets only the path is required)
|
|
180
|
-
* @param {boolean} [res.stream] - Set to true to force HTML5 Audio, which allows not to wait for large file to be downloaded before playing.
|
|
179
|
+
* @param {loader.Asset} asset
|
|
181
180
|
* @param {Function} [onload] - function to be called when the resource is loaded
|
|
182
181
|
* @param {Function} [onerror] - function to be called in case of error
|
|
183
182
|
* @returns {number} the amount of corresponding resource to be preloaded
|
|
@@ -195,83 +194,79 @@ export function preload(res, onloadcb, switchToLoadState = true) {
|
|
|
195
194
|
* me.audio.play("bgmusic");
|
|
196
195
|
* });
|
|
197
196
|
*/
|
|
198
|
-
export function load(
|
|
197
|
+
export function load(asset, onload, onerror) {
|
|
199
198
|
// transform the url if necessary
|
|
200
|
-
if (typeof (baseURL[
|
|
201
|
-
|
|
199
|
+
if (typeof (baseURL[asset.type]) !== "undefined") {
|
|
200
|
+
asset.src = baseURL[asset.type] + asset.src;
|
|
202
201
|
}
|
|
203
202
|
// check ressource type
|
|
204
|
-
switch (
|
|
203
|
+
switch (asset.type) {
|
|
205
204
|
case "binary":
|
|
206
205
|
// reuse the preloadImage fn
|
|
207
|
-
preloadBinary.call(this,
|
|
206
|
+
preloadBinary.call(this, asset, onload, onerror);
|
|
208
207
|
return 1;
|
|
209
208
|
|
|
210
209
|
case "image":
|
|
211
210
|
// reuse the preloadImage fn
|
|
212
|
-
preloadImage.call(this,
|
|
211
|
+
preloadImage.call(this, asset, onload, onerror);
|
|
213
212
|
return 1;
|
|
214
213
|
|
|
215
214
|
case "json":
|
|
216
|
-
preloadJSON.call(this,
|
|
215
|
+
preloadJSON.call(this, asset, onload, onerror);
|
|
217
216
|
return 1;
|
|
218
217
|
|
|
219
218
|
case "js":
|
|
220
|
-
preloadJavascript.call(this,
|
|
219
|
+
preloadJavascript.call(this, asset, onload, onerror);
|
|
221
220
|
return 1;
|
|
222
221
|
|
|
223
222
|
case "tmx":
|
|
224
223
|
case "tsx":
|
|
225
|
-
preloadTMX.call(this,
|
|
224
|
+
preloadTMX.call(this, asset, onload, onerror);
|
|
226
225
|
return 1;
|
|
227
226
|
|
|
228
227
|
case "audio":
|
|
229
|
-
audio.load(
|
|
228
|
+
audio.load(asset, !!asset.stream, onload, onerror);
|
|
230
229
|
return 1;
|
|
231
230
|
|
|
232
231
|
case "fontface":
|
|
233
|
-
preloadFontFace.call(this,
|
|
232
|
+
preloadFontFace.call(this, asset, onload, onerror);
|
|
234
233
|
return 1;
|
|
235
234
|
|
|
236
235
|
default:
|
|
237
|
-
throw new Error("load : unknown or invalid resource type : " +
|
|
236
|
+
throw new Error("load : unknown or invalid resource type : " + asset.type);
|
|
238
237
|
}
|
|
239
238
|
}
|
|
240
239
|
|
|
241
240
|
/**
|
|
242
|
-
* unload specified
|
|
243
|
-
* @name unload
|
|
241
|
+
* unload the specified asset to free memory
|
|
244
242
|
* @memberof loader
|
|
245
|
-
* @
|
|
246
|
-
* @param {object} res
|
|
247
|
-
* @param {string} res.name - internal name of the resource
|
|
248
|
-
* @param {string} res.type - "audio", binary", "image", "json", "tmx", "tsx"
|
|
243
|
+
* @param {loader.Asset} asset
|
|
249
244
|
* @returns {boolean} true if unloaded
|
|
250
245
|
* @example me.loader.unload({name: "avatar", type:"image"});
|
|
251
246
|
*/
|
|
252
|
-
export function unload(
|
|
253
|
-
switch (
|
|
247
|
+
export function unload(asset) {
|
|
248
|
+
switch (asset.type) {
|
|
254
249
|
case "binary":
|
|
255
|
-
if (!(
|
|
250
|
+
if (!(asset.name in binList)) {
|
|
256
251
|
return false;
|
|
257
252
|
}
|
|
258
253
|
|
|
259
|
-
delete binList[
|
|
254
|
+
delete binList[asset.name];
|
|
260
255
|
return true;
|
|
261
256
|
|
|
262
257
|
case "image":
|
|
263
|
-
if (!(
|
|
258
|
+
if (!(asset.name in imgList)) {
|
|
264
259
|
return false;
|
|
265
260
|
}
|
|
266
|
-
delete imgList[
|
|
261
|
+
delete imgList[asset.name];
|
|
267
262
|
return true;
|
|
268
263
|
|
|
269
264
|
case "json":
|
|
270
|
-
if (!(
|
|
265
|
+
if (!(asset.name in jsonList)) {
|
|
271
266
|
return false;
|
|
272
267
|
}
|
|
273
268
|
|
|
274
|
-
delete jsonList[
|
|
269
|
+
delete jsonList[asset.name];
|
|
275
270
|
return true;
|
|
276
271
|
|
|
277
272
|
case "js":
|
|
@@ -284,26 +279,24 @@ export function unload(res) {
|
|
|
284
279
|
|
|
285
280
|
case "tmx":
|
|
286
281
|
case "tsx":
|
|
287
|
-
if (!(
|
|
282
|
+
if (!(asset.name in tmxList)) {
|
|
288
283
|
return false;
|
|
289
284
|
}
|
|
290
285
|
|
|
291
|
-
delete tmxList[
|
|
286
|
+
delete tmxList[asset.name];
|
|
292
287
|
return true;
|
|
293
288
|
|
|
294
289
|
case "audio":
|
|
295
|
-
return audio.unload(
|
|
290
|
+
return audio.unload(asset.name);
|
|
296
291
|
|
|
297
292
|
default:
|
|
298
|
-
throw new Error("unload : unknown or invalid resource type : " +
|
|
293
|
+
throw new Error("unload : unknown or invalid resource type : " + asset.type);
|
|
299
294
|
}
|
|
300
295
|
}
|
|
301
296
|
|
|
302
297
|
/**
|
|
303
298
|
* unload all resources to free memory
|
|
304
|
-
* @name unloadAll
|
|
305
299
|
* @memberof loader
|
|
306
|
-
* @public
|
|
307
300
|
* @example me.loader.unloadAll();
|
|
308
301
|
*/
|
|
309
302
|
export function unloadAll() {
|
|
@@ -355,9 +348,7 @@ export function unloadAll() {
|
|
|
355
348
|
|
|
356
349
|
/**
|
|
357
350
|
* return the specified TMX/TSX object
|
|
358
|
-
* @name getTMX
|
|
359
351
|
* @memberof loader
|
|
360
|
-
* @public
|
|
361
352
|
* @param {string} elt - name of the tmx/tsx element ("map1");
|
|
362
353
|
* @returns {object} requested element or null if not found
|
|
363
354
|
*/
|
|
@@ -372,9 +363,7 @@ export function getTMX(elt) {
|
|
|
372
363
|
|
|
373
364
|
/**
|
|
374
365
|
* return the specified Binary object
|
|
375
|
-
* @name getBinary
|
|
376
366
|
* @memberof loader
|
|
377
|
-
* @public
|
|
378
367
|
* @param {string} elt - name of the binary object ("ymTrack");
|
|
379
368
|
* @returns {object} requested element or null if not found
|
|
380
369
|
*/
|
|
@@ -389,9 +378,7 @@ export function getBinary(elt) {
|
|
|
389
378
|
|
|
390
379
|
/**
|
|
391
380
|
* return the specified Image Object
|
|
392
|
-
* @name getImage
|
|
393
381
|
* @memberof loader
|
|
394
|
-
* @public
|
|
395
382
|
* @param {string} image - name of the Image element ("tileset-platformer");
|
|
396
383
|
* @returns {HTMLImageElement} requested element or null if not found
|
|
397
384
|
*/
|
|
@@ -407,9 +394,7 @@ export function getImage(image) {
|
|
|
407
394
|
|
|
408
395
|
/**
|
|
409
396
|
* return the specified JSON Object
|
|
410
|
-
* @name getJSON
|
|
411
397
|
* @memberof loader
|
|
412
|
-
* @public
|
|
413
398
|
* @param {string} elt - name of the json file to load
|
|
414
399
|
* @returns {object}
|
|
415
400
|
*/
|
package/src/video/video.js
CHANGED
|
@@ -155,7 +155,7 @@ export function createCanvas(width, height, returnOffscreenCanvas = false) {
|
|
|
155
155
|
throw new Error("width or height was zero, Canvas could not be initialized !");
|
|
156
156
|
}
|
|
157
157
|
|
|
158
|
-
if (device.
|
|
158
|
+
if (device.offscreenCanvas === true && returnOffscreenCanvas === true) {
|
|
159
159
|
_canvas = new globalThis.OffscreenCanvas(0, 0);
|
|
160
160
|
// stubbing style for compatibility,
|
|
161
161
|
// as OffscreenCanvas is detached from the DOM
|