@inweb/markup 25.8.19 → 25.8.21
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/markup.js +94 -57
- package/dist/markup.js.map +1 -1
- package/dist/markup.min.js +1 -1
- package/dist/markup.module.js +87 -37
- package/dist/markup.module.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/markup/IMarkup.d.ts +27 -16
- package/lib/markup/IMarkupArrow.d.ts +8 -16
- package/lib/markup/IMarkupCloud.d.ts +9 -18
- package/lib/markup/IMarkupColorable.d.ts +5 -4
- package/lib/markup/IMarkupEllipse.d.ts +9 -18
- package/lib/markup/IMarkupImage.d.ts +14 -17
- package/lib/markup/IMarkupLine.d.ts +44 -11
- package/lib/markup/IMarkupObject.d.ts +25 -15
- package/lib/markup/IMarkupRectangle.d.ts +9 -18
- package/lib/markup/IMarkupText.d.ts +7 -14
- package/lib/markup/IWorldTransform.d.ts +1 -1
- package/lib/markup/Konva/KonvaArrow.d.ts +2 -2
- package/lib/markup/Konva/KonvaCloud.d.ts +1 -1
- package/lib/markup/Konva/KonvaEllipse.d.ts +2 -2
- package/lib/markup/Konva/KonvaImage.d.ts +4 -2
- package/lib/markup/Konva/KonvaLine.d.ts +2 -11
- package/lib/markup/Konva/KonvaMarkup.d.ts +2 -2
- package/lib/markup/Konva/KonvaRectangle.d.ts +1 -1
- package/lib/markup/Konva/KonvaText.d.ts +2 -2
- package/lib/markup/Konva/MarkupColor.d.ts +19 -18
- package/package.json +3 -3
- package/src/index.ts +1 -1
- package/src/markup/IMarkup.ts +28 -16
- package/src/markup/IMarkupArrow.ts +8 -16
- package/src/markup/IMarkupCloud.ts +9 -18
- package/src/markup/IMarkupColorable.ts +5 -4
- package/src/markup/IMarkupEllipse.ts +9 -18
- package/src/markup/IMarkupImage.ts +14 -17
- package/src/markup/IMarkupLine.ts +46 -11
- package/src/markup/IMarkupObject.ts +25 -15
- package/src/markup/IMarkupRectangle.ts +9 -18
- package/src/markup/IMarkupText.ts +7 -14
- package/src/markup/IWorldTransform.ts +1 -1
- package/src/markup/Konva/KonvaArrow.ts +6 -4
- package/src/markup/Konva/KonvaCloud.ts +4 -3
- package/src/markup/Konva/KonvaEllipse.ts +6 -4
- package/src/markup/Konva/KonvaImage.ts +27 -14
- package/src/markup/Konva/KonvaLine.ts +9 -13
- package/src/markup/Konva/KonvaMarkup.ts +15 -15
- package/src/markup/Konva/KonvaRectangle.ts +3 -2
- package/src/markup/Konva/KonvaText.ts +6 -4
- package/src/markup/Konva/MarkupColor.ts +22 -23
|
@@ -22,57 +22,56 @@
|
|
|
22
22
|
///////////////////////////////////////////////////////////////////////////////
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
|
-
*
|
|
25
|
+
* Defines the markup color helper object.
|
|
26
26
|
*/
|
|
27
27
|
export class MarkupColor {
|
|
28
28
|
public R: number;
|
|
29
29
|
public G: number;
|
|
30
30
|
public B: number;
|
|
31
|
-
|
|
32
|
-
private _hex: string;
|
|
31
|
+
public HEX: string;
|
|
33
32
|
|
|
34
33
|
/**
|
|
35
|
-
*
|
|
34
|
+
* Creates an instance of the color.
|
|
35
|
+
*
|
|
36
|
+
* @param r - The `red` component of the color, as a number between 0 and 255.
|
|
37
|
+
* @param g - The `green` component of the color, as a number between 0 and 255.
|
|
38
|
+
* @param b - The `blue` component of the color, as a number between 0 and 255.
|
|
36
39
|
*/
|
|
37
|
-
|
|
38
|
-
|
|
40
|
+
constructor(r: number, g: number, b: number) {
|
|
41
|
+
this.setColor(r, g, b);
|
|
39
42
|
}
|
|
40
43
|
|
|
41
44
|
/**
|
|
42
|
-
*
|
|
45
|
+
* Returns the color as a string in hexadecimal color syntax `#RGB` using its primary color
|
|
46
|
+
* components (red, green, blue) written as hexadecimal numbers.
|
|
43
47
|
*/
|
|
44
|
-
|
|
45
|
-
return
|
|
48
|
+
public asHex(): string {
|
|
49
|
+
return "#" + this.HEX;
|
|
46
50
|
}
|
|
47
51
|
|
|
48
52
|
/**
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
* @param r - Red color in [0,255] range
|
|
52
|
-
* @param g - Green color in [0,255] range
|
|
53
|
-
* @param b - Blue color in [0,255] range
|
|
53
|
+
* Returns the color as an {r, g, b} object.
|
|
54
54
|
*/
|
|
55
|
-
|
|
56
|
-
this.
|
|
55
|
+
public asRGB(): { r: number; g: number; b: number } {
|
|
56
|
+
return { r: this.R, g: this.G, b: this.B };
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
/**
|
|
60
|
-
*
|
|
60
|
+
* Sets the color.
|
|
61
61
|
*
|
|
62
|
-
* @param r -
|
|
63
|
-
* @param g -
|
|
64
|
-
* @param b -
|
|
62
|
+
* @param r - The `red` component of the color, as a number between 0 and 255.
|
|
63
|
+
* @param g - The `green` component of the color, as a number between 0 and 255.
|
|
64
|
+
* @param b - The `blue` component of the color, as a number between 0 and 255.
|
|
65
65
|
*/
|
|
66
66
|
public setColor(r: number, g: number, b: number): void {
|
|
67
67
|
this.R = r;
|
|
68
68
|
this.G = g;
|
|
69
69
|
this.B = b;
|
|
70
|
-
|
|
71
|
-
this._hex = this.rgbToHex(r, g, b);
|
|
70
|
+
this.HEX = this.rgbToHex(r, g, b);
|
|
72
71
|
}
|
|
73
72
|
|
|
74
73
|
private rgbToHex(r: number, g: number, b: number): string {
|
|
75
|
-
const valueToHex = (c) => {
|
|
74
|
+
const valueToHex = (c: number) => {
|
|
76
75
|
const hex = c.toString(16);
|
|
77
76
|
return hex === "0" ? "00" : hex;
|
|
78
77
|
};
|