modern-canvas 0.4.11 → 0.4.12
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/index.cjs +23 -11
- package/dist/index.d.cts +3 -0
- package/dist/index.d.mts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +14 -14
- package/dist/index.mjs +23 -11
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -3213,8 +3213,8 @@ class WebGLFramebufferModule extends WebGLModule {
|
|
|
3213
3213
|
this._renderer.viewport.bind({
|
|
3214
3214
|
x: 0,
|
|
3215
3215
|
y: 0,
|
|
3216
|
-
width: this._renderer.screen.width,
|
|
3217
|
-
height: this._renderer.screen.height
|
|
3216
|
+
width: this._renderer.screen.width * this._renderer.pixelRatio,
|
|
3217
|
+
height: this._renderer.screen.height * this._renderer.pixelRatio
|
|
3218
3218
|
});
|
|
3219
3219
|
}
|
|
3220
3220
|
}
|
|
@@ -5788,6 +5788,14 @@ let Node = class extends CoreObject {
|
|
|
5788
5788
|
return false;
|
|
5789
5789
|
}
|
|
5790
5790
|
}
|
|
5791
|
+
_update(changed) {
|
|
5792
|
+
this._tree?.log(this.name, "updating");
|
|
5793
|
+
super._update(changed);
|
|
5794
|
+
}
|
|
5795
|
+
_updateProperty(key, value, oldValue, declaration) {
|
|
5796
|
+
this._tree?.log(this.name, `updating [${String(key)}]`);
|
|
5797
|
+
super._updateProperty(key, value, oldValue, declaration);
|
|
5798
|
+
}
|
|
5791
5799
|
_onTreeEnter(tree) {
|
|
5792
5800
|
this._treeEnter(tree);
|
|
5793
5801
|
this.emit("treeEntered", tree);
|
|
@@ -6291,8 +6299,8 @@ let Viewport = class extends Node {
|
|
|
6291
6299
|
if (this.valid) {
|
|
6292
6300
|
renderer.flush();
|
|
6293
6301
|
this._tree?.setCurrentViewport(this);
|
|
6294
|
-
renderer.framebuffer.bind(this._glFramebuffer(renderer));
|
|
6295
6302
|
this.upload(renderer);
|
|
6303
|
+
renderer.framebuffer.bind(this._glFramebuffer(renderer));
|
|
6296
6304
|
return true;
|
|
6297
6305
|
}
|
|
6298
6306
|
return false;
|
|
@@ -8359,14 +8367,12 @@ class SceneTree extends MainLoop {
|
|
|
8359
8367
|
}
|
|
8360
8368
|
_renderScreen(renderer) {
|
|
8361
8369
|
renderer.state.reset();
|
|
8362
|
-
const { pixelRatio } = renderer;
|
|
8363
|
-
const { width, height } = this.root;
|
|
8364
8370
|
renderer.framebuffer.bind(null);
|
|
8365
8371
|
renderer.viewport.bind({
|
|
8366
8372
|
x: 0,
|
|
8367
8373
|
y: 0,
|
|
8368
|
-
width: width * pixelRatio,
|
|
8369
|
-
height: height * pixelRatio
|
|
8374
|
+
width: this.root.width * renderer.pixelRatio,
|
|
8375
|
+
height: this.root.height * renderer.pixelRatio
|
|
8370
8376
|
});
|
|
8371
8377
|
if (this.backgroundColor) {
|
|
8372
8378
|
renderer.gl.clearColor(...this._backgroundColor.toArray());
|
|
@@ -13187,8 +13193,9 @@ class Engine extends SceneTree {
|
|
|
13187
13193
|
await this.nextTick();
|
|
13188
13194
|
}
|
|
13189
13195
|
async waitAndRender(delta = 0) {
|
|
13196
|
+
await assets.waitUntilLoad();
|
|
13190
13197
|
this._process(delta);
|
|
13191
|
-
await this.
|
|
13198
|
+
await this.nextTick();
|
|
13192
13199
|
this._render(this.renderer);
|
|
13193
13200
|
}
|
|
13194
13201
|
render(delta = 0) {
|
|
@@ -13260,11 +13267,16 @@ async function start(sleep = 100) {
|
|
|
13260
13267
|
starting = false;
|
|
13261
13268
|
}
|
|
13262
13269
|
async function task(options) {
|
|
13263
|
-
const { data, width, height, time = 0 } = options;
|
|
13264
|
-
engine ??= new Engine({
|
|
13270
|
+
const { data, width, height, debug = false, time = 0 } = options;
|
|
13271
|
+
engine ??= new Engine({
|
|
13272
|
+
width: 1,
|
|
13273
|
+
height: 1,
|
|
13274
|
+
preserveDrawingBuffer: true
|
|
13275
|
+
});
|
|
13276
|
+
engine.debug = debug;
|
|
13265
13277
|
engine.root.removeChildren();
|
|
13266
13278
|
engine.timeline.currentTime = time;
|
|
13267
|
-
engine.resize(width, height);
|
|
13279
|
+
engine.resize(width, height, true);
|
|
13268
13280
|
(Array.isArray(data) ? data : [data]).forEach((v) => {
|
|
13269
13281
|
if (v instanceof Node) {
|
|
13270
13282
|
engine.root.appendChild(v);
|