@operato/scene-gauge 0.0.16
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/@types/global/index.d.ts +1 -0
- package/CHANGELOG.md +16 -0
- package/LICENSE +21 -0
- package/README.md +15 -0
- package/assets/gauge-circle.png +0 -0
- package/assets/gauge-horizontal.png +0 -0
- package/assets/gauge-vertical.png +0 -0
- package/dist/gauge-circle.d.ts +57 -0
- package/dist/gauge-circle.js +211 -0
- package/dist/gauge-circle.js.map +1 -0
- package/dist/gauge-horizon.d.ts +56 -0
- package/dist/gauge-horizon.js +145 -0
- package/dist/gauge-horizon.js.map +1 -0
- package/dist/gauge-properties.d.ts +39 -0
- package/dist/gauge-properties.js +114 -0
- package/dist/gauge-properties.js.map +1 -0
- package/dist/gauge-vertical.d.ts +56 -0
- package/dist/gauge-vertical.js +143 -0
- package/dist/gauge-vertical.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/helps/scene/component/gauge-circle.ko.md +168 -0
- package/helps/scene/component/gauge-circle.md +167 -0
- package/helps/scene/component/gauge-circle.zh.md +164 -0
- package/helps/scene/component/gauge-horizon.ko.md +145 -0
- package/helps/scene/component/gauge-horizon.md +145 -0
- package/helps/scene/component/gauge-horizon.zh.md +145 -0
- package/helps/scene/component/gauge-vertical.ko.md +12 -0
- package/helps/scene/component/gauge-vertical.md +9 -0
- package/helps/scene/component/gauge-vertical.zh.md +10 -0
- package/helps/scene/images/gauge-circle-01.png +0 -0
- package/helps/scene/images/gauge-circle-02.png +0 -0
- package/helps/scene/images/gauge-circle-03.png +0 -0
- package/helps/scene/images/gauge-circle-04.png +0 -0
- package/helps/scene/images/gauge-circle-05.png +0 -0
- package/helps/scene/images/gauge-circle-06.png +0 -0
- package/helps/scene/images/gauge-circle-07.png +0 -0
- package/helps/scene/images/gauge-circle-08.png +0 -0
- package/helps/scene/images/gauge-circle-09.png +0 -0
- package/helps/scene/images/gauge-circle-10.png +0 -0
- package/helps/scene/images/gauge-circle-11.png +0 -0
- package/helps/scene/images/gauge-circle-12.png +0 -0
- package/helps/scene/images/gauge-circle-13.png +0 -0
- package/helps/scene/images/gauge-circle-14.png +0 -0
- package/helps/scene/images/gauge-circle-15.png +0 -0
- package/helps/scene/images/gauge-circle-16.png +0 -0
- package/helps/scene/images/gauge-circle-17.png +0 -0
- package/helps/scene/images/gauge-circle-18.png +0 -0
- package/helps/scene/images/gauge-circle-19.png +0 -0
- package/helps/scene/images/gauge-circle-20.png +0 -0
- package/helps/scene/images/gauge-circle-21.png +0 -0
- package/helps/scene/images/gauge-horizontal-01.png +0 -0
- package/helps/scene/images/gauge-vertical-01.png +0 -0
- package/helps/scene/images/gauge-vertical-02.png +0 -0
- package/helps/scene/images/gauge-vertical-03.png +0 -0
- package/helps/scene/images/gauge-vertical-04.png +0 -0
- package/helps/scene/images/gauge-vertical-05.png +0 -0
- package/helps/scene/images/gauge-vertical-06.png +0 -0
- package/helps/scene/images/gauge-vertical-07.png +0 -0
- package/helps/scene/images/gauge-vertical-08.png +0 -0
- package/helps/scene/images/gauge-vertical-09.png +0 -0
- package/helps/scene/images/gauge-vertical-10.png +0 -0
- package/helps/scene/images/gauge-vertical-11.png +0 -0
- package/helps/scene/images/gauge-vertical-12.png +0 -0
- package/helps/scene/images/gauge-vertical-13.png +0 -0
- package/helps/scene/images/gauge-vertical-14.png +0 -0
- package/helps/scene/images/gauge-vertical-15.png +0 -0
- package/helps/scene/images/gauge-vertical-16.png +0 -0
- package/helps/scene/images/gauge-vertical-17.png +0 -0
- package/helps/scene/images/gauge-vertical-18.png +0 -0
- package/package.json +61 -0
- package/src/gauge-circle.ts +310 -0
- package/src/gauge-horizon.ts +204 -0
- package/src/gauge-properties.ts +114 -0
- package/src/gauge-vertical.ts +203 -0
- package/src/index.ts +6 -0
- package/test/basic-test.html +67 -0
- package/test/index.html +22 -0
- package/things-scene.config.js +158 -0
- package/translations/en.json +3 -0
- package/translations/ko.json +3 -0
- package/translations/ms.json +3 -0
- package/translations/zh.json +3 -0
- package/tsconfig.json +22 -0
- package/tsconfig.tsbuildinfo +1 -0
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
export const PROPERTIES = [
|
|
5
|
+
{
|
|
6
|
+
type: 'string',
|
|
7
|
+
label: 'value',
|
|
8
|
+
name: 'value',
|
|
9
|
+
property: 'value'
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
type: 'number',
|
|
13
|
+
label: 'start-value',
|
|
14
|
+
name: 'startValue',
|
|
15
|
+
observe: function (startValue) {
|
|
16
|
+
const colorStops = this.parentNode.querySelector('[name=colorStops]');
|
|
17
|
+
colorStops.property.min = startValue;
|
|
18
|
+
},
|
|
19
|
+
property: 'startValue'
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
type: 'number',
|
|
23
|
+
label: 'end-value',
|
|
24
|
+
name: 'endValue',
|
|
25
|
+
observe: function (endValue) {
|
|
26
|
+
const colorStops = this.parentNode.querySelector('[name=colorStops]');
|
|
27
|
+
colorStops.property.max = endValue;
|
|
28
|
+
},
|
|
29
|
+
property: 'endValue'
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
type: 'number',
|
|
33
|
+
label: 'step',
|
|
34
|
+
name: 'step',
|
|
35
|
+
property: 'step'
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
type: 'number',
|
|
39
|
+
label: 'step-text-size',
|
|
40
|
+
name: 'stepTextSize',
|
|
41
|
+
property: 'stepTextSize'
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
type: 'number',
|
|
45
|
+
label: 'sub-step',
|
|
46
|
+
name: 'subStep',
|
|
47
|
+
property: 'subStep'
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
type: 'number',
|
|
51
|
+
label: 'step-needle-size',
|
|
52
|
+
name: 'stepNeedleSize',
|
|
53
|
+
property: 'stepNeedleSize'
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
type: 'color',
|
|
57
|
+
label: 'step-fill-style',
|
|
58
|
+
name: 'stepFillStyle',
|
|
59
|
+
property: 'stepFillStyle'
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
type: 'solid-color-stops',
|
|
63
|
+
label: 'color-stops',
|
|
64
|
+
name: 'colorStops',
|
|
65
|
+
property: {
|
|
66
|
+
min: 0,
|
|
67
|
+
max: 100
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
type: 'legend',
|
|
72
|
+
label: '',
|
|
73
|
+
name: 'toggleOption',
|
|
74
|
+
property: {
|
|
75
|
+
label: 'Toggle Option'
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
type: 'checkbox',
|
|
80
|
+
label: 'show-start-value',
|
|
81
|
+
name: 'showStartValue',
|
|
82
|
+
property: 'showStartValue'
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
type: 'checkbox',
|
|
86
|
+
label: 'show-end-value',
|
|
87
|
+
name: 'showEndValue',
|
|
88
|
+
property: 'showEndValue'
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
type: 'checkbox',
|
|
92
|
+
label: 'show-step-line',
|
|
93
|
+
name: 'showStepLine',
|
|
94
|
+
property: 'showStepLine'
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
type: 'checkbox',
|
|
98
|
+
label: 'show-step-text',
|
|
99
|
+
name: 'showStepText',
|
|
100
|
+
property: 'showStepText'
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
type: 'checkbox',
|
|
104
|
+
label: 'show-sub-step',
|
|
105
|
+
name: 'showSubStep',
|
|
106
|
+
property: 'showSubStep'
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
type: 'checkbox',
|
|
110
|
+
label: 'anim-from-base',
|
|
111
|
+
name: 'animFromBase'
|
|
112
|
+
}
|
|
113
|
+
];
|
|
114
|
+
//# sourceMappingURL=gauge-properties.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gauge-properties.js","sourceRoot":"","sources":["../src/gauge-properties.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB;QACE,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,OAAO;QACd,IAAI,EAAE,OAAO;QACb,QAAQ,EAAE,OAAO;KAClB;IACD;QACE,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,aAAa;QACpB,IAAI,EAAE,YAAY;QAClB,OAAO,EAAE,UAA6B,UAAkB;YACtD,MAAM,UAAU,GAAQ,IAAI,CAAC,UAAW,CAAC,aAAa,CAAC,mBAAmB,CAAC,CAAA;YAC3E,UAAU,CAAC,QAAQ,CAAC,GAAG,GAAG,UAAU,CAAA;QACtC,CAAC;QACD,QAAQ,EAAE,YAAY;KACvB;IACD;QACE,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,WAAW;QAClB,IAAI,EAAE,UAAU;QAChB,OAAO,EAAE,UAA6B,QAAgB;YACpD,MAAM,UAAU,GAAQ,IAAI,CAAC,UAAW,CAAC,aAAa,CAAC,mBAAmB,CAAC,CAAA;YAC3E,UAAU,CAAC,QAAQ,CAAC,GAAG,GAAG,QAAQ,CAAA;QACpC,CAAC;QACD,QAAQ,EAAE,UAAU;KACrB;IACD;QACE,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,MAAM;QACb,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,MAAM;KACjB;IACD;QACE,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,gBAAgB;QACvB,IAAI,EAAE,cAAc;QACpB,QAAQ,EAAE,cAAc;KACzB;IACD;QACE,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,UAAU;QACjB,IAAI,EAAE,SAAS;QACf,QAAQ,EAAE,SAAS;KACpB;IACD;QACE,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,kBAAkB;QACzB,IAAI,EAAE,gBAAgB;QACtB,QAAQ,EAAE,gBAAgB;KAC3B;IACD;QACE,IAAI,EAAE,OAAO;QACb,KAAK,EAAE,iBAAiB;QACxB,IAAI,EAAE,eAAe;QACrB,QAAQ,EAAE,eAAe;KAC1B;IACD;QACE,IAAI,EAAE,mBAAmB;QACzB,KAAK,EAAE,aAAa;QACpB,IAAI,EAAE,YAAY;QAClB,QAAQ,EAAE;YACR,GAAG,EAAE,CAAC;YACN,GAAG,EAAE,GAAG;SACT;KACF;IACD;QACE,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,EAAE;QACT,IAAI,EAAE,cAAc;QACpB,QAAQ,EAAE;YACR,KAAK,EAAE,eAAe;SACvB;KACF;IACD;QACE,IAAI,EAAE,UAAU;QAChB,KAAK,EAAE,kBAAkB;QACzB,IAAI,EAAE,gBAAgB;QACtB,QAAQ,EAAE,gBAAgB;KAC3B;IACD;QACE,IAAI,EAAE,UAAU;QAChB,KAAK,EAAE,gBAAgB;QACvB,IAAI,EAAE,cAAc;QACpB,QAAQ,EAAE,cAAc;KACzB;IACD;QACE,IAAI,EAAE,UAAU;QAChB,KAAK,EAAE,gBAAgB;QACvB,IAAI,EAAE,cAAc;QACpB,QAAQ,EAAE,cAAc;KACzB;IACD;QACE,IAAI,EAAE,UAAU;QAChB,KAAK,EAAE,gBAAgB;QACvB,IAAI,EAAE,cAAc;QACpB,QAAQ,EAAE,cAAc;KACzB;IACD;QACE,IAAI,EAAE,UAAU;QAChB,KAAK,EAAE,eAAe;QACtB,IAAI,EAAE,aAAa;QACnB,QAAQ,EAAE,aAAa;KACxB;IACD;QACE,IAAI,EAAE,UAAU;QAChB,KAAK,EAAE,gBAAgB;QACvB,IAAI,EAAE,cAAc;KACrB;CACF,CAAA","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\n\nexport const PROPERTIES = [\n {\n type: 'string',\n label: 'value',\n name: 'value',\n property: 'value'\n },\n {\n type: 'number',\n label: 'start-value',\n name: 'startValue',\n observe: function (this: HTMLElement, startValue: number) {\n const colorStops: any = this.parentNode!.querySelector('[name=colorStops]')\n colorStops.property.min = startValue\n },\n property: 'startValue'\n },\n {\n type: 'number',\n label: 'end-value',\n name: 'endValue',\n observe: function (this: HTMLElement, endValue: number) {\n const colorStops: any = this.parentNode!.querySelector('[name=colorStops]')\n colorStops.property.max = endValue\n },\n property: 'endValue'\n },\n {\n type: 'number',\n label: 'step',\n name: 'step',\n property: 'step'\n },\n {\n type: 'number',\n label: 'step-text-size',\n name: 'stepTextSize',\n property: 'stepTextSize'\n },\n {\n type: 'number',\n label: 'sub-step',\n name: 'subStep',\n property: 'subStep'\n },\n {\n type: 'number',\n label: 'step-needle-size',\n name: 'stepNeedleSize',\n property: 'stepNeedleSize'\n },\n {\n type: 'color',\n label: 'step-fill-style',\n name: 'stepFillStyle',\n property: 'stepFillStyle'\n },\n {\n type: 'solid-color-stops',\n label: 'color-stops',\n name: 'colorStops',\n property: {\n min: 0,\n max: 100\n }\n },\n {\n type: 'legend',\n label: '',\n name: 'toggleOption',\n property: {\n label: 'Toggle Option'\n }\n },\n {\n type: 'checkbox',\n label: 'show-start-value',\n name: 'showStartValue',\n property: 'showStartValue'\n },\n {\n type: 'checkbox',\n label: 'show-end-value',\n name: 'showEndValue',\n property: 'showEndValue'\n },\n {\n type: 'checkbox',\n label: 'show-step-line',\n name: 'showStepLine',\n property: 'showStepLine'\n },\n {\n type: 'checkbox',\n label: 'show-step-text',\n name: 'showStepText',\n property: 'showStepText'\n },\n {\n type: 'checkbox',\n label: 'show-sub-step',\n name: 'showSubStep',\n property: 'showSubStep'\n },\n {\n type: 'checkbox',\n label: 'anim-from-base',\n name: 'animFromBase'\n }\n]\n"]}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Shape } from '@hatiolab/things-scene';
|
|
2
|
+
declare const GaugeVertical_base: (new (...args: any[]) => {
|
|
3
|
+
value: number;
|
|
4
|
+
animValue: number;
|
|
5
|
+
animOnValueChange(value: number, animFromBase: boolean, base: number): void;
|
|
6
|
+
}) & typeof Shape;
|
|
7
|
+
export default class GaugeVertical extends GaugeVertical_base {
|
|
8
|
+
_draw(context: CanvasRenderingContext2D): void;
|
|
9
|
+
_post_draw(context: CanvasRenderingContext2D): void;
|
|
10
|
+
get nature(): {
|
|
11
|
+
mutable: boolean;
|
|
12
|
+
resizable: boolean;
|
|
13
|
+
rotatable: boolean;
|
|
14
|
+
properties: ({
|
|
15
|
+
type: string;
|
|
16
|
+
label: string;
|
|
17
|
+
name: string;
|
|
18
|
+
property: string;
|
|
19
|
+
observe?: undefined;
|
|
20
|
+
} | {
|
|
21
|
+
type: string;
|
|
22
|
+
label: string;
|
|
23
|
+
name: string;
|
|
24
|
+
observe: (this: HTMLElement, startValue: number) => void;
|
|
25
|
+
property: string;
|
|
26
|
+
} | {
|
|
27
|
+
type: string;
|
|
28
|
+
label: string;
|
|
29
|
+
name: string;
|
|
30
|
+
property: {
|
|
31
|
+
min: number;
|
|
32
|
+
max: number;
|
|
33
|
+
label?: undefined;
|
|
34
|
+
};
|
|
35
|
+
observe?: undefined;
|
|
36
|
+
} | {
|
|
37
|
+
type: string;
|
|
38
|
+
label: string;
|
|
39
|
+
name: string;
|
|
40
|
+
property: {
|
|
41
|
+
label: string;
|
|
42
|
+
min?: undefined;
|
|
43
|
+
max?: undefined;
|
|
44
|
+
};
|
|
45
|
+
observe?: undefined;
|
|
46
|
+
} | {
|
|
47
|
+
type: string;
|
|
48
|
+
label: string;
|
|
49
|
+
name: string;
|
|
50
|
+
property?: undefined;
|
|
51
|
+
observe?: undefined;
|
|
52
|
+
})[];
|
|
53
|
+
help: string;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
export {};
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import { Component, RectPath, Shape, ValueHolder, } from '@hatiolab/things-scene';
|
|
5
|
+
import { PROPERTIES } from './gauge-properties';
|
|
6
|
+
const NATURE = {
|
|
7
|
+
mutable: false,
|
|
8
|
+
resizable: true,
|
|
9
|
+
rotatable: true,
|
|
10
|
+
properties: [
|
|
11
|
+
...PROPERTIES,
|
|
12
|
+
{
|
|
13
|
+
type: 'color',
|
|
14
|
+
label: 'text-fill-style',
|
|
15
|
+
name: 'textFillStyle',
|
|
16
|
+
property: 'textFillStyle'
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
type: 'color',
|
|
20
|
+
label: 'needle-fill-style',
|
|
21
|
+
name: 'needleFillStyle',
|
|
22
|
+
property: 'needleFillStyle'
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
type: 'number',
|
|
26
|
+
label: 'needle-size',
|
|
27
|
+
name: 'needleSize',
|
|
28
|
+
property: 'needleSize'
|
|
29
|
+
}
|
|
30
|
+
],
|
|
31
|
+
help: 'scene/component/gauge-vertical'
|
|
32
|
+
};
|
|
33
|
+
export default class GaugeVertical extends ValueHolder(RectPath(Shape)) {
|
|
34
|
+
_draw(context) {
|
|
35
|
+
var { startValue, endValue, step, subStep, colorStops, needleFillStyle, stepFillStyle, textFillStyle, needleSize, stepNeedleSize, stepTextSize, showStepText = true, showStartValue = true, showEndValue = true, showStepLine = true, showSubStep = true, width, height, top, left, animFromBase = false } = this.model;
|
|
36
|
+
startValue = Number(startValue);
|
|
37
|
+
this.animOnValueChange(this.value, animFromBase, startValue);
|
|
38
|
+
const totalValue = endValue - startValue; // 게이지의 시작과 끝 값의 크기
|
|
39
|
+
context.translate(left, top); // top과 left의 좌표에 영향을 받지 않기 위해 transalate를 한다음 모든 탑과 레프트의 좌표를 0으로 줌
|
|
40
|
+
//// 메인 막대 그리기 ////
|
|
41
|
+
context.beginPath();
|
|
42
|
+
context.rect(0, 0, width, height);
|
|
43
|
+
this.drawFill(context);
|
|
44
|
+
this.drawStroke(context);
|
|
45
|
+
context.closePath();
|
|
46
|
+
//// 스텝별 색 칠하기 ////
|
|
47
|
+
if (colorStops) {
|
|
48
|
+
let beforeValue = 0;
|
|
49
|
+
colorStops.forEach(function (v, idx, arr) {
|
|
50
|
+
context.beginPath();
|
|
51
|
+
let value = Math.max(Math.min(v.position - startValue, totalValue), 0); // v.position 범위의 최소값은 0, 최대값은 totalValue가 되야함.
|
|
52
|
+
let startStepPosition = (height * beforeValue) / totalValue;
|
|
53
|
+
let endStepPosition;
|
|
54
|
+
// console.log(startStepPosition + (height * value / totalValue));
|
|
55
|
+
if (idx === arr.length - 1 || startStepPosition + (height * value) / totalValue)
|
|
56
|
+
// 배열의 마지막 값이거나 중간 시작값 + 그려지는 값이 height 를 넘을 경우는 무조건 끝까지 채워주도록 한다
|
|
57
|
+
endStepPosition = height - startStepPosition;
|
|
58
|
+
else
|
|
59
|
+
endStepPosition = height - (height * value) / totalValue;
|
|
60
|
+
if (beforeValue > totalValue || beforeValue > value)
|
|
61
|
+
// 값이 게이지의 최대 값을 넘어가거나 이전 값 보다 현재값이 작으면 다시 그릴 필요 없음
|
|
62
|
+
return false;
|
|
63
|
+
context.rect(0, height - startStepPosition, width, -endStepPosition);
|
|
64
|
+
context.fillStyle = v.color;
|
|
65
|
+
context.fill();
|
|
66
|
+
beforeValue = value;
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
//// 바늘 그리기 ////
|
|
70
|
+
context.beginPath();
|
|
71
|
+
let drawingValue = this.animValue;
|
|
72
|
+
drawingValue = Math.max(Math.min(drawingValue, endValue), startValue); // 그려지는 값은 startValue보다 작을 수 없고, endValue보다 클 수 없음.
|
|
73
|
+
let position = height - ((drawingValue - startValue) / totalValue) * height;
|
|
74
|
+
needleSize *= 4;
|
|
75
|
+
context.moveTo(width * 1.05, position);
|
|
76
|
+
context.lineTo(width * 1.05 + needleSize, position + needleSize / 2);
|
|
77
|
+
context.lineTo(width * 1.05 + needleSize, position - needleSize / 2);
|
|
78
|
+
context.fillStyle = needleFillStyle;
|
|
79
|
+
context.fill();
|
|
80
|
+
context.closePath();
|
|
81
|
+
//// 스텝 선 그리기 ////
|
|
82
|
+
context.fillStyle = stepFillStyle;
|
|
83
|
+
if (showStepLine) {
|
|
84
|
+
let count = totalValue / step;
|
|
85
|
+
// Draw StartValue
|
|
86
|
+
context.fillRect(0, height, height * 0.06, stepNeedleSize);
|
|
87
|
+
// Draw StepValue
|
|
88
|
+
for (let num = 1; num < count; num++) {
|
|
89
|
+
let locate = (height / count) * num;
|
|
90
|
+
context.fillRect(0, locate, height * 0.06, stepNeedleSize);
|
|
91
|
+
}
|
|
92
|
+
// Draw EndValue
|
|
93
|
+
context.fillRect(0, 0, height * 0.06, stepNeedleSize);
|
|
94
|
+
}
|
|
95
|
+
//// 서브 스탭 그리기 ////
|
|
96
|
+
if (showSubStep) {
|
|
97
|
+
let count = totalValue;
|
|
98
|
+
// Draw StartValue
|
|
99
|
+
context.fillRect(0, 0, height * 0.027, stepNeedleSize);
|
|
100
|
+
// Draw StepValue
|
|
101
|
+
for (let num = 1; num <= count; num++) {
|
|
102
|
+
if (num % step == 0 || num % subStep != 0) {
|
|
103
|
+
// 메인 스탭과 서브 스탭은 그리지 않음
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
let locate = (height / count) * num;
|
|
107
|
+
context.fillRect(0, locate, height * 0.027, stepNeedleSize);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
//// 스텝 텍스트 그리기 ////
|
|
111
|
+
let fontSize = (height * stepTextSize) / 150;
|
|
112
|
+
context.fillStyle = textFillStyle;
|
|
113
|
+
context.font = fontSize + 'px arial';
|
|
114
|
+
context.textBaseline = 'middle';
|
|
115
|
+
context.textAlign = 'center';
|
|
116
|
+
if (showStartValue) {
|
|
117
|
+
// Draw StartText
|
|
118
|
+
context.fillText(startValue, -fontSize, height);
|
|
119
|
+
}
|
|
120
|
+
if (showEndValue) {
|
|
121
|
+
// Draw EndText
|
|
122
|
+
context.fillText(endValue, -fontSize, 0);
|
|
123
|
+
}
|
|
124
|
+
if (showStepText) {
|
|
125
|
+
// Draw StepText
|
|
126
|
+
let count = totalValue / step;
|
|
127
|
+
for (let num = 1; num < count; num++) {
|
|
128
|
+
let value = startValue + Number(step) * num;
|
|
129
|
+
let locate = height - (height / count) * num;
|
|
130
|
+
context.fillText(value, -fontSize, locate);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
context.translate(-left, -top);
|
|
134
|
+
}
|
|
135
|
+
_post_draw(context) {
|
|
136
|
+
this.drawText(context);
|
|
137
|
+
}
|
|
138
|
+
get nature() {
|
|
139
|
+
return NATURE;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
Component.register('gauge-vertical', GaugeVertical);
|
|
143
|
+
//# sourceMappingURL=gauge-vertical.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gauge-vertical.js","sourceRoot":"","sources":["../src/gauge-vertical.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,SAAS,EACT,QAAQ,EACR,KAAK,EACL,WAAW,GACZ,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,MAAM,MAAM,GAAG;IACb,OAAO,EAAE,KAAK;IACd,SAAS,EAAE,IAAI;IACf,SAAS,EAAE,IAAI;IACf,UAAU,EAAE;QACV,GAAG,UAAU;QACb;YACE,IAAI,EAAE,OAAO;YACb,KAAK,EAAE,iBAAiB;YACxB,IAAI,EAAE,eAAe;YACrB,QAAQ,EAAE,eAAe;SAC1B;QACD;YACE,IAAI,EAAE,OAAO;YACb,KAAK,EAAE,mBAAmB;YAC1B,IAAI,EAAE,iBAAiB;YACvB,QAAQ,EAAE,iBAAiB;SAC5B;QACD;YACE,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,aAAa;YACpB,IAAI,EAAE,YAAY;YAClB,QAAQ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,CAAA;gBAC3C,IAAI,MAAM,GAAG,MAAM,GAAG,CAAC,MAAM,GAAG,KAAK,CAAC,GAAG,GAAG,CAAA;gBAE5C,OAAO,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAA;aAC3C;SACF;QAED,OAAO,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAA;IAChC,CAAC;IAED,UAAU,CAAC,OAAiC;QAC1C,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;IACxB,CAAC;IAED,IAAI,MAAM;QACR,OAAO,MAAM,CAAA;IACf,CAAC;CACF;AAED,SAAS,CAAC,QAAQ,CAAC,gBAAgB,EAAE,aAAa,CAAC,CAAA","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport {\n Component,\n RectPath,\n Shape,\n ValueHolder,\n} from '@hatiolab/things-scene';\n\nimport { PROPERTIES } from './gauge-properties';\n\nconst NATURE = {\n mutable: false,\n resizable: true,\n rotatable: true,\n properties: [\n ...PROPERTIES,\n {\n type: 'color',\n label: 'text-fill-style',\n name: 'textFillStyle',\n property: 'textFillStyle'\n },\n {\n type: 'color',\n label: 'needle-fill-style',\n name: 'needleFillStyle',\n property: 'needleFillStyle'\n },\n {\n type: 'number',\n label: 'needle-size',\n name: 'needleSize',\n property: 'needleSize'\n }\n ],\n help: 'scene/component/gauge-vertical'\n}\n\nexport default class GaugeVertical extends ValueHolder(RectPath(Shape)) {\n _draw(context: CanvasRenderingContext2D) {\n var {\n startValue,\n endValue,\n step,\n subStep,\n colorStops,\n needleFillStyle,\n stepFillStyle,\n textFillStyle,\n needleSize,\n stepNeedleSize,\n stepTextSize,\n showStepText = true,\n showStartValue = true,\n showEndValue = true,\n showStepLine = true,\n showSubStep = true,\n width,\n height,\n top,\n left,\n animFromBase = false\n } = this.model\n\n startValue = Number(startValue)\n\n this.animOnValueChange(this.value, animFromBase, startValue)\n\n const totalValue = endValue - startValue // 게이지의 시작과 끝 값의 크기\n\n context.translate(left, top) // top과 left의 좌표에 영향을 받지 않기 위해 transalate를 한다음 모든 탑과 레프트의 좌표를 0으로 줌\n\n //// 메인 막대 그리기 ////\n context.beginPath()\n\n context.rect(0, 0, width, height)\n\n this.drawFill(context)\n this.drawStroke(context)\n context.closePath()\n\n //// 스텝별 색 칠하기 ////\n if (colorStops) {\n let beforeValue = 0\n colorStops.forEach(function (v: {position: number; color: string;}, idx: number, arr: {position: number; color: string;}[]) {\n context.beginPath()\n\n let value = Math.max(Math.min(v.position - startValue, totalValue), 0) // v.position 범위의 최소값은 0, 최대값은 totalValue가 되야함.\n let startStepPosition = (height * beforeValue) / totalValue\n let endStepPosition\n\n // console.log(startStepPosition + (height * value / totalValue));\n if (idx === arr.length - 1 || startStepPosition + (height * value) / totalValue)\n // 배열의 마지막 값이거나 중간 시작값 + 그려지는 값이 height 를 넘을 경우는 무조건 끝까지 채워주도록 한다\n endStepPosition = height - startStepPosition\n else endStepPosition = height - (height * value) / totalValue\n\n if (beforeValue > totalValue || beforeValue > value)\n // 값이 게이지의 최대 값을 넘어가거나 이전 값 보다 현재값이 작으면 다시 그릴 필요 없음\n return false\n\n context.rect(0, height - startStepPosition, width, -endStepPosition)\n\n context.fillStyle = v.color\n context.fill()\n beforeValue = value\n })\n }\n\n //// 바늘 그리기 ////\n context.beginPath()\n let drawingValue = this.animValue\n drawingValue = Math.max(Math.min(drawingValue, endValue), startValue) // 그려지는 값은 startValue보다 작을 수 없고, endValue보다 클 수 없음.\n let position = height - ((drawingValue - startValue) / totalValue) * height\n\n needleSize *= 4\n context.moveTo(width * 1.05, position)\n context.lineTo(width * 1.05 + needleSize, position + needleSize / 2)\n context.lineTo(width * 1.05 + needleSize, position - needleSize / 2)\n\n context.fillStyle = needleFillStyle\n context.fill()\n context.closePath()\n\n //// 스텝 선 그리기 ////\n context.fillStyle = stepFillStyle\n if (showStepLine) {\n let count = totalValue / step\n\n // Draw StartValue\n context.fillRect(0, height, height * 0.06, stepNeedleSize)\n // Draw StepValue\n for (let num = 1; num < count; num++) {\n let locate = (height / count) * num\n\n context.fillRect(0, locate, height * 0.06, stepNeedleSize)\n }\n // Draw EndValue\n context.fillRect(0, 0, height * 0.06, stepNeedleSize)\n }\n\n //// 서브 스탭 그리기 ////\n if (showSubStep) {\n let count = totalValue\n\n // Draw StartValue\n context.fillRect(0, 0, height * 0.027, stepNeedleSize)\n\n // Draw StepValue\n for (let num = 1; num <= count; num++) {\n if (num % step == 0 || num % subStep != 0) {\n // 메인 스탭과 서브 스탭은 그리지 않음\n continue\n }\n let locate = (height / count) * num\n context.fillRect(0, locate, height * 0.027, stepNeedleSize)\n }\n }\n\n //// 스텝 텍스트 그리기 ////\n let fontSize = (height * stepTextSize) / 150\n context.fillStyle = textFillStyle\n context.font = fontSize + 'px arial'\n context.textBaseline = 'middle'\n context.textAlign = 'center'\n if (showStartValue) {\n // Draw StartText\n context.fillText(startValue, -fontSize, height)\n }\n\n if (showEndValue) {\n // Draw EndText\n context.fillText(endValue, -fontSize, 0)\n }\n\n if (showStepText) {\n // Draw StepText\n let count = totalValue / step\n\n for (let num = 1; num < count; num++) {\n let value = startValue + Number(step) * num\n let locate = height - (height / count) * num\n\n context.fillText(value, -fontSize, locate)\n }\n }\n\n context.translate(-left, -top)\n }\n\n _post_draw(context: CanvasRenderingContext2D) {\n this.drawText(context)\n }\n\n get nature() {\n return NATURE\n }\n}\n\nComponent.register('gauge-vertical', GaugeVertical)\n"]}
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
export { default as GaugeCircle } from './gauge-circle';
|
|
5
|
+
export { default as GaugeVertical } from './gauge-vertical';
|
|
6
|
+
export { default as GaugeHorizon } from './gauge-horizon';
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,gBAAgB,CAAA;AACvD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAC3D,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,iBAAiB,CAAA","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\nexport { default as GaugeCircle } from './gauge-circle'\nexport { default as GaugeVertical } from './gauge-vertical'\nexport { default as GaugeHorizon } from './gauge-horizon'\n"]}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
# gauge[ko]
|
|
2
|
+
![컴포넌트-게이지(원형)][gauge-circle-01]
|
|
3
|
+
## properties
|
|
4
|
+
|
|
5
|
+
1. Value(Number) - 게이지의 값.
|
|
6
|
+
<figure style="text-align: center;">
|
|
7
|
+
|
|
8
|
+
![게이지-Value적용결과][gauge-circle-02]
|
|
9
|
+
|
|
10
|
+
<figurecaption>(value: 85)</figurecaption>
|
|
11
|
+
</figure>
|
|
12
|
+
|
|
13
|
+
2. startValue - 게이지의 시작 값.
|
|
14
|
+
<figure style="text-align: center;">
|
|
15
|
+
|
|
16
|
+
![게이지-BackgroundColor적용결과][gauge-circle-03]
|
|
17
|
+
|
|
18
|
+
<figurecaption>(startValue: 10)</figurecaption>
|
|
19
|
+
</figure>
|
|
20
|
+
|
|
21
|
+
3. endValue - 게이지의 끝 값.
|
|
22
|
+
<figure style="text-align: center;">
|
|
23
|
+
|
|
24
|
+
![게이지-BackgroundColor적용결과][gauge-circle-04]
|
|
25
|
+
<figurecaption>(endValue: 120)</figurecaption>
|
|
26
|
+
</figure>
|
|
27
|
+
|
|
28
|
+
4. step - 게이지 눈금 간격.
|
|
29
|
+
<figure style="text-align: center;">
|
|
30
|
+
|
|
31
|
+
![게이지-BackgroundColor적용결과][gauge-circle-05]
|
|
32
|
+
<figurecaption>(step: 30)</figurecaption>
|
|
33
|
+
</figure>
|
|
34
|
+
|
|
35
|
+
5. stepTextSize - 게이지 눈금 글씨 크기.
|
|
36
|
+
<figure style="text-align: center;">
|
|
37
|
+
|
|
38
|
+
![게이지-BackgroundColor적용결과][gauge-circle-06]
|
|
39
|
+
<figurecaption>(stepTextSize: 10)</figurecaption>
|
|
40
|
+
</figure>
|
|
41
|
+
|
|
42
|
+
6. subStep - 게이지 눈금 사이 간격.
|
|
43
|
+
<figure style="text-align: center;">
|
|
44
|
+
|
|
45
|
+
![게이지-BackgroundColor적용결과][gauge-circle-07]
|
|
46
|
+
<figurecaption>(subStep: 10)</figurecaption>
|
|
47
|
+
</figure>
|
|
48
|
+
|
|
49
|
+
7. stepNeedleSize - 게이지 눈금 크기.
|
|
50
|
+
<figure style="text-align: center;">
|
|
51
|
+
|
|
52
|
+
![게이지-BackgroundColor적용결과][gauge-circle-08]
|
|
53
|
+
<figurecaption>(stepNeedleSize: 3)</figurecaption>
|
|
54
|
+
</figure>
|
|
55
|
+
|
|
56
|
+
8. startAngle - 게이지의 시작 각도. 12시 방향을 기준으로 시계방향으로 증가한다. 음수일 경우 역방향.
|
|
57
|
+
<figure style="text-align: center;">
|
|
58
|
+
|
|
59
|
+
![게이지-BackgroundColor적용결과][gauge-circle-09]
|
|
60
|
+
<figurecaption>(startAngle: -90)</figurecaption>
|
|
61
|
+
</figure>
|
|
62
|
+
|
|
63
|
+
9. endAngle - 게이지의 끝 각도. 12시 방향을 기준으로 시계방향으로 증가한다. 음수일 경우 역방향.
|
|
64
|
+
<figure style="text-align: center;">
|
|
65
|
+
|
|
66
|
+
![게이지-BackgroundColor적용결과][gauge-circle-10]
|
|
67
|
+
<figurecaption>(endAngle: 90)</figurecaption>
|
|
68
|
+
</figure>
|
|
69
|
+
|
|
70
|
+
10. textFillStyle - 게이지 눈금 글씨 색상.
|
|
71
|
+
<figure style="text-align: center;">
|
|
72
|
+
|
|
73
|
+
![게이지-BackgroundColor적용결과][gauge-circle-11]
|
|
74
|
+
<figurecaption>(textFillStyle: #ec5324)</figurecaption>
|
|
75
|
+
</figure>
|
|
76
|
+
|
|
77
|
+
11. needleFillStyle - 게이지 바늘 색상.
|
|
78
|
+
<figure style="text-align: center;">
|
|
79
|
+
|
|
80
|
+
![게이지-BackgroundColor적용결과][gauge-circle-12]
|
|
81
|
+
<figurecaption>(needleFillStyle: #ec5324)</figurecaption>
|
|
82
|
+
</figure>
|
|
83
|
+
|
|
84
|
+
12. innerCircleFillStyle - 게이지 바늘의 원의 색상.
|
|
85
|
+
<figure style="text-align: center;">
|
|
86
|
+
|
|
87
|
+
![게이지-BackgroundColor적용결과][gauge-circle-13]
|
|
88
|
+
<figurecaption>(innerCircleFillStyle: #ec5324)</figurecaption>
|
|
89
|
+
</figure>
|
|
90
|
+
|
|
91
|
+
13. stepFillStyle - 게이지 눈금 색상.
|
|
92
|
+
<figure style="text-align: center;">
|
|
93
|
+
|
|
94
|
+
![게이지-BackgroundColor적용결과][gauge-circle-14]
|
|
95
|
+
<figurecaption>(stepFillStyle: #ec5324)</figurecaption>
|
|
96
|
+
</figure>
|
|
97
|
+
|
|
98
|
+
14. colorStops - 게이지 구간별 색상. 더블클릭으로 구간을 추가할 수 있으며 마커를 드래그하여 아래로 내리면 구간을 삭제할 수 있다.
|
|
99
|
+
<figure style="text-align: center;">
|
|
100
|
+
|
|
101
|
+
![게이지-BackgroundColor적용결과][gauge-circle-15]
|
|
102
|
+
<figurecaption>(colorStops: <img src="{{site.baseurl}}/assets/components/color-stops-value.png" height="30" alt="color stops">)</figurecaption>
|
|
103
|
+
</figure>
|
|
104
|
+
|
|
105
|
+
15. showStartValue - 게이지 시작값의 표시여부를 결정.
|
|
106
|
+
<figure style="text-align: center;">
|
|
107
|
+
|
|
108
|
+
![게이지-BackgroundColor적용결과][gauge-circle-16]
|
|
109
|
+
<figurecaption>(showStartValue: unchecked)</figurecaption>
|
|
110
|
+
</figure>
|
|
111
|
+
|
|
112
|
+
16. showEndValue - 게이지 끝값의 표시여부를 결정.
|
|
113
|
+
<figure style="text-align: center;">
|
|
114
|
+
|
|
115
|
+
![게이지-BackgroundColor적용결과][gauge-circle-17]
|
|
116
|
+
<figurecaption>(showEndValue: unchecked)</figurecaption>
|
|
117
|
+
</figure>
|
|
118
|
+
|
|
119
|
+
17. showStepLine - 게이지 눈금의 표시여부를 결정.
|
|
120
|
+
<figure style="text-align: center;">
|
|
121
|
+
|
|
122
|
+
![게이지-BackgroundColor적용결과][gauge-circle-18]
|
|
123
|
+
<figurecaption>(showStepLine: unchecked)</figurecaption>
|
|
124
|
+
</figure>
|
|
125
|
+
|
|
126
|
+
18. showStepText - 게이지 눈금 값의 표시여부를 결정.
|
|
127
|
+
<figure style="text-align: center;">
|
|
128
|
+
|
|
129
|
+
![게이지-BackgroundColor적용결과][gauge-circle-19]
|
|
130
|
+
<figurecaption>(showStepText: unchecked)</figurecaption>
|
|
131
|
+
</figure>
|
|
132
|
+
|
|
133
|
+
19. showSubStep - 게이지 보조 눈금의 표시여부를 결정.
|
|
134
|
+
<figure style="text-align: center;">
|
|
135
|
+
|
|
136
|
+
![게이지-BackgroundColor적용결과][gauge-circle-20]
|
|
137
|
+
<figurecaption>(showSubStep: unchecked)</figurecaption>
|
|
138
|
+
</figure>
|
|
139
|
+
|
|
140
|
+
20. inText - 게이지 눈금 값의 위치를 결정. (checked: 내부, unchecked: 외부)
|
|
141
|
+
<figure style="text-align: center;">
|
|
142
|
+
|
|
143
|
+
![게이지-BackgroundColor적용결과][gauge-circle-21]
|
|
144
|
+
<figurecaption>(inText: unchecked)</figurecaption>
|
|
145
|
+
</figure>
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
[gauge-circle-01]:../images/gauge-circle-01.png
|
|
149
|
+
[gauge-circle-02]:../images/gauge-circle-02.png
|
|
150
|
+
[gauge-circle-03]:../images/gauge-circle-03.png
|
|
151
|
+
[gauge-circle-04]:../images/gauge-circle-04.png
|
|
152
|
+
[gauge-circle-05]:../images/gauge-circle-05.png
|
|
153
|
+
[gauge-circle-06]:../images/gauge-circle-06.png
|
|
154
|
+
[gauge-circle-07]:../images/gauge-circle-07.png
|
|
155
|
+
[gauge-circle-08]:../images/gauge-circle-08.png
|
|
156
|
+
[gauge-circle-09]:../images/gauge-circle-09.png
|
|
157
|
+
[gauge-circle-10]:../images/gauge-circle-10.png
|
|
158
|
+
[gauge-circle-11]:../images/gauge-circle-11.png
|
|
159
|
+
[gauge-circle-12]:../images/gauge-circle-12.png
|
|
160
|
+
[gauge-circle-13]:../images/gauge-circle-13.png
|
|
161
|
+
[gauge-circle-14]:../images/gauge-circle-14.png
|
|
162
|
+
[gauge-circle-15]:../images/gauge-circle-15.png
|
|
163
|
+
[gauge-circle-16]:../images/gauge-circle-16.png
|
|
164
|
+
[gauge-circle-17]:../images/gauge-circle-17.png
|
|
165
|
+
[gauge-circle-18]:../images/gauge-circle-18.png
|
|
166
|
+
[gauge-circle-19]:../images/gauge-circle-19.png
|
|
167
|
+
[gauge-circle-20]:../images/gauge-circle-20.png
|
|
168
|
+
[gauge-circle-21]:../images/gauge-circle-21.png
|