modern-canvas 0.8.7 → 0.8.9
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 +41 -13
- package/dist/index.d.cts +4 -1
- package/dist/index.d.mts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +10 -10
- package/dist/index.mjs +41 -13
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -5977,6 +5977,19 @@ let Node = class extends CoreObject {
|
|
|
5977
5977
|
return false;
|
|
5978
5978
|
}
|
|
5979
5979
|
}
|
|
5980
|
+
canInput() {
|
|
5981
|
+
if (!this._tree)
|
|
5982
|
+
return false;
|
|
5983
|
+
switch (this.inputMode) {
|
|
5984
|
+
case "inherit":
|
|
5985
|
+
return this._parent?.canInput() ?? true;
|
|
5986
|
+
case "always":
|
|
5987
|
+
return true;
|
|
5988
|
+
case "disabled":
|
|
5989
|
+
default:
|
|
5990
|
+
return false;
|
|
5991
|
+
}
|
|
5992
|
+
}
|
|
5980
5993
|
canRender() {
|
|
5981
5994
|
if (!this._tree)
|
|
5982
5995
|
return false;
|
|
@@ -6087,7 +6100,9 @@ let Node = class extends CoreObject {
|
|
|
6087
6100
|
if (event.propagationStopped) {
|
|
6088
6101
|
return;
|
|
6089
6102
|
}
|
|
6090
|
-
this.
|
|
6103
|
+
if (this.canInput()) {
|
|
6104
|
+
this._input(event, key);
|
|
6105
|
+
}
|
|
6091
6106
|
}
|
|
6092
6107
|
getIndex() {
|
|
6093
6108
|
return this._parent?.children.getInternal(this.internalMode).indexOf(this) ?? 0;
|
|
@@ -6311,6 +6326,9 @@ __decorateClass$S([
|
|
|
6311
6326
|
__decorateClass$S([
|
|
6312
6327
|
property({ protected: true, fallback: "inherit" })
|
|
6313
6328
|
], Node.prototype, "renderMode", 2);
|
|
6329
|
+
__decorateClass$S([
|
|
6330
|
+
property({ protected: true, fallback: "inherit" })
|
|
6331
|
+
], Node.prototype, "inputMode", 2);
|
|
6314
6332
|
__decorateClass$S([
|
|
6315
6333
|
property({ protected: true, fallback: "default" })
|
|
6316
6334
|
], Node.prototype, "internalMode", 2);
|
|
@@ -14422,21 +14440,31 @@ class Engine extends SceneTree {
|
|
|
14422
14440
|
const canvas1 = document.createElement("canvas");
|
|
14423
14441
|
canvas1.width = imageData.width;
|
|
14424
14442
|
canvas1.height = imageData.height;
|
|
14425
|
-
canvas1.getContext("2d")
|
|
14443
|
+
const ctx1 = canvas1.getContext("2d");
|
|
14444
|
+
if (ctx1) {
|
|
14445
|
+
ctx1.fillStyle = "rgba(0, 0, 0, 0)";
|
|
14446
|
+
ctx1.clearRect(0, 0, canvas1.width, canvas1.height);
|
|
14447
|
+
ctx1.putImageData(imageData, 0, 0);
|
|
14448
|
+
}
|
|
14426
14449
|
const canvas2 = document.createElement("canvas");
|
|
14427
14450
|
canvas2.width = this.width;
|
|
14428
14451
|
canvas2.height = this.height;
|
|
14429
|
-
canvas2.getContext("2d")
|
|
14430
|
-
|
|
14431
|
-
0,
|
|
14432
|
-
0,
|
|
14433
|
-
|
|
14434
|
-
|
|
14435
|
-
|
|
14436
|
-
|
|
14437
|
-
|
|
14438
|
-
|
|
14439
|
-
|
|
14452
|
+
const ctx2 = canvas2.getContext("2d");
|
|
14453
|
+
if (ctx2) {
|
|
14454
|
+
ctx2.fillStyle = "rgba(0, 0, 0, 0)";
|
|
14455
|
+
ctx2.clearRect(0, 0, canvas2.width, canvas2.height);
|
|
14456
|
+
ctx2.drawImage(
|
|
14457
|
+
canvas1,
|
|
14458
|
+
0,
|
|
14459
|
+
0,
|
|
14460
|
+
canvas1.width,
|
|
14461
|
+
canvas1.height,
|
|
14462
|
+
0,
|
|
14463
|
+
0,
|
|
14464
|
+
canvas2.width,
|
|
14465
|
+
canvas2.height
|
|
14466
|
+
);
|
|
14467
|
+
}
|
|
14440
14468
|
return canvas2;
|
|
14441
14469
|
}
|
|
14442
14470
|
}
|