laymur 0.10.0 → 0.10.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 +46 -5
- 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 +25 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Vector4, PlaneGeometry,
|
|
1
|
+
import { Color, Vector4, PlaneGeometry, Scene, OrthographicCamera, ShaderMaterial, Mesh, Texture, Vector2, Vector3, Matrix2, Matrix3, Matrix4, MathUtils, Quaternion, CanvasTexture, LinearFilter, WebGLRenderTarget, UnsignedByteType, RGBAFormat, PerspectiveCamera, InstancedBufferGeometry, InstancedBufferAttribute } from 'three';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Mathematical expression builder for constraint equations in the UI layout system.
|
|
@@ -1895,12 +1895,18 @@ class UIColor extends i {
|
|
|
1895
1895
|
this._private_aInternal = a;
|
|
1896
1896
|
}
|
|
1897
1897
|
else if (args.length >= 1) {
|
|
1898
|
-
const [
|
|
1899
|
-
if (typeof
|
|
1900
|
-
this.setColorName(
|
|
1898
|
+
const [firstArgument, a = 1] = args;
|
|
1899
|
+
if (typeof firstArgument === "string") {
|
|
1900
|
+
this.setColorName(firstArgument, a);
|
|
1901
|
+
}
|
|
1902
|
+
else if (firstArgument instanceof Color) {
|
|
1903
|
+
this._private_rInternal = firstArgument.r;
|
|
1904
|
+
this._private_gInternal = firstArgument.g;
|
|
1905
|
+
this._private_bInternal = firstArgument.b;
|
|
1906
|
+
this._private_aInternal = a;
|
|
1901
1907
|
}
|
|
1902
1908
|
else {
|
|
1903
|
-
this.setHexRGB(
|
|
1909
|
+
this.setHexRGB(firstArgument, a);
|
|
1904
1910
|
}
|
|
1905
1911
|
}
|
|
1906
1912
|
}
|
|
@@ -2277,6 +2283,28 @@ class UIColor extends i {
|
|
|
2277
2283
|
}
|
|
2278
2284
|
return this.setHexRGB(hex, a);
|
|
2279
2285
|
}
|
|
2286
|
+
/**
|
|
2287
|
+
* Sets color from Three.js Color object.
|
|
2288
|
+
*
|
|
2289
|
+
* @param threeColor - Three.js Color object
|
|
2290
|
+
* @param a - Alpha (0-1)
|
|
2291
|
+
* @returns This instance
|
|
2292
|
+
*/
|
|
2293
|
+
setThreeColor(threeColor, a = this._private_aInternal) {
|
|
2294
|
+
this._private_ensureRGBUpdatedFromHSL();
|
|
2295
|
+
if (threeColor.r !== this._private_rInternal ||
|
|
2296
|
+
threeColor.g !== this._private_gInternal ||
|
|
2297
|
+
threeColor.b !== this._private_bInternal ||
|
|
2298
|
+
a !== this._private_aInternal) {
|
|
2299
|
+
this._private_rInternal = threeColor.r;
|
|
2300
|
+
this._private_gInternal = threeColor.g;
|
|
2301
|
+
this._private_bInternal = threeColor.b;
|
|
2302
|
+
this._private_aInternal = a;
|
|
2303
|
+
this._private_hslDirty = true;
|
|
2304
|
+
this.emit(UIColorEvent.CHANGE, this);
|
|
2305
|
+
}
|
|
2306
|
+
return this;
|
|
2307
|
+
}
|
|
2280
2308
|
/**
|
|
2281
2309
|
* Returns CSS rgba() string.
|
|
2282
2310
|
*/
|
|
@@ -2301,6 +2329,19 @@ class UIColor extends i {
|
|
|
2301
2329
|
result.w = this._private_aInternal;
|
|
2302
2330
|
return result;
|
|
2303
2331
|
}
|
|
2332
|
+
/**
|
|
2333
|
+
* Converts color to Three.js Color object (without alpha).
|
|
2334
|
+
*
|
|
2335
|
+
* @param result - Color object to store the result
|
|
2336
|
+
* @returns Color with RGB values
|
|
2337
|
+
*/
|
|
2338
|
+
toThreeColor(result = new Color()) {
|
|
2339
|
+
this._private_ensureRGBUpdatedFromHSL();
|
|
2340
|
+
result.r = this._private_rInternal;
|
|
2341
|
+
result.g = this._private_gInternal;
|
|
2342
|
+
result.b = this._private_bInternal;
|
|
2343
|
+
return result;
|
|
2344
|
+
}
|
|
2304
2345
|
/**
|
|
2305
2346
|
* Copies values from another color.
|
|
2306
2347
|
*
|