laymur 0.6.1 → 0.6.2
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.js +64 -62
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist/miscellaneous/UIColor.d.ts +4 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1888,19 +1888,19 @@ class UIColor extends i {
|
|
|
1888
1888
|
constructor(...args) {
|
|
1889
1889
|
super();
|
|
1890
1890
|
/** Internal storage for the red component (0-1). */
|
|
1891
|
-
this.
|
|
1891
|
+
this._private_rInternal = 1;
|
|
1892
1892
|
/** Internal storage for the green component (0-1). */
|
|
1893
|
-
this.
|
|
1893
|
+
this._private_gInternal = 1;
|
|
1894
1894
|
/** Internal storage for the blue component (0-1). */
|
|
1895
|
-
this.
|
|
1895
|
+
this._private_bInternal = 1;
|
|
1896
1896
|
/** Internal storage for the alpha component (0-1). */
|
|
1897
|
-
this.
|
|
1897
|
+
this._private_aInternal = 1;
|
|
1898
1898
|
if (args.length >= 3 && typeof args[0] === "number") {
|
|
1899
1899
|
const [r, g, b, a = 1] = args;
|
|
1900
|
-
this.
|
|
1901
|
-
this.
|
|
1902
|
-
this.
|
|
1903
|
-
this.
|
|
1900
|
+
this._private_rInternal = r;
|
|
1901
|
+
this._private_gInternal = g;
|
|
1902
|
+
this._private_bInternal = b;
|
|
1903
|
+
this._private_aInternal = a;
|
|
1904
1904
|
}
|
|
1905
1905
|
else if (args.length >= 1) {
|
|
1906
1906
|
const [first, a = 1] = args;
|
|
@@ -1917,35 +1917,35 @@ class UIColor extends i {
|
|
|
1917
1917
|
* @returns The red component (0-1)
|
|
1918
1918
|
*/
|
|
1919
1919
|
get r() {
|
|
1920
|
-
return this.
|
|
1920
|
+
return this._private_rInternal;
|
|
1921
1921
|
}
|
|
1922
1922
|
/**
|
|
1923
1923
|
* Gets the green component value.
|
|
1924
1924
|
* @returns The green component (0-1)
|
|
1925
1925
|
*/
|
|
1926
1926
|
get g() {
|
|
1927
|
-
return this.
|
|
1927
|
+
return this._private_gInternal;
|
|
1928
1928
|
}
|
|
1929
1929
|
/**
|
|
1930
1930
|
* Gets the blue component value.
|
|
1931
1931
|
* @returns The blue component (0-1)
|
|
1932
1932
|
*/
|
|
1933
1933
|
get b() {
|
|
1934
|
-
return this.
|
|
1934
|
+
return this._private_bInternal;
|
|
1935
1935
|
}
|
|
1936
1936
|
/**
|
|
1937
1937
|
* Gets the alpha component value.
|
|
1938
1938
|
* @returns The alpha component (0-1)
|
|
1939
1939
|
*/
|
|
1940
1940
|
get a() {
|
|
1941
|
-
return this.
|
|
1941
|
+
return this._private_aInternal;
|
|
1942
1942
|
}
|
|
1943
1943
|
/**
|
|
1944
1944
|
* Sets the red component value and emits change event.
|
|
1945
1945
|
* @param value - The red component (0-1)
|
|
1946
1946
|
*/
|
|
1947
1947
|
set r(value) {
|
|
1948
|
-
this.
|
|
1948
|
+
this._private_rInternal = value;
|
|
1949
1949
|
this.emit(UIColorEvent.CHANGE, this);
|
|
1950
1950
|
}
|
|
1951
1951
|
/**
|
|
@@ -1953,7 +1953,7 @@ class UIColor extends i {
|
|
|
1953
1953
|
* @param value - The green component (0-1)
|
|
1954
1954
|
*/
|
|
1955
1955
|
set g(value) {
|
|
1956
|
-
this.
|
|
1956
|
+
this._private_gInternal = value;
|
|
1957
1957
|
this.emit(UIColorEvent.CHANGE, this);
|
|
1958
1958
|
}
|
|
1959
1959
|
/**
|
|
@@ -1961,7 +1961,7 @@ class UIColor extends i {
|
|
|
1961
1961
|
* @param value - The blue component (0-1)
|
|
1962
1962
|
*/
|
|
1963
1963
|
set b(value) {
|
|
1964
|
-
this.
|
|
1964
|
+
this._private_bInternal = value;
|
|
1965
1965
|
this.emit(UIColorEvent.CHANGE, this);
|
|
1966
1966
|
}
|
|
1967
1967
|
/**
|
|
@@ -1969,7 +1969,7 @@ class UIColor extends i {
|
|
|
1969
1969
|
* @param value - The alpha component (0-1)
|
|
1970
1970
|
*/
|
|
1971
1971
|
set a(value) {
|
|
1972
|
-
this.
|
|
1972
|
+
this._private_aInternal = value;
|
|
1973
1973
|
this.emit(UIColorEvent.CHANGE, this);
|
|
1974
1974
|
}
|
|
1975
1975
|
/**
|
|
@@ -1980,11 +1980,11 @@ class UIColor extends i {
|
|
|
1980
1980
|
* @param a - Alpha component (0-1), defaults to current alpha value
|
|
1981
1981
|
* @returns This UIColor instance for method chaining
|
|
1982
1982
|
*/
|
|
1983
|
-
set(r, g, b, a = this.
|
|
1984
|
-
this.
|
|
1985
|
-
this.
|
|
1986
|
-
this.
|
|
1987
|
-
this.
|
|
1983
|
+
set(r, g, b, a = this._private_aInternal) {
|
|
1984
|
+
this._private_rInternal = r;
|
|
1985
|
+
this._private_gInternal = g;
|
|
1986
|
+
this._private_bInternal = b;
|
|
1987
|
+
this._private_aInternal = a;
|
|
1988
1988
|
this.emit(UIColorEvent.CHANGE, this);
|
|
1989
1989
|
return this;
|
|
1990
1990
|
}
|
|
@@ -1993,26 +1993,26 @@ class UIColor extends i {
|
|
|
1993
1993
|
* @returns Hexadecimal RGBA value with alpha in the most significant byte
|
|
1994
1994
|
*/
|
|
1995
1995
|
getHexRGBA() {
|
|
1996
|
-
return ((Math.round(this.
|
|
1997
|
-
(Math.round(this.
|
|
1998
|
-
(Math.round(this.
|
|
1999
|
-
Math.round(this.
|
|
1996
|
+
return ((Math.round(this._private_rInternal * 255) << 24) |
|
|
1997
|
+
(Math.round(this._private_gInternal * 255) << 16) |
|
|
1998
|
+
(Math.round(this._private_bInternal * 255) << 8) |
|
|
1999
|
+
Math.round(this._private_aInternal * 255));
|
|
2000
2000
|
}
|
|
2001
2001
|
/**
|
|
2002
2002
|
* Converts the color to a 24-bit hexadecimal RGB value (ignores alpha).
|
|
2003
2003
|
* @returns Hexadecimal RGB value (e.g., 0xFF0000 for red)
|
|
2004
2004
|
*/
|
|
2005
2005
|
getHexRGB() {
|
|
2006
|
-
return ((Math.round(this.
|
|
2007
|
-
(Math.round(this.
|
|
2008
|
-
Math.round(this.
|
|
2006
|
+
return ((Math.round(this._private_rInternal * 255) << 16) |
|
|
2007
|
+
(Math.round(this._private_gInternal * 255) << 8) |
|
|
2008
|
+
Math.round(this._private_bInternal * 255));
|
|
2009
2009
|
}
|
|
2010
2010
|
/**
|
|
2011
2011
|
* Converts the color to HSL (Hue, Saturation, Lightness) format.
|
|
2012
2012
|
* @returns Object containing h (0-360), s (0-1), and l (0-1) values
|
|
2013
2013
|
*/
|
|
2014
2014
|
getHSL() {
|
|
2015
|
-
const {
|
|
2015
|
+
const { _private_rInternal: r, _private_gInternal: g, _private_bInternal: b } = this;
|
|
2016
2016
|
const max = Math.max(r, g, b);
|
|
2017
2017
|
const min = Math.min(r, g, b);
|
|
2018
2018
|
const d = max - min;
|
|
@@ -2039,10 +2039,10 @@ class UIColor extends i {
|
|
|
2039
2039
|
* @returns This UIColor instance for method chaining
|
|
2040
2040
|
*/
|
|
2041
2041
|
setHexRGBA(hex) {
|
|
2042
|
-
this.
|
|
2043
|
-
this.
|
|
2044
|
-
this.
|
|
2045
|
-
this.
|
|
2042
|
+
this._private_rInternal = ((hex >> 16) & 0xff) / 255;
|
|
2043
|
+
this._private_gInternal = ((hex >> 8) & 0xff) / 255;
|
|
2044
|
+
this._private_bInternal = (hex & 0xff) / 255;
|
|
2045
|
+
this._private_aInternal = ((hex >> 24) & 0xff) / 255;
|
|
2046
2046
|
this.emit(UIColorEvent.CHANGE, this);
|
|
2047
2047
|
return this;
|
|
2048
2048
|
}
|
|
@@ -2052,11 +2052,11 @@ class UIColor extends i {
|
|
|
2052
2052
|
* @param a - Alpha value (0-1), defaults to current alpha
|
|
2053
2053
|
* @returns This UIColor instance for method chaining
|
|
2054
2054
|
*/
|
|
2055
|
-
setHexRGB(hex, a = this.
|
|
2056
|
-
this.
|
|
2057
|
-
this.
|
|
2058
|
-
this.
|
|
2059
|
-
this.
|
|
2055
|
+
setHexRGB(hex, a = this._private_aInternal) {
|
|
2056
|
+
this._private_rInternal = ((hex >> 16) & 0xff) / 255;
|
|
2057
|
+
this._private_gInternal = ((hex >> 8) & 0xff) / 255;
|
|
2058
|
+
this._private_bInternal = (hex & 0xff) / 255;
|
|
2059
|
+
this._private_aInternal = a;
|
|
2060
2060
|
this.emit(UIColorEvent.CHANGE, this);
|
|
2061
2061
|
return this;
|
|
2062
2062
|
}
|
|
@@ -2068,7 +2068,7 @@ class UIColor extends i {
|
|
|
2068
2068
|
* @param a - Alpha value (0-1), defaults to current alpha
|
|
2069
2069
|
* @returns This UIColor instance for method chaining
|
|
2070
2070
|
*/
|
|
2071
|
-
setHSL(h, s, l, a = this.
|
|
2071
|
+
setHSL(h, s, l, a = this._private_aInternal) {
|
|
2072
2072
|
const c = (1 - Math.abs(2 * l - 1)) * s;
|
|
2073
2073
|
const hp = h / 60;
|
|
2074
2074
|
const x = c * (1 - Math.abs((hp % 2) - 1));
|
|
@@ -2093,7 +2093,7 @@ class UIColor extends i {
|
|
|
2093
2093
|
* @returns This UIColor instance for method chaining
|
|
2094
2094
|
* @throws Will throw an error if the color name is not recognized
|
|
2095
2095
|
*/
|
|
2096
|
-
setName(colorName, a = this.
|
|
2096
|
+
setName(colorName, a = this._private_aInternal) {
|
|
2097
2097
|
const normalizedName = colorName.toLowerCase().trim();
|
|
2098
2098
|
const hex = COLOR_NAMES[normalizedName];
|
|
2099
2099
|
if (hex === undefined) {
|
|
@@ -2108,26 +2108,26 @@ class UIColor extends i {
|
|
|
2108
2108
|
*/
|
|
2109
2109
|
copy(color) {
|
|
2110
2110
|
if (color instanceof UIColor) {
|
|
2111
|
-
if (this.
|
|
2112
|
-
this.
|
|
2113
|
-
this.
|
|
2114
|
-
this.
|
|
2115
|
-
this.
|
|
2116
|
-
this.
|
|
2117
|
-
this.
|
|
2118
|
-
this.
|
|
2111
|
+
if (this._private_rInternal !== color._private_rInternal &&
|
|
2112
|
+
this._private_gInternal !== color._private_gInternal &&
|
|
2113
|
+
this._private_bInternal !== color._private_bInternal &&
|
|
2114
|
+
this._private_aInternal !== color._private_aInternal) {
|
|
2115
|
+
this._private_rInternal = color._private_rInternal;
|
|
2116
|
+
this._private_gInternal = color._private_gInternal;
|
|
2117
|
+
this._private_bInternal = color._private_bInternal;
|
|
2118
|
+
this._private_aInternal = color._private_aInternal;
|
|
2119
2119
|
this.emit(UIColorEvent.CHANGE, this);
|
|
2120
2120
|
}
|
|
2121
2121
|
}
|
|
2122
2122
|
else {
|
|
2123
|
-
if (this.
|
|
2124
|
-
this.
|
|
2125
|
-
this.
|
|
2126
|
-
this.
|
|
2127
|
-
this.
|
|
2128
|
-
this.
|
|
2129
|
-
this.
|
|
2130
|
-
this.
|
|
2123
|
+
if (this._private_rInternal !== color.r &&
|
|
2124
|
+
this._private_gInternal !== color.g &&
|
|
2125
|
+
this._private_bInternal !== color.b &&
|
|
2126
|
+
this._private_aInternal !== 1) {
|
|
2127
|
+
this._private_rInternal = color.r;
|
|
2128
|
+
this._private_gInternal = color.g;
|
|
2129
|
+
this._private_bInternal = color.b;
|
|
2130
|
+
this._private_aInternal = 1;
|
|
2131
2131
|
this.emit(UIColorEvent.CHANGE, this);
|
|
2132
2132
|
}
|
|
2133
2133
|
}
|
|
@@ -2138,17 +2138,17 @@ class UIColor extends i {
|
|
|
2138
2138
|
* @returns CSS rgba string (e.g., "rgba(255, 0, 0, 1)")
|
|
2139
2139
|
*/
|
|
2140
2140
|
toCSSColor() {
|
|
2141
|
-
const r = Math.round(this.
|
|
2142
|
-
const g = Math.round(this.
|
|
2143
|
-
const b = Math.round(this.
|
|
2144
|
-
return `rgba(${r}, ${g}, ${b}, ${this.
|
|
2141
|
+
const r = Math.round(this._private_rInternal * 255);
|
|
2142
|
+
const g = Math.round(this._private_gInternal * 255);
|
|
2143
|
+
const b = Math.round(this._private_bInternal * 255);
|
|
2144
|
+
return `rgba(${r}, ${g}, ${b}, ${this._private_aInternal})`;
|
|
2145
2145
|
}
|
|
2146
2146
|
/**
|
|
2147
2147
|
* Creates a new UIColor instance with identical color values.
|
|
2148
2148
|
* @returns A new UIColor instance with the same RGBA values
|
|
2149
2149
|
*/
|
|
2150
2150
|
clone() {
|
|
2151
|
-
return new UIColor(this.
|
|
2151
|
+
return new UIColor(this._private_rInternal, this._private_gInternal, this._private_bInternal, this._private_aInternal);
|
|
2152
2152
|
}
|
|
2153
2153
|
}
|
|
2154
2154
|
|
|
@@ -6809,7 +6809,9 @@ class UIFullscreenLayer extends UILayer {
|
|
|
6809
6809
|
const scaledX = x * scale;
|
|
6810
6810
|
const scaledY = y * scale;
|
|
6811
6811
|
this[pointerFunctionName](scaledX, scaledY, event.pointerId);
|
|
6812
|
-
this.
|
|
6812
|
+
if (this.mode === UIMode.INTERACTIVE) {
|
|
6813
|
+
this.emit(inputEvent, scaledX, scaledY, event.pointerId);
|
|
6814
|
+
}
|
|
6813
6815
|
}
|
|
6814
6816
|
}
|
|
6815
6817
|
|