laymur 0.3.23 → 0.3.24
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/UIGraphics.d.ts +4 -12
- package/dist/index.js +15 -16
- 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 +5 -0
- package/package.json +1 -1
|
@@ -39,14 +39,6 @@ export declare class UIGraphics extends UIElement {
|
|
|
39
39
|
* @param options - Configuration options for the graphics element
|
|
40
40
|
*/
|
|
41
41
|
constructor(layer: UILayer, options?: UIGraphicsOptions);
|
|
42
|
-
/**
|
|
43
|
-
* Gets the canvas width.
|
|
44
|
-
*/
|
|
45
|
-
get canvasWidth(): number;
|
|
46
|
-
/**
|
|
47
|
-
* Gets the canvas height.
|
|
48
|
-
*/
|
|
49
|
-
get canvasHeight(): number;
|
|
50
42
|
/**
|
|
51
43
|
* Gets the current color tint applied to the graphics.
|
|
52
44
|
*/
|
|
@@ -58,9 +50,9 @@ export declare class UIGraphics extends UIElement {
|
|
|
58
50
|
/**
|
|
59
51
|
* Clears the canvas with optional fill color.
|
|
60
52
|
*
|
|
61
|
-
* @param fillColor - Optional color to fill after clearing
|
|
53
|
+
* @param fillColor - Optional color to fill after clearing
|
|
62
54
|
*/
|
|
63
|
-
clear(fillColor?:
|
|
55
|
+
clear(fillColor?: UIColor): this;
|
|
64
56
|
/**
|
|
65
57
|
* Draws a rectangle on the canvas.
|
|
66
58
|
*/
|
|
@@ -104,11 +96,11 @@ export declare class UIGraphics extends UIElement {
|
|
|
104
96
|
/**
|
|
105
97
|
* Sets the fill style.
|
|
106
98
|
*/
|
|
107
|
-
setFillStyle(style:
|
|
99
|
+
setFillStyle(style: UIColor | CanvasGradient | CanvasPattern): this;
|
|
108
100
|
/**
|
|
109
101
|
* Sets the stroke style.
|
|
110
102
|
*/
|
|
111
|
-
setStrokeStyle(style:
|
|
103
|
+
setStrokeStyle(style: UIColor | CanvasGradient | CanvasPattern): this;
|
|
112
104
|
/**
|
|
113
105
|
* Sets the line width.
|
|
114
106
|
*/
|
package/dist/index.js
CHANGED
|
@@ -2133,6 +2133,16 @@ class UIColor extends i {
|
|
|
2133
2133
|
}
|
|
2134
2134
|
return this;
|
|
2135
2135
|
}
|
|
2136
|
+
/**
|
|
2137
|
+
* Converts the color to a CSS rgba() string.
|
|
2138
|
+
* @returns CSS rgba string (e.g., "rgba(255, 0, 0, 1)")
|
|
2139
|
+
*/
|
|
2140
|
+
toCSSColor() {
|
|
2141
|
+
const r = Math.round(this.rInternal * 255);
|
|
2142
|
+
const g = Math.round(this.gInternal * 255);
|
|
2143
|
+
const b = Math.round(this.bInternal * 255);
|
|
2144
|
+
return `rgba(${r}, ${g}, ${b}, ${this.aInternal})`;
|
|
2145
|
+
}
|
|
2136
2146
|
/**
|
|
2137
2147
|
* Creates a new UIColor instance with identical color values.
|
|
2138
2148
|
* @returns A new UIColor instance with the same RGBA values
|
|
@@ -5254,18 +5264,6 @@ class UIGraphics extends UIElement {
|
|
|
5254
5264
|
this._private_colorInternal = color;
|
|
5255
5265
|
this._private_colorInternal.on(UIColorEvent.CHANGE, this._private_onColorChange);
|
|
5256
5266
|
}
|
|
5257
|
-
/**
|
|
5258
|
-
* Gets the canvas width.
|
|
5259
|
-
*/
|
|
5260
|
-
get canvasWidth() {
|
|
5261
|
-
return this._private_canvas.width;
|
|
5262
|
-
}
|
|
5263
|
-
/**
|
|
5264
|
-
* Gets the canvas height.
|
|
5265
|
-
*/
|
|
5266
|
-
get canvasHeight() {
|
|
5267
|
-
return this._private_canvas.height;
|
|
5268
|
-
}
|
|
5269
5267
|
/**
|
|
5270
5268
|
* Gets the current color tint applied to the graphics.
|
|
5271
5269
|
*/
|
|
@@ -5281,12 +5279,12 @@ class UIGraphics extends UIElement {
|
|
|
5281
5279
|
/**
|
|
5282
5280
|
* Clears the canvas with optional fill color.
|
|
5283
5281
|
*
|
|
5284
|
-
* @param fillColor - Optional color to fill after clearing
|
|
5282
|
+
* @param fillColor - Optional color to fill after clearing
|
|
5285
5283
|
*/
|
|
5286
5284
|
clear(fillColor) {
|
|
5287
5285
|
this._private_ctx.clearRect(0, 0, this._private_canvas.width, this._private_canvas.height);
|
|
5288
5286
|
if (fillColor !== undefined) {
|
|
5289
|
-
this._private_ctx.fillStyle = fillColor;
|
|
5287
|
+
this._private_ctx.fillStyle = fillColor.toCSSColor();
|
|
5290
5288
|
this._private_ctx.fillRect(0, 0, this._private_canvas.width, this._private_canvas.height);
|
|
5291
5289
|
}
|
|
5292
5290
|
this._private_canvasTexture.needsUpdate = true;
|
|
@@ -5377,14 +5375,15 @@ class UIGraphics extends UIElement {
|
|
|
5377
5375
|
* Sets the fill style.
|
|
5378
5376
|
*/
|
|
5379
5377
|
setFillStyle(style) {
|
|
5380
|
-
this._private_ctx.fillStyle = style;
|
|
5378
|
+
this._private_ctx.fillStyle = style instanceof UIColor ? style.toCSSColor() : style;
|
|
5381
5379
|
return this;
|
|
5382
5380
|
}
|
|
5383
5381
|
/**
|
|
5384
5382
|
* Sets the stroke style.
|
|
5385
5383
|
*/
|
|
5386
5384
|
setStrokeStyle(style) {
|
|
5387
|
-
this._private_ctx.strokeStyle =
|
|
5385
|
+
this._private_ctx.strokeStyle =
|
|
5386
|
+
style instanceof UIColor ? style.toCSSColor() : style;
|
|
5388
5387
|
return this;
|
|
5389
5388
|
}
|
|
5390
5389
|
/**
|