tela.js 1.2.20 → 1.2.22
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/package.json
CHANGED
package/src/Camera2D/Camera2D.js
CHANGED
|
@@ -74,7 +74,10 @@ export default class Camera2D {
|
|
|
74
74
|
|
|
75
75
|
toWorldCoord(x, canvas) {
|
|
76
76
|
const size = Vec2(canvas.width, canvas.height);
|
|
77
|
-
return
|
|
77
|
+
return Vec2(
|
|
78
|
+
(x.x / size.x) * this.box.diagonal.x + this.box.min.x,
|
|
79
|
+
(x.y / size.y) * this.box.diagonal.y + this.box.min.y
|
|
80
|
+
);
|
|
78
81
|
}
|
|
79
82
|
|
|
80
83
|
static deserialize(json) {
|
|
@@ -125,7 +128,7 @@ function rasterTriangle(triangle, camera, canvas) {
|
|
|
125
128
|
const alpha = - (v.x * p.y - v.y * p.x) * invDet;
|
|
126
129
|
const beta = (u.x * p.y - u.y * p.x) * invDet;
|
|
127
130
|
const gamma = 1 - alpha - beta;
|
|
128
|
-
|
|
131
|
+
|
|
129
132
|
// compute color
|
|
130
133
|
let c = Color.ofRGB(
|
|
131
134
|
c1[0] * gamma + c2[0] * alpha + c3[0] * beta,
|
package/src/Scene/NaiveScene.js
CHANGED
package/src/Utils/Fonts.js
CHANGED
|
@@ -16,7 +16,8 @@ try {
|
|
|
16
16
|
fontImage = await or(
|
|
17
17
|
() => TELA.ofUrl(`../src/Utils/sdf_font.png`),
|
|
18
18
|
() => TELA.ofUrl(`./src/Utils/sdf_font.png`),
|
|
19
|
-
() => TELA.ofUrl(`./node_modules/tela.js/src/Utils/sdf_font.png`)
|
|
19
|
+
() => TELA.ofUrl(`./node_modules/tela.js/src/Utils/sdf_font.png`),
|
|
20
|
+
() => TELA.ofUrl(`https://cdn.jsdelivr.net/npm/tela.js/src/Utils/sdf_font.png`)
|
|
20
21
|
);
|
|
21
22
|
fontImageWidth = fontImage.width;
|
|
22
23
|
fontImageHeight = fontImage.height;
|