laymur 0.3.9 → 0.3.11
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/elements/UIElement.d.ts +16 -0
- package/dist/index.js +27 -2
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -69,6 +69,22 @@ export declare abstract class UIElement extends UIAnchor implements UIPlaneEleme
|
|
|
69
69
|
* @returns The current height dimension
|
|
70
70
|
*/
|
|
71
71
|
get height(): number;
|
|
72
|
+
/**
|
|
73
|
+
* The right edge X coordinate of this element (x + width).
|
|
74
|
+
*/
|
|
75
|
+
get oppositeX(): number;
|
|
76
|
+
/**
|
|
77
|
+
* The bottom edge Y coordinate of this element (y + height).
|
|
78
|
+
*/
|
|
79
|
+
get oppositeY(): number;
|
|
80
|
+
/**
|
|
81
|
+
* The X coordinate of the center of this element.
|
|
82
|
+
*/
|
|
83
|
+
get centerX(): number;
|
|
84
|
+
/**
|
|
85
|
+
* The Y coordinate of the center of this element.
|
|
86
|
+
*/
|
|
87
|
+
get centerY(): number;
|
|
72
88
|
/**
|
|
73
89
|
* Gets the current z-index (depth) value.
|
|
74
90
|
* @returns The current z-index value
|
package/dist/index.js
CHANGED
|
@@ -2159,7 +2159,7 @@ var UITransparencyMode;
|
|
|
2159
2159
|
UITransparencyMode[UITransparencyMode["BLEND"] = 2] = "BLEND";
|
|
2160
2160
|
})(UITransparencyMode || (UITransparencyMode = {}));
|
|
2161
2161
|
|
|
2162
|
-
var fragmentShader = "in vec2 io_UV;\n\nuniform float alphaTest;\n\n#include <common>\n#include <alphahash_pars_fragment>\n";
|
|
2162
|
+
var fragmentShader = "in vec2 io_UV;\n\nuniform float alphaTest;\nuniform mat3 uvTransform;\n\n#include <common>\n#include <alphahash_pars_fragment>\n";
|
|
2163
2163
|
|
|
2164
2164
|
var vertexShader = "out vec2 io_UV;\n#include <common>\n\nvoid main() {\n #include <begin_vertex>\n io_UV = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n";
|
|
2165
2165
|
|
|
@@ -4807,6 +4807,30 @@ class UIElement extends UIAnchor {
|
|
|
4807
4807
|
get height() {
|
|
4808
4808
|
return this.solverWrapper.readVariableValue(this.hVariable);
|
|
4809
4809
|
}
|
|
4810
|
+
/**
|
|
4811
|
+
* The right edge X coordinate of this element (x + width).
|
|
4812
|
+
*/
|
|
4813
|
+
get oppositeX() {
|
|
4814
|
+
return this.x + this.width;
|
|
4815
|
+
}
|
|
4816
|
+
/**
|
|
4817
|
+
* The bottom edge Y coordinate of this element (y + height).
|
|
4818
|
+
*/
|
|
4819
|
+
get oppositeY() {
|
|
4820
|
+
return this.y + this.height;
|
|
4821
|
+
}
|
|
4822
|
+
/**
|
|
4823
|
+
* The X coordinate of the center of this element.
|
|
4824
|
+
*/
|
|
4825
|
+
get centerX() {
|
|
4826
|
+
return this.x + this.width / 2;
|
|
4827
|
+
}
|
|
4828
|
+
/**
|
|
4829
|
+
* The Y coordinate of the center of this element.
|
|
4830
|
+
*/
|
|
4831
|
+
get centerY() {
|
|
4832
|
+
return this.y + this.height / 2;
|
|
4833
|
+
}
|
|
4810
4834
|
/**
|
|
4811
4835
|
* Gets the current z-index (depth) value.
|
|
4812
4836
|
* @returns The current z-index value
|
|
@@ -4949,7 +4973,7 @@ class UIElement extends UIAnchor {
|
|
|
4949
4973
|
}
|
|
4950
4974
|
}
|
|
4951
4975
|
|
|
4952
|
-
var source$2 = "void main() {\n vec4 diffuseColor = texture(map,
|
|
4976
|
+
var source$2 = "void main() {\n vec2 transformedUV = (vec3(io_UV, 1.0) * uvTransform).xy;\n vec4 diffuseColor = texture(map, transformedUV) * color;\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n gl_FragColor = diffuseColor;\n #include <colorspace_fragment>\n}\n";
|
|
4953
4977
|
|
|
4954
4978
|
/**
|
|
4955
4979
|
* UI element for displaying textured images.
|
|
@@ -4980,6 +5004,7 @@ class UIImage extends UIElement {
|
|
|
4980
5004
|
const color = options.color ?? new UIColor();
|
|
4981
5005
|
super(layer, options.x ?? 0, options.y ?? 0, w, h, source$2, {
|
|
4982
5006
|
map: texture,
|
|
5007
|
+
uvTransform: texture.matrix,
|
|
4983
5008
|
color,
|
|
4984
5009
|
});
|
|
4985
5010
|
/** Event handler for when the color changes */
|