@operato/scene-gauge 10.0.0-beta.2 → 10.0.0-beta.31
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/README.md +30 -10
- package/dist/factories/index.d.ts +1 -0
- package/dist/factories/index.js +6 -0
- package/dist/factories/index.js.map +1 -0
- package/dist/gauge-circle.d.ts +41 -37
- package/dist/gauge-circle.js.map +1 -1
- package/dist/gauge-horizon.d.ts +81 -73
- package/dist/gauge-horizon.js.map +1 -1
- package/dist/gauge-vertical.d.ts +81 -73
- package/dist/gauge-vertical.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,15 +1,35 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @operato/scene-gauge
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> Things Scene Gauge Component
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
<!-- AUTOGEN_BEGIN: do not edit between markers (run scripts/regenerate-readmes.mjs to update) -->
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
| ---- | ------------------------ | -------------- | ------ |
|
|
9
|
-
| UMD | things-scene-gauge.js | modern browser | O |
|
|
10
|
-
| UMD | things-scene-gauge-ie.js | ie 11 | O |
|
|
11
|
-
| ESM | things-scene-gauge.mjs | modern browser | O |
|
|
7
|
+
## Components
|
|
12
8
|
|
|
13
|
-
|
|
9
|
+
- `GaugeCircle`
|
|
10
|
+
- `GaugeVertical`
|
|
11
|
+
- `GaugeHorizon`
|
|
14
12
|
|
|
15
|
-
|
|
13
|
+
## Install
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
yarn add @operato/scene-gauge
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
import { GaugeCircle, GaugeVertical, GaugeHorizon } from '@operato/scene-gauge'
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Build
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
yarn build
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Output: ESM module at `dist/index.js` (single bundle, no UMD/IE legacy).
|
|
32
|
+
|
|
33
|
+
_Version: 10.0.0-beta.14_
|
|
34
|
+
|
|
35
|
+
<!-- AUTOGEN_END -->
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { registerRealObjectFactory, RealObjectPlane2D } from '@hatiolab/things-scene';
|
|
2
|
+
const plane2D = (component) => new RealObjectPlane2D(component);
|
|
3
|
+
registerRealObjectFactory('gauge-circle', plane2D);
|
|
4
|
+
registerRealObjectFactory('gauge-horizon', plane2D);
|
|
5
|
+
registerRealObjectFactory('gauge-vertical', plane2D);
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/factories/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAErF,MAAM,OAAO,GAAG,CAAC,SAAc,EAAE,EAAE,CAAC,IAAI,iBAAiB,CAAC,SAAS,CAAC,CAAA;AACpE,yBAAyB,CAAC,cAAc,EAAE,OAAO,CAAC,CAAA;AAClD,yBAAyB,CAAC,eAAe,EAAE,OAAO,CAAC,CAAA;AACnD,yBAAyB,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAA","sourcesContent":["import { registerRealObjectFactory, RealObjectPlane2D } from '@hatiolab/things-scene'\n\nconst plane2D = (component: any) => new RealObjectPlane2D(component)\nregisterRealObjectFactory('gauge-circle', plane2D)\nregisterRealObjectFactory('gauge-horizon', plane2D)\nregisterRealObjectFactory('gauge-vertical', plane2D)\n"]}
|
package/dist/gauge-circle.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ComponentNature, Donut } from '@hatiolab/things-scene';
|
|
2
2
|
declare const GaugeCircle_base: (new (...args: any[]) => {
|
|
3
3
|
_lastValue: number;
|
|
4
4
|
_anim_alpha: number;
|
|
@@ -40,7 +40,7 @@ declare const GaugeCircle_base: (new (...args: any[]) => {
|
|
|
40
40
|
get disposed(): boolean;
|
|
41
41
|
isLayer(): boolean;
|
|
42
42
|
isGroup(): boolean;
|
|
43
|
-
isContainer(): this is import("@hatiolab/things-scene
|
|
43
|
+
isContainer(): this is import("@hatiolab/things-scene").Container;
|
|
44
44
|
isLine(): boolean;
|
|
45
45
|
isRoot(): boolean;
|
|
46
46
|
isRootModel(): boolean;
|
|
@@ -56,9 +56,9 @@ declare const GaugeCircle_base: (new (...args: any[]) => {
|
|
|
56
56
|
get(property: any): any;
|
|
57
57
|
set(props: any, propval?: any): any;
|
|
58
58
|
getState(property: any): any;
|
|
59
|
-
setState(props:
|
|
59
|
+
setState(props: Partial<import("@hatiolab/things-scene").State> | string, propval?: any): any;
|
|
60
60
|
get model(): any;
|
|
61
|
-
get state():
|
|
61
|
+
get state(): import("@hatiolab/things-scene").State;
|
|
62
62
|
get hierarchy(): any;
|
|
63
63
|
get volatile(): never[];
|
|
64
64
|
_applyProps(target: any, props: any, options: any): any;
|
|
@@ -100,7 +100,7 @@ declare const GaugeCircle_base: (new (...args: any[]) => {
|
|
|
100
100
|
prerender(context: import("@hatiolab/things-scene").SceneRenderContext): void;
|
|
101
101
|
render(context: import("@hatiolab/things-scene").SceneRenderContext): void;
|
|
102
102
|
postrender(context: import("@hatiolab/things-scene").SceneRenderContext): void;
|
|
103
|
-
prepare(resolve: (component: Component) => void, reject: (reason: any) => void): void;
|
|
103
|
+
prepare(resolve: (component: import("@hatiolab/things-scene").Component) => void, reject: (reason: any) => void): void;
|
|
104
104
|
prepareIf(condition: boolean): void;
|
|
105
105
|
drawText(context: import("@hatiolab/things-scene").SceneRenderContext): void;
|
|
106
106
|
drawStroke(context: import("@hatiolab/things-scene").SceneRenderContext, override?: Record<string, unknown>): void;
|
|
@@ -149,16 +149,16 @@ declare const GaugeCircle_base: (new (...args: any[]) => {
|
|
|
149
149
|
get started(): boolean;
|
|
150
150
|
set started(v: boolean): any;
|
|
151
151
|
get controls(): import("@hatiolab/things-scene").Control[] | undefined;
|
|
152
|
-
findFirst(finder: string | ((c: Component) => boolean), ...others: any[]): Component | undefined;
|
|
153
|
-
findAll(s: string | ((c: Component) => boolean), ...others: any[]): any[] | undefined;
|
|
154
|
-
capture(x: number, y: number, except?: (c: Component) => boolean): any;
|
|
152
|
+
findFirst(finder: string | ((c: import("@hatiolab/things-scene").Component) => boolean), ...others: any[]): import("@hatiolab/things-scene").Component | undefined;
|
|
153
|
+
findAll(s: string | ((c: import("@hatiolab/things-scene").Component) => boolean), ...others: any[]): any[] | undefined;
|
|
154
|
+
capture(x: number, y: number, except?: (c: import("@hatiolab/things-scene").Component) => boolean): any;
|
|
155
155
|
findAnchor(name: string): any;
|
|
156
|
-
isDescendible(container: Component): boolean;
|
|
156
|
+
isDescendible(container: import("@hatiolab/things-scene").Component | any): boolean;
|
|
157
157
|
getContext(component?: unknown): any;
|
|
158
|
-
get root(): Component;
|
|
159
|
-
get rootModel(): Component;
|
|
160
|
-
get parent(): Component;
|
|
161
|
-
set parent(v: Component): any;
|
|
158
|
+
get root(): import("@hatiolab/things-scene").Component;
|
|
159
|
+
get rootModel(): import("@hatiolab/things-scene").Component;
|
|
160
|
+
get parent(): import("@hatiolab/things-scene").Component;
|
|
161
|
+
set parent(v: import("@hatiolab/things-scene").Component): any;
|
|
162
162
|
get anchors(): import("@hatiolab/things-scene").Anchor[];
|
|
163
163
|
get scalable(): boolean;
|
|
164
164
|
get stuck(): boolean;
|
|
@@ -184,46 +184,50 @@ declare const GaugeCircle_base: (new (...args: any[]) => {
|
|
|
184
184
|
ondropfile(transfered: FileList, files: string[]): void;
|
|
185
185
|
transcoordS2P(x: number, y: number, rp?: import("@hatiolab/things-scene").POINT): import("@hatiolab/things-scene").POINT;
|
|
186
186
|
transcoordP2S(x: number, y: number, rp?: import("@hatiolab/things-scene").POINT): import("@hatiolab/things-scene").POINT;
|
|
187
|
-
transcoordS2T(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
188
|
-
transcoordT2P(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
189
|
-
transcoordT2S(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
190
|
-
transcoordS2TR(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
191
|
-
transcoordS2O(x: number, y: number, target: Component): import("@hatiolab/things-scene").POINT;
|
|
192
|
-
transcoordC2S(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
193
|
-
transcoordS2C(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
187
|
+
transcoordS2T(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
188
|
+
transcoordT2P(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
189
|
+
transcoordT2S(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
190
|
+
transcoordS2TR(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
191
|
+
transcoordS2O(x: number, y: number, target: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
192
|
+
transcoordC2S(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
193
|
+
transcoordS2C(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
194
194
|
toParent(x: number, y: number, rp?: import("@hatiolab/things-scene").POINT): import("@hatiolab/things-scene").POINT;
|
|
195
195
|
fromParent(x: number, y: number, rp?: import("@hatiolab/things-scene").POINT): import("@hatiolab/things-scene").POINT;
|
|
196
|
-
toScene(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
197
|
-
fromScene(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
198
|
-
toLocal(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
199
|
-
toGlobal(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
200
|
-
toOther(x: number, y: number, target: Component): import("@hatiolab/things-scene").POINT;
|
|
196
|
+
toScene(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
197
|
+
fromScene(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
198
|
+
toLocal(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
199
|
+
toGlobal(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
200
|
+
toOther(x: number, y: number, target: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
201
|
+
on<K extends keyof import("@hatiolab/things-scene").ComponentEventMap>(name: K, callback: (...args: import("@hatiolab/things-scene").ComponentEventMap[K]) => void, context?: any): any;
|
|
201
202
|
on(name: string | object, callback: Function, context?: any): any;
|
|
203
|
+
off<K extends keyof import("@hatiolab/things-scene").ComponentEventMap>(name: K, callback?: ((...args: import("@hatiolab/things-scene").ComponentEventMap[K]) => void) | undefined, context?: any): any;
|
|
202
204
|
off(name?: string | object, callback?: Function, context?: any): any;
|
|
205
|
+
once<K extends keyof import("@hatiolab/things-scene").ComponentEventMap>(name: K, callback: (...args: import("@hatiolab/things-scene").ComponentEventMap[K]) => void, context?: any): any;
|
|
203
206
|
once(name: string | object, callback: Function, context?: any): any;
|
|
207
|
+
trigger<K extends keyof import("@hatiolab/things-scene").ComponentEventMap>(name: K, ...args: import("@hatiolab/things-scene").ComponentEventMap[K]): any;
|
|
204
208
|
trigger(name: string, ...args: any[]): any;
|
|
205
209
|
delegate_on(delegator: any): any;
|
|
206
210
|
delegate_off(delegator: any): any;
|
|
207
211
|
calculateBounds?(): void;
|
|
208
212
|
oncreate_element?(element: HTMLElement): void;
|
|
209
|
-
removeComponent(component: Component, ghost?: boolean): void;
|
|
210
|
-
addComponent(component: Component, ghost?: boolean): void;
|
|
211
|
-
insertComponentAt(component: Component, index: number, ghost?: boolean): void;
|
|
212
|
-
getOverlay(component: Component): HTMLElement | undefined;
|
|
213
|
-
findById(id: string): Component | undefined;
|
|
214
|
-
findByRefid(ref: string | number): Component | undefined;
|
|
215
|
-
findAllById(id: string): Component[];
|
|
213
|
+
removeComponent(component: import("@hatiolab/things-scene").Component, ghost?: boolean): void;
|
|
214
|
+
addComponent(component: import("@hatiolab/things-scene").Component, ghost?: boolean): void;
|
|
215
|
+
insertComponentAt(component: import("@hatiolab/things-scene").Component, index: number, ghost?: boolean): void;
|
|
216
|
+
getOverlay(component: import("@hatiolab/things-scene").Component): HTMLElement | undefined;
|
|
217
|
+
findById(id: string): import("@hatiolab/things-scene").Component | undefined;
|
|
218
|
+
findByRefid(ref: string | number): import("@hatiolab/things-scene").Component | undefined;
|
|
219
|
+
findAllById(id: string): import("@hatiolab/things-scene").Component[];
|
|
216
220
|
resize(): void;
|
|
217
221
|
fit(type?: string): void;
|
|
218
|
-
get components(): Component[] | undefined;
|
|
222
|
+
get components(): import("@hatiolab/things-scene").Component[] | undefined;
|
|
219
223
|
get layout(): any;
|
|
220
224
|
get auxOverlay(): HTMLElement | undefined;
|
|
221
225
|
get isReady(): boolean;
|
|
222
226
|
get unitScale(): number;
|
|
223
|
-
get selected(): Component[];
|
|
224
|
-
set selected(_v: Component[]): any;
|
|
225
|
-
get focused(): Component | null;
|
|
226
|
-
set focused(_v: Component | null): any;
|
|
227
|
+
get selected(): import("@hatiolab/things-scene").Component[];
|
|
228
|
+
set selected(_v: import("@hatiolab/things-scene").Component[]): any;
|
|
229
|
+
get focused(): import("@hatiolab/things-scene").Component | null;
|
|
230
|
+
set focused(_v: import("@hatiolab/things-scene").Component | null): any;
|
|
227
231
|
get hasSameParentForAllSelected(): boolean;
|
|
228
232
|
set hasSameParentForAllSelected(_v: boolean): any;
|
|
229
233
|
get fitMode(): string | undefined;
|
package/dist/gauge-circle.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gauge-circle.js","sourceRoot":"","sources":["../src/gauge-circle.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,EAA8B,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAEvG,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAElD,MAAM,MAAM,GAAoB;IAC9B,OAAO,EAAE,KAAK;IACd,SAAS,EAAE,IAAI;IACf,SAAS,EAAE,IAAI;IACf,UAAU,EAAE;QACV,GAAG,UAAU;QACb;YACE,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,aAAa;YACpB,IAAI,EAAE,YAAY;YAClB,QAAQ,EAAE,YAAY;SACvB;QACD;YACE,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,WAAW;YAClB,IAAI,EAAE,UAAU;YAChB,QAAQ,EAAE,UAAU;SACrB;QACD;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,OAAO;YACb,KAAK,EAAE,yBAAyB;YAChC,IAAI,EAAE,sBAAsB;YAC5B,QAAQ,EAAE,sBAAsB;SACjC;QACD;YACE,IAAI,EAAE,UAAU;YAChB,KAAK,EAAE,SAAS;YAChB,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,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,GAAG,EAAE,EAAE,GAAG,YAAY,CAAC,CAAA;YAClF,CAAC;QACH,CAAC;QAED,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,CAAA;QACzB,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAA;IAC7B,CAAC;IAED,QAAQ,CAAC,CAAS,EAAE,CAAS;QAC3B,qBAAqB;QACrB,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,IAAI,CAAC,KAAK,CAAA;QAEnC,IAAI,KAAK,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,GAAG,GAAG,CAAC,CAAA;QACrC,IAAI,KAAK,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,GAAG,GAAG,CAAC,CAAA;QAErC,OAAO,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,IAAI,CAAA;IAC7C,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,CAAA;AAnMoB,WAAW;IAD/B,cAAc,CAAC,cAAc,CAAC;GACV,WAAW,CAmM/B;eAnMoB,WAAW","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport { Component, ComponentNature, Donut, sceneComponent, ValueHolder } from '@hatiolab/things-scene'\n\nimport { PROPERTIES } from './gauge-properties.js'\n\nconst NATURE: ComponentNature = {\n mutable: false,\n resizable: true,\n rotatable: true,\n properties: [\n ...PROPERTIES,\n {\n type: 'number',\n label: 'start-angle',\n name: 'startAngle',\n property: 'startAngle'\n },\n {\n type: 'number',\n label: 'end-angle',\n name: 'endAngle',\n property: 'endAngle'\n },\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: 'color',\n label: 'inner-circle-fill-style',\n name: 'innerCircleFillStyle',\n property: 'innerCircleFillStyle'\n },\n {\n type: 'checkbox',\n label: 'in-text',\n name: 'inText',\n property: 'inText'\n }\n ],\n help: 'scene/component/gauge-circle'\n}\n\nfunction countSignificantFigures(number: number) {\n const numStr = number.toString()\n const parts = numStr.split('.')\n\n // 소수점 이하 부분을 분석\n if (parts.length === 2) {\n const decimalPart = parts[1]\n let significantFigures = 0\n\n for (let i = 0; i < decimalPart.length; i++) {\n if (decimalPart[i] !== '0') {\n significantFigures = decimalPart.length - i\n break\n }\n }\n\n return significantFigures\n }\n\n // 정수인 경우 유효 자릿수 없음\n return 0\n}\n\nfunction drawStepLine(context: CanvasRenderingContext2D, ang: number, rx: number, stepNeedleSize: number) {\n context.rotate(ang)\n context.translate(0, -rx)\n\n context.fillRect(0, -rx * 0.14, stepNeedleSize, rx * 0.175)\n context.translate(0, rx)\n context.rotate(-ang)\n}\n\nfunction drawSubStepLine(context: CanvasRenderingContext2D, ang: number, rx: number, stepNeedleSize: number) {\n context.rotate(ang)\n context.translate(0, -rx)\n\n context.fillRect(0, -rx * 0.04, stepNeedleSize, rx * 0.075)\n context.translate(0, rx)\n context.rotate(-ang)\n}\n\nfunction drawStepText(context: CanvasRenderingContext2D, text: string, ang: number, rx: number) {\n context.rotate(ang)\n context.translate(0, -rx * 0.83)\n context.rotate(-ang)\n\n context.fillText(text, 0, 0)\n context.rotate(ang)\n context.translate(0, rx * 0.83)\n context.rotate(-ang)\n}\n\nfunction drawNeedle(context: CanvasRenderingContext2D, rx: number, ang: number) {\n context.rotate(ang)\n\n context.beginPath()\n\n context.moveTo(rx * 0.035, 0) // 중앙 두께\n\n context.lineTo(0, rx * 0.8) // 끝 점\n\n context.lineTo(-rx * 0.035, 0) // 중앙 두께\n\n context.lineTo(-rx * 0.015, -rx * 0.2) // 뒷쪽 두께\n context.lineTo(rx * 0.015, -rx * 0.2) // 뒷쪽 두께\n\n context.rotate(-ang)\n}\n\n@sceneComponent('gauge-circle')\nexport default class GaugeCircle extends ValueHolder(Donut) {\n render(context: CanvasRenderingContext2D) {\n var {\n lineWidth = 20,\n startValue,\n endValue,\n step,\n subStep,\n startAngle = 0,\n endAngle = 180,\n fontColor = 'black',\n showStepText = true,\n showStartValue = true,\n showEndValue = true,\n showStepLine = true,\n showSubStep = true,\n inText = true,\n colorStops, // 스텝별 각각 다른 색\n fillStyle,\n textFillStyle = 'black',\n needleFillStyle = 'black',\n innerCircleFillStyle = 'gray',\n stepNeedleSize = 2,\n stepFillStyle,\n stepTextSize,\n cx,\n cy,\n rx,\n ry,\n ratio,\n animFromBase = false\n } = this.state\n\n startValue = Number(startValue)\n\n this.animOnValueChange(this.value, animFromBase, startValue)\n\n const RADIAN = 0.0174533 / Math.PI\n const rxRatio = (rx / 100) * ratio // 원 안에 지워지는 비율을 계산한 rx - ratio의 비율에 따라 크기가 변함\n const ryRatio = (ry / 100) * ratio // 원 안에 지워지는 비율을 계산한 ry - ratio의 비율에 따라 크기가 변함\n const circleSize = (endAngle - startAngle) / 180 // 원의 총 길이. - PI * 2가 원이므로 (360도 = 2, 180도 = 1)\n const totalValue = endValue - startValue // 게이지의 시작과 끝 값의 크기\n\n startAngle = startAngle * RADIAN - 0.5 // 맨 위쪽을 중심으로 앵글의 범위에 따라 왼쪽으로 넓어짐\n endAngle = endAngle * RADIAN - 0.5 // 맨 위쪽을 중심으로 앵글의 범위에 따라 오른쪽으로 넓어짐\n\n context.translate(cx, cy)\n\n //// 메인 게이지 원 그리기 ////\n context.beginPath()\n\n context.ellipse(0, 0, Math.abs(rx), Math.abs(ry), 0, startAngle * Math.PI, endAngle * Math.PI)\n this.drawStroke(context)\n context.ellipse(0, 0, Math.abs(rxRatio), Math.abs(ryRatio), 0, endAngle * Math.PI, startAngle * Math.PI, true) // 반대로 그리며 원을 지움.\n // this.drawFill(context)\n\n context.closePath()\n\n //// 스텝별 색 칠하기 ////\n if (colorStops) {\n let beforeValue = 0\n let endStepAngle = 0\n context.moveTo(0, 0)\n\n colorStops.forEach(function (\n v: { position: number; color: string },\n idx: number,\n arr: { position: number; color: string }[]\n ) {\n context.beginPath()\n\n let value = Math.max(Math.min(v.position - startValue, totalValue), 0) // v.position 범위의 최소값은 0, 최대값은 totalValue가 되야함.\n let startStepAngle = endStepAngle || Math.PI * (startAngle + (circleSize * beforeValue) / totalValue)\n\n if (idx === arr.length - 1)\n // 마지막값은 무조건 끝까지 채워주도록 한다\n endStepAngle = Math.PI * (startAngle + circleSize)\n else endStepAngle = Math.PI * (startAngle + (circleSize * value) / totalValue)\n\n if (beforeValue > totalValue || beforeValue > value)\n // 값이 게이지의 최대 값을 넘어가거나 이전 값 보다 현재값이 작으면 다시 그릴 필요 없음\n return false\n\n context.ellipse(0, 0, Math.abs(rx), Math.abs(ry), 0, startStepAngle, endStepAngle)\n context.ellipse(0, 0, Math.abs(rxRatio), Math.abs(ryRatio), 0, endStepAngle, startStepAngle, true)\n context.fillStyle = v.color\n context.fill()\n\n beforeValue = value\n })\n }\n context.scale(1, ry / rx)\n\n //// 바늘 그리기 ////\n context.beginPath()\n let drawingValue = this.animValue\n drawingValue = Math.max(Math.min(drawingValue, endValue), startValue) // 그려지는 값은 startValue보다 작을 수 없고, endValue보다 클 수 없음.\n\n let ang = Math.PI * ((circleSize * (drawingValue - startValue)) / totalValue + startAngle - 0.5)\n\n drawNeedle(context, rx, ang)\n\n context.fillStyle = needleFillStyle\n context.fill()\n\n //// 중앙 원 그리기 ////\n context.beginPath()\n context.ellipse(0, 0, Math.abs(rx) / 15, Math.abs(rx) / 15, 0, 0, 2 * Math.PI)\n context.fillStyle = innerCircleFillStyle\n context.fill()\n\n //// 스텝 선 그리기 ////\n context.fillStyle = stepFillStyle\n if (showStepLine) {\n let count = totalValue / step\n\n // Draw StartValue\n drawStepLine(context, Math.PI * (startAngle + 0.5), rx * 0.8, stepNeedleSize) // 원을 그릴때 PI는 45도 부터 그리지만 angle은 0도부터 틀어서 + 0.5도를 곱해줘야함\n // Draw StepValue\n for (let num = 1; num < count; num++) {\n let ang = Math.PI * ((circleSize / count) * num + startAngle + 0.5)\n\n drawStepLine(context, ang, rx * 0.8, stepNeedleSize)\n }\n // Draw EndValue\n drawStepLine(context, Math.PI * (endAngle + 0.5), rx * 0.8, stepNeedleSize)\n }\n\n //// 서브 스탭 그리기 ////\n if (showSubStep && subStep > 0) {\n let count = Math.round(totalValue / subStep)\n\n // Draw StepValue\n for (let num = 1; num <= count; num++) {\n if ((num * subStep) % step == 0) {\n // 메인 스탭과 서브 스탭은 그리지 않음\n continue\n }\n let ang = Math.PI * ((circleSize / count) * num + startAngle + 0.5)\n\n drawSubStepLine(context, ang, rx * 0.8, stepNeedleSize)\n }\n }\n\n //// 스텝 텍스트 그리기 ////\n context.fillStyle = textFillStyle\n context.font = (rx * stepTextSize) / 50 + 'px arial'\n context.textBaseline = 'middle'\n context.textAlign = 'center'\n let textLocation = inText ? 0.8 : 1.35\n\n if (showStartValue) {\n // Draw StartText\n drawStepText(context, startValue, Math.PI * (startAngle + 0.5), rx * textLocation)\n }\n\n if (showEndValue) {\n // Draw EndText\n drawStepText(context, endValue, Math.PI * (endAngle + 0.5), rx * textLocation)\n }\n\n if (showStepText) {\n // Draw StepText\n let count = totalValue / step\n let significantFigures = countSignificantFigures(step)\n\n for (let num = 1; num < count; num++) {\n let value = startValue + step * num\n let ang = Math.PI * ((circleSize / count) * num + startAngle + 0.5)\n\n drawStepText(context, value.toFixed(significantFigures), ang, rx * textLocation)\n }\n }\n\n context.scale(1, rx / ry)\n context.translate(-cx, -cy)\n }\n\n contains(x: number, y: number): boolean {\n // 컨테인즈는 Ellipse로 정의함\n var { cx, cy, rx, ry } = this.state\n\n var normx = (x - cx) / (rx * 2 - 0.5)\n var normy = (y - cy) / (ry * 2 - 0.5)\n\n return normx * normx + normy * normy < 0.25\n }\n\n postrender(context: CanvasRenderingContext2D) {\n this.drawText(context)\n }\n\n get nature() {\n return NATURE\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"gauge-circle.js","sourceRoot":"","sources":["../src/gauge-circle.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,EAAmB,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAE5F,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAElD,MAAM,MAAM,GAAoB;IAC9B,OAAO,EAAE,KAAK;IACd,SAAS,EAAE,IAAI;IACf,SAAS,EAAE,IAAI;IACf,UAAU,EAAE;QACV,GAAG,UAAU;QACb;YACE,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,aAAa;YACpB,IAAI,EAAE,YAAY;YAClB,QAAQ,EAAE,YAAY;SACvB;QACD;YACE,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,WAAW;YAClB,IAAI,EAAE,UAAU;YAChB,QAAQ,EAAE,UAAU;SACrB;QACD;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,OAAO;YACb,KAAK,EAAE,yBAAyB;YAChC,IAAI,EAAE,sBAAsB;YAC5B,QAAQ,EAAE,sBAAsB;SACjC;QACD;YACE,IAAI,EAAE,UAAU;YAChB,KAAK,EAAE,SAAS;YAChB,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,QAAQ;SACnB;KACF;IACD,IAAI,EAAE,8BAA8B;CACrC,CAAA;AAED,SAAS,uBAAuB,CAAC,MAAc;IAC7C,MAAM,MAAM,GAAG,MAA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AG,EAAE,CAAC,CAAA;QACzB,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAA;IAC7B,CAAC;IAED,QAAQ,CAAC,CAAS,EAAE,CAAS;QAC3B,qBAAqB;QACrB,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,IAAI,CAAC,KAAK,CAAA;QAEnC,IAAI,KAAK,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,GAAG,GAAG,CAAC,CAAA;QACrC,IAAI,KAAK,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,GAAG,GAAG,CAAC,CAAA;QAErC,OAAO,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,IAAI,CAAA;IAC7C,CAAC;IAED,UAAU,CAAC,OAAiC;QAC1C,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;IACxB,CAAC;IACD,IAAI,MAAM;QACR,OAAO,MAAM,CAAA;IACf,CAAC;CACF,CAAA;AAlMoB,WAAW;IAD/B,cAAc,CAAC,cAAc,CAAC;GACV,WAAW,CAkM/B;eAlMoB,WAAW","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport { ComponentNature, Donut, sceneComponent, ValueHolder } from '@hatiolab/things-scene'\n\nimport { PROPERTIES } from './gauge-properties.js'\n\nconst NATURE: ComponentNature = {\n mutable: false,\n resizable: true,\n rotatable: true,\n properties: [\n ...PROPERTIES,\n {\n type: 'number',\n label: 'start-angle',\n name: 'startAngle',\n property: 'startAngle'\n },\n {\n type: 'number',\n label: 'end-angle',\n name: 'endAngle',\n property: 'endAngle'\n },\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: 'color',\n label: 'inner-circle-fill-style',\n name: 'innerCircleFillStyle',\n property: 'innerCircleFillStyle'\n },\n {\n type: 'checkbox',\n label: 'in-text',\n name: 'inText',\n property: 'inText'\n }\n ],\n help: 'scene/component/gauge-circle'\n}\n\nfunction countSignificantFigures(number: number) {\n const numStr = number.toString()\n const parts = numStr.split('.')\n\n // 소수점 이하 부분을 분석\n if (parts.length === 2) {\n const decimalPart = parts[1]\n let significantFigures = 0\n\n for (let i = 0; i < decimalPart.length; i++) {\n if (decimalPart[i] !== '0') {\n significantFigures = decimalPart.length - i\n break\n }\n }\n\n return significantFigures\n }\n\n // 정수인 경우 유효 자릿수 없음\n return 0\n}\n\nfunction drawStepLine(context: CanvasRenderingContext2D, ang: number, rx: number, stepNeedleSize: number) {\n context.rotate(ang)\n context.translate(0, -rx)\n\n context.fillRect(0, -rx * 0.14, stepNeedleSize, rx * 0.175)\n context.translate(0, rx)\n context.rotate(-ang)\n}\n\nfunction drawSubStepLine(context: CanvasRenderingContext2D, ang: number, rx: number, stepNeedleSize: number) {\n context.rotate(ang)\n context.translate(0, -rx)\n\n context.fillRect(0, -rx * 0.04, stepNeedleSize, rx * 0.075)\n context.translate(0, rx)\n context.rotate(-ang)\n}\n\nfunction drawStepText(context: CanvasRenderingContext2D, text: string, ang: number, rx: number) {\n context.rotate(ang)\n context.translate(0, -rx * 0.83)\n context.rotate(-ang)\n\n context.fillText(text, 0, 0)\n context.rotate(ang)\n context.translate(0, rx * 0.83)\n context.rotate(-ang)\n}\n\nfunction drawNeedle(context: CanvasRenderingContext2D, rx: number, ang: number) {\n context.rotate(ang)\n\n context.beginPath()\n\n context.moveTo(rx * 0.035, 0) // 중앙 두께\n\n context.lineTo(0, rx * 0.8) // 끝 점\n\n context.lineTo(-rx * 0.035, 0) // 중앙 두께\n\n context.lineTo(-rx * 0.015, -rx * 0.2) // 뒷쪽 두께\n context.lineTo(rx * 0.015, -rx * 0.2) // 뒷쪽 두께\n\n context.rotate(-ang)\n}\n\n@sceneComponent('gauge-circle')\nexport default class GaugeCircle extends ValueHolder(Donut) {\n render(context: CanvasRenderingContext2D) {\n var {\n lineWidth = 20,\n startValue,\n endValue,\n step,\n subStep,\n startAngle = 0,\n endAngle = 180,\n fontColor = 'black',\n showStepText = true,\n showStartValue = true,\n showEndValue = true,\n showStepLine = true,\n showSubStep = true,\n inText = true,\n colorStops, // 스텝별 각각 다른 색\n fillStyle,\n textFillStyle = 'black',\n needleFillStyle = 'black',\n innerCircleFillStyle = 'gray',\n stepNeedleSize = 2,\n stepFillStyle,\n stepTextSize,\n cx,\n cy,\n rx,\n ry,\n ratio,\n animFromBase = false\n } = this.state\n\n startValue = Number(startValue)\n\n this.animOnValueChange(this.value, animFromBase, startValue)\n\n const RADIAN = 0.0174533 / Math.PI\n const rxRatio = (rx / 100) * ratio // 원 안에 지워지는 비율을 계산한 rx - ratio의 비율에 따라 크기가 변함\n const ryRatio = (ry / 100) * ratio // 원 안에 지워지는 비율을 계산한 ry - ratio의 비율에 따라 크기가 변함\n const circleSize = (endAngle - startAngle) / 180 // 원의 총 길이. - PI * 2가 원이므로 (360도 = 2, 180도 = 1)\n const totalValue = endValue - startValue // 게이지의 시작과 끝 값의 크기\n\n startAngle = startAngle * RADIAN - 0.5 // 맨 위쪽을 중심으로 앵글의 범위에 따라 왼쪽으로 넓어짐\n endAngle = endAngle * RADIAN - 0.5 // 맨 위쪽을 중심으로 앵글의 범위에 따라 오른쪽으로 넓어짐\n\n context.translate(cx, cy)\n\n //// 메인 게이지 원 그리기 ////\n context.beginPath()\n\n context.ellipse(0, 0, Math.abs(rx), Math.abs(ry), 0, startAngle * Math.PI, endAngle * Math.PI)\n this.drawStroke(context)\n context.ellipse(0, 0, Math.abs(rxRatio), Math.abs(ryRatio), 0, endAngle * Math.PI, startAngle * Math.PI, true) // 반대로 그리며 원을 지움.\n // this.drawFill(context)\n\n context.closePath()\n\n //// 스텝별 색 칠하기 ////\n if (colorStops) {\n let beforeValue = 0\n let endStepAngle = 0\n context.moveTo(0, 0)\n\n colorStops.forEach(function (\n v: { position: number; color: string },\n idx: number,\n arr: { position: number; color: string }[]\n ) {\n context.beginPath()\n\n let value = Math.max(Math.min(v.position - startValue, totalValue), 0) // v.position 범위의 최소값은 0, 최대값은 totalValue가 되야함.\n let startStepAngle = endStepAngle || Math.PI * (startAngle + (circleSize * beforeValue) / totalValue)\n\n if (idx === arr.length - 1)\n // 마지막값은 무조건 끝까지 채워주도록 한다\n endStepAngle = Math.PI * (startAngle + circleSize)\n else endStepAngle = Math.PI * (startAngle + (circleSize * value) / totalValue)\n\n if (beforeValue > totalValue || beforeValue > value)\n // 값이 게이지의 최대 값을 넘어가거나 이전 값 보다 현재값이 작으면 다시 그릴 필요 없음\n return false\n\n context.ellipse(0, 0, Math.abs(rx), Math.abs(ry), 0, startStepAngle, endStepAngle)\n context.ellipse(0, 0, Math.abs(rxRatio), Math.abs(ryRatio), 0, endStepAngle, startStepAngle, true)\n context.fillStyle = v.color\n context.fill()\n\n beforeValue = value\n })\n }\n context.scale(1, ry / rx)\n\n //// 바늘 그리기 ////\n context.beginPath()\n let drawingValue = this.animValue\n drawingValue = Math.max(Math.min(drawingValue, endValue), startValue) // 그려지는 값은 startValue보다 작을 수 없고, endValue보다 클 수 없음.\n\n let ang = Math.PI * ((circleSize * (drawingValue - startValue)) / totalValue + startAngle - 0.5)\n\n drawNeedle(context, rx, ang)\n\n context.fillStyle = needleFillStyle\n context.fill()\n\n //// 중앙 원 그리기 ////\n context.beginPath()\n context.ellipse(0, 0, Math.abs(rx) / 15, Math.abs(rx) / 15, 0, 0, 2 * Math.PI)\n context.fillStyle = innerCircleFillStyle\n context.fill()\n\n //// 스텝 선 그리기 ////\n context.fillStyle = stepFillStyle\n if (showStepLine) {\n let count = totalValue / step\n\n // Draw StartValue\n drawStepLine(context, Math.PI * (startAngle + 0.5), rx * 0.8, stepNeedleSize) // 원을 그릴때 PI는 45도 부터 그리지만 angle은 0도부터 틀어서 + 0.5도를 곱해줘야함\n // Draw StepValue\n for (let num = 1; num < count; num++) {\n let ang = Math.PI * ((circleSize / count) * num + startAngle + 0.5)\n\n drawStepLine(context, ang, rx * 0.8, stepNeedleSize)\n }\n // Draw EndValue\n drawStepLine(context, Math.PI * (endAngle + 0.5), rx * 0.8, stepNeedleSize)\n }\n\n //// 서브 스탭 그리기 ////\n if (showSubStep && subStep > 0) {\n let count = Math.round(totalValue / subStep)\n\n // Draw StepValue\n for (let num = 1; num <= count; num++) {\n if ((num * subStep) % step == 0) {\n // 메인 스탭과 서브 스탭은 그리지 않음\n continue\n }\n let ang = Math.PI * ((circleSize / count) * num + startAngle + 0.5)\n\n drawSubStepLine(context, ang, rx * 0.8, stepNeedleSize)\n }\n }\n\n //// 스텝 텍스트 그리기 ////\n context.fillStyle = textFillStyle\n context.font = (rx * stepTextSize) / 50 + 'px arial'\n context.textBaseline = 'middle'\n context.textAlign = 'center'\n let textLocation = inText ? 0.8 : 1.35\n\n if (showStartValue) {\n // Draw StartText\n drawStepText(context, startValue, Math.PI * (startAngle + 0.5), rx * textLocation)\n }\n\n if (showEndValue) {\n // Draw EndText\n drawStepText(context, endValue, Math.PI * (endAngle + 0.5), rx * textLocation)\n }\n\n if (showStepText) {\n // Draw StepText\n let count = totalValue / step\n let significantFigures = countSignificantFigures(step)\n\n for (let num = 1; num < count; num++) {\n let value = startValue + step * num\n let ang = Math.PI * ((circleSize / count) * num + startAngle + 0.5)\n\n drawStepText(context, value.toFixed(significantFigures), ang, rx * textLocation)\n }\n }\n\n context.scale(1, rx / ry)\n context.translate(-cx, -cy)\n }\n\n contains(x: number, y: number): boolean {\n // 컨테인즈는 Ellipse로 정의함\n var { cx, cy, rx, ry } = this.state\n\n var normx = (x - cx) / (rx * 2 - 0.5)\n var normy = (y - cy) / (ry * 2 - 0.5)\n\n return normx * normx + normy * normy < 0.25\n }\n\n postrender(context: CanvasRenderingContext2D) {\n this.drawText(context)\n }\n get nature() {\n return NATURE\n }\n}\n"]}
|
package/dist/gauge-horizon.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ComponentNature, Shape } from '@hatiolab/things-scene';
|
|
2
2
|
declare const GaugeHorizon_base: (new (...args: any[]) => {
|
|
3
3
|
_lastValue: number;
|
|
4
4
|
_anim_alpha: number;
|
|
@@ -40,7 +40,7 @@ declare const GaugeHorizon_base: (new (...args: any[]) => {
|
|
|
40
40
|
get disposed(): boolean;
|
|
41
41
|
isLayer(): boolean;
|
|
42
42
|
isGroup(): boolean;
|
|
43
|
-
isContainer(): this is import("@hatiolab/things-scene
|
|
43
|
+
isContainer(): this is import("@hatiolab/things-scene").Container;
|
|
44
44
|
isLine(): boolean;
|
|
45
45
|
isRoot(): boolean;
|
|
46
46
|
isRootModel(): boolean;
|
|
@@ -56,9 +56,9 @@ declare const GaugeHorizon_base: (new (...args: any[]) => {
|
|
|
56
56
|
get(property: any): any;
|
|
57
57
|
set(props: any, propval?: any): any;
|
|
58
58
|
getState(property: any): any;
|
|
59
|
-
setState(props:
|
|
59
|
+
setState(props: Partial<import("@hatiolab/things-scene").State> | string, propval?: any): any;
|
|
60
60
|
get model(): any;
|
|
61
|
-
get state():
|
|
61
|
+
get state(): import("@hatiolab/things-scene").State;
|
|
62
62
|
get hierarchy(): any;
|
|
63
63
|
get volatile(): never[];
|
|
64
64
|
_applyProps(target: any, props: any, options: any): any;
|
|
@@ -100,7 +100,7 @@ declare const GaugeHorizon_base: (new (...args: any[]) => {
|
|
|
100
100
|
prerender(context: import("@hatiolab/things-scene").SceneRenderContext): void;
|
|
101
101
|
render(context: import("@hatiolab/things-scene").SceneRenderContext): void;
|
|
102
102
|
postrender(context: import("@hatiolab/things-scene").SceneRenderContext): void;
|
|
103
|
-
prepare(resolve: (component: Component) => void, reject: (reason: any) => void): void;
|
|
103
|
+
prepare(resolve: (component: import("@hatiolab/things-scene").Component) => void, reject: (reason: any) => void): void;
|
|
104
104
|
prepareIf(condition: boolean): void;
|
|
105
105
|
drawText(context: import("@hatiolab/things-scene").SceneRenderContext): void;
|
|
106
106
|
drawStroke(context: import("@hatiolab/things-scene").SceneRenderContext, override?: Record<string, unknown>): void;
|
|
@@ -149,16 +149,16 @@ declare const GaugeHorizon_base: (new (...args: any[]) => {
|
|
|
149
149
|
get started(): boolean;
|
|
150
150
|
set started(v: boolean): any;
|
|
151
151
|
get controls(): import("@hatiolab/things-scene").Control[] | undefined;
|
|
152
|
-
findFirst(finder: string | ((c: Component) => boolean), ...others: any[]): Component | undefined;
|
|
153
|
-
findAll(s: string | ((c: Component) => boolean), ...others: any[]): any[] | undefined;
|
|
154
|
-
capture(x: number, y: number, except?: (c: Component) => boolean): any;
|
|
152
|
+
findFirst(finder: string | ((c: import("@hatiolab/things-scene").Component) => boolean), ...others: any[]): import("@hatiolab/things-scene").Component | undefined;
|
|
153
|
+
findAll(s: string | ((c: import("@hatiolab/things-scene").Component) => boolean), ...others: any[]): any[] | undefined;
|
|
154
|
+
capture(x: number, y: number, except?: (c: import("@hatiolab/things-scene").Component) => boolean): any;
|
|
155
155
|
findAnchor(name: string): any;
|
|
156
|
-
isDescendible(container: Component): boolean;
|
|
156
|
+
isDescendible(container: import("@hatiolab/things-scene").Component | any): boolean;
|
|
157
157
|
getContext(component?: unknown): any;
|
|
158
|
-
get root(): Component;
|
|
159
|
-
get rootModel(): Component;
|
|
160
|
-
get parent(): Component;
|
|
161
|
-
set parent(v: Component): any;
|
|
158
|
+
get root(): import("@hatiolab/things-scene").Component;
|
|
159
|
+
get rootModel(): import("@hatiolab/things-scene").Component;
|
|
160
|
+
get parent(): import("@hatiolab/things-scene").Component;
|
|
161
|
+
set parent(v: import("@hatiolab/things-scene").Component): any;
|
|
162
162
|
get anchors(): import("@hatiolab/things-scene").Anchor[];
|
|
163
163
|
get scalable(): boolean;
|
|
164
164
|
get stuck(): boolean;
|
|
@@ -184,46 +184,50 @@ declare const GaugeHorizon_base: (new (...args: any[]) => {
|
|
|
184
184
|
ondropfile(transfered: FileList, files: string[]): void;
|
|
185
185
|
transcoordS2P(x: number, y: number, rp?: import("@hatiolab/things-scene").POINT): import("@hatiolab/things-scene").POINT;
|
|
186
186
|
transcoordP2S(x: number, y: number, rp?: import("@hatiolab/things-scene").POINT): import("@hatiolab/things-scene").POINT;
|
|
187
|
-
transcoordS2T(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
188
|
-
transcoordT2P(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
189
|
-
transcoordT2S(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
190
|
-
transcoordS2TR(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
191
|
-
transcoordS2O(x: number, y: number, target: Component): import("@hatiolab/things-scene").POINT;
|
|
192
|
-
transcoordC2S(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
193
|
-
transcoordS2C(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
187
|
+
transcoordS2T(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
188
|
+
transcoordT2P(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
189
|
+
transcoordT2S(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
190
|
+
transcoordS2TR(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
191
|
+
transcoordS2O(x: number, y: number, target: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
192
|
+
transcoordC2S(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
193
|
+
transcoordS2C(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
194
194
|
toParent(x: number, y: number, rp?: import("@hatiolab/things-scene").POINT): import("@hatiolab/things-scene").POINT;
|
|
195
195
|
fromParent(x: number, y: number, rp?: import("@hatiolab/things-scene").POINT): import("@hatiolab/things-scene").POINT;
|
|
196
|
-
toScene(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
197
|
-
fromScene(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
198
|
-
toLocal(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
199
|
-
toGlobal(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
200
|
-
toOther(x: number, y: number, target: Component): import("@hatiolab/things-scene").POINT;
|
|
196
|
+
toScene(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
197
|
+
fromScene(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
198
|
+
toLocal(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
199
|
+
toGlobal(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
200
|
+
toOther(x: number, y: number, target: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
201
|
+
on<K extends keyof import("@hatiolab/things-scene").ComponentEventMap>(name: K, callback: (...args: import("@hatiolab/things-scene").ComponentEventMap[K]) => void, context?: any): any;
|
|
201
202
|
on(name: string | object, callback: Function, context?: any): any;
|
|
203
|
+
off<K extends keyof import("@hatiolab/things-scene").ComponentEventMap>(name: K, callback?: ((...args: import("@hatiolab/things-scene").ComponentEventMap[K]) => void) | undefined, context?: any): any;
|
|
202
204
|
off(name?: string | object, callback?: Function, context?: any): any;
|
|
205
|
+
once<K extends keyof import("@hatiolab/things-scene").ComponentEventMap>(name: K, callback: (...args: import("@hatiolab/things-scene").ComponentEventMap[K]) => void, context?: any): any;
|
|
203
206
|
once(name: string | object, callback: Function, context?: any): any;
|
|
207
|
+
trigger<K extends keyof import("@hatiolab/things-scene").ComponentEventMap>(name: K, ...args: import("@hatiolab/things-scene").ComponentEventMap[K]): any;
|
|
204
208
|
trigger(name: string, ...args: any[]): any;
|
|
205
209
|
delegate_on(delegator: any): any;
|
|
206
210
|
delegate_off(delegator: any): any;
|
|
207
211
|
calculateBounds?(): void;
|
|
208
212
|
oncreate_element?(element: HTMLElement): void;
|
|
209
|
-
removeComponent(component: Component, ghost?: boolean): void;
|
|
210
|
-
addComponent(component: Component, ghost?: boolean): void;
|
|
211
|
-
insertComponentAt(component: Component, index: number, ghost?: boolean): void;
|
|
212
|
-
getOverlay(component: Component): HTMLElement | undefined;
|
|
213
|
-
findById(id: string): Component | undefined;
|
|
214
|
-
findByRefid(ref: string | number): Component | undefined;
|
|
215
|
-
findAllById(id: string): Component[];
|
|
213
|
+
removeComponent(component: import("@hatiolab/things-scene").Component, ghost?: boolean): void;
|
|
214
|
+
addComponent(component: import("@hatiolab/things-scene").Component, ghost?: boolean): void;
|
|
215
|
+
insertComponentAt(component: import("@hatiolab/things-scene").Component, index: number, ghost?: boolean): void;
|
|
216
|
+
getOverlay(component: import("@hatiolab/things-scene").Component): HTMLElement | undefined;
|
|
217
|
+
findById(id: string): import("@hatiolab/things-scene").Component | undefined;
|
|
218
|
+
findByRefid(ref: string | number): import("@hatiolab/things-scene").Component | undefined;
|
|
219
|
+
findAllById(id: string): import("@hatiolab/things-scene").Component[];
|
|
216
220
|
resize(): void;
|
|
217
221
|
fit(type?: string): void;
|
|
218
|
-
get components(): Component[] | undefined;
|
|
222
|
+
get components(): import("@hatiolab/things-scene").Component[] | undefined;
|
|
219
223
|
get layout(): any;
|
|
220
224
|
get auxOverlay(): HTMLElement | undefined;
|
|
221
225
|
get isReady(): boolean;
|
|
222
226
|
get unitScale(): number;
|
|
223
|
-
get selected(): Component[];
|
|
224
|
-
set selected(_v: Component[]): any;
|
|
225
|
-
get focused(): Component | null;
|
|
226
|
-
set focused(_v: Component | null): any;
|
|
227
|
+
get selected(): import("@hatiolab/things-scene").Component[];
|
|
228
|
+
set selected(_v: import("@hatiolab/things-scene").Component[]): any;
|
|
229
|
+
get focused(): import("@hatiolab/things-scene").Component | null;
|
|
230
|
+
set focused(_v: import("@hatiolab/things-scene").Component | null): any;
|
|
227
231
|
get hasSameParentForAllSelected(): boolean;
|
|
228
232
|
set hasSameParentForAllSelected(_v: boolean): any;
|
|
229
233
|
get fitMode(): string | undefined;
|
|
@@ -280,7 +284,7 @@ declare const GaugeHorizon_base: (new (...args: any[]) => {
|
|
|
280
284
|
get disposed(): boolean;
|
|
281
285
|
isLayer(): boolean;
|
|
282
286
|
isGroup(): boolean;
|
|
283
|
-
isContainer(): this is import("@hatiolab/things-scene
|
|
287
|
+
isContainer(): this is import("@hatiolab/things-scene").Container;
|
|
284
288
|
isLine(): boolean;
|
|
285
289
|
isRoot(): boolean;
|
|
286
290
|
isRootModel(): boolean;
|
|
@@ -296,9 +300,9 @@ declare const GaugeHorizon_base: (new (...args: any[]) => {
|
|
|
296
300
|
get(property: any): any;
|
|
297
301
|
set(props: any, propval?: any): any;
|
|
298
302
|
getState(property: any): any;
|
|
299
|
-
setState(props:
|
|
303
|
+
setState(props: Partial<import("@hatiolab/things-scene").State> | string, propval?: any): any;
|
|
300
304
|
get model(): any;
|
|
301
|
-
get state():
|
|
305
|
+
get state(): import("@hatiolab/things-scene").State;
|
|
302
306
|
get hierarchy(): any;
|
|
303
307
|
get volatile(): never[];
|
|
304
308
|
_applyProps(target: any, props: any, options: any): any;
|
|
@@ -334,7 +338,7 @@ declare const GaugeHorizon_base: (new (...args: any[]) => {
|
|
|
334
338
|
draw(context?: import("@hatiolab/things-scene").SceneRenderContext): void;
|
|
335
339
|
prerender(context: import("@hatiolab/things-scene").SceneRenderContext): void;
|
|
336
340
|
postrender(context: import("@hatiolab/things-scene").SceneRenderContext): void;
|
|
337
|
-
prepare(resolve: (component: Component) => void, reject: (reason: any) => void): void;
|
|
341
|
+
prepare(resolve: (component: import("@hatiolab/things-scene").Component) => void, reject: (reason: any) => void): void;
|
|
338
342
|
prepareIf(condition: boolean): void;
|
|
339
343
|
drawText(context: import("@hatiolab/things-scene").SceneRenderContext): void;
|
|
340
344
|
drawStroke(context: import("@hatiolab/things-scene").SceneRenderContext, override?: Record<string, unknown>): void;
|
|
@@ -385,16 +389,16 @@ declare const GaugeHorizon_base: (new (...args: any[]) => {
|
|
|
385
389
|
get started(): boolean;
|
|
386
390
|
set started(v: boolean): any;
|
|
387
391
|
get controls(): import("@hatiolab/things-scene").Control[] | undefined;
|
|
388
|
-
findFirst(finder: string | ((c: Component) => boolean), ...others: any[]): Component | undefined;
|
|
389
|
-
findAll(s: string | ((c: Component) => boolean), ...others: any[]): any[] | undefined;
|
|
390
|
-
capture(x: number, y: number, except?: (c: Component) => boolean): any;
|
|
392
|
+
findFirst(finder: string | ((c: import("@hatiolab/things-scene").Component) => boolean), ...others: any[]): import("@hatiolab/things-scene").Component | undefined;
|
|
393
|
+
findAll(s: string | ((c: import("@hatiolab/things-scene").Component) => boolean), ...others: any[]): any[] | undefined;
|
|
394
|
+
capture(x: number, y: number, except?: (c: import("@hatiolab/things-scene").Component) => boolean): any;
|
|
391
395
|
findAnchor(name: string): any;
|
|
392
|
-
isDescendible(container: Component): boolean;
|
|
396
|
+
isDescendible(container: import("@hatiolab/things-scene").Component | any): boolean;
|
|
393
397
|
getContext(component?: unknown): any;
|
|
394
|
-
get root(): Component;
|
|
395
|
-
get rootModel(): Component;
|
|
396
|
-
get parent(): Component;
|
|
397
|
-
set parent(v: Component): any;
|
|
398
|
+
get root(): import("@hatiolab/things-scene").Component;
|
|
399
|
+
get rootModel(): import("@hatiolab/things-scene").Component;
|
|
400
|
+
get parent(): import("@hatiolab/things-scene").Component;
|
|
401
|
+
set parent(v: import("@hatiolab/things-scene").Component): any;
|
|
398
402
|
get scalable(): boolean;
|
|
399
403
|
get stuck(): boolean;
|
|
400
404
|
get capturable(): boolean;
|
|
@@ -419,47 +423,51 @@ declare const GaugeHorizon_base: (new (...args: any[]) => {
|
|
|
419
423
|
ondropfile(transfered: FileList, files: string[]): void;
|
|
420
424
|
transcoordS2P(x: number, y: number, rp?: import("@hatiolab/things-scene").POINT): import("@hatiolab/things-scene").POINT;
|
|
421
425
|
transcoordP2S(x: number, y: number, rp?: import("@hatiolab/things-scene").POINT): import("@hatiolab/things-scene").POINT;
|
|
422
|
-
transcoordS2T(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
423
|
-
transcoordT2P(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
424
|
-
transcoordT2S(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
425
|
-
transcoordS2TR(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
426
|
-
transcoordS2O(x: number, y: number, target: Component): import("@hatiolab/things-scene").POINT;
|
|
427
|
-
transcoordC2S(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
428
|
-
transcoordS2C(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
426
|
+
transcoordS2T(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
427
|
+
transcoordT2P(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
428
|
+
transcoordT2S(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
429
|
+
transcoordS2TR(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
430
|
+
transcoordS2O(x: number, y: number, target: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
431
|
+
transcoordC2S(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
432
|
+
transcoordS2C(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
429
433
|
toParent(x: number, y: number, rp?: import("@hatiolab/things-scene").POINT): import("@hatiolab/things-scene").POINT;
|
|
430
434
|
fromParent(x: number, y: number, rp?: import("@hatiolab/things-scene").POINT): import("@hatiolab/things-scene").POINT;
|
|
431
|
-
toScene(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
432
|
-
fromScene(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
433
|
-
toLocal(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
434
|
-
toGlobal(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
435
|
-
toOther(x: number, y: number, target: Component): import("@hatiolab/things-scene").POINT;
|
|
435
|
+
toScene(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
436
|
+
fromScene(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
437
|
+
toLocal(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
438
|
+
toGlobal(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
439
|
+
toOther(x: number, y: number, target: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
440
|
+
on<K extends keyof import("@hatiolab/things-scene").ComponentEventMap>(name: K, callback: (...args: import("@hatiolab/things-scene").ComponentEventMap[K]) => void, context?: any): any;
|
|
436
441
|
on(name: string | object, callback: Function, context?: any): any;
|
|
442
|
+
off<K extends keyof import("@hatiolab/things-scene").ComponentEventMap>(name: K, callback?: ((...args: import("@hatiolab/things-scene").ComponentEventMap[K]) => void) | undefined, context?: any): any;
|
|
437
443
|
off(name?: string | object, callback?: Function, context?: any): any;
|
|
444
|
+
once<K extends keyof import("@hatiolab/things-scene").ComponentEventMap>(name: K, callback: (...args: import("@hatiolab/things-scene").ComponentEventMap[K]) => void, context?: any): any;
|
|
438
445
|
once(name: string | object, callback: Function, context?: any): any;
|
|
446
|
+
trigger<K extends keyof import("@hatiolab/things-scene").ComponentEventMap>(name: K, ...args: import("@hatiolab/things-scene").ComponentEventMap[K]): any;
|
|
439
447
|
trigger(name: string, ...args: any[]): any;
|
|
440
448
|
delegate_on(delegator: any): any;
|
|
441
449
|
delegate_off(delegator: any): any;
|
|
442
450
|
onchange(after: Record<string, any>, before: Record<string, any>): void;
|
|
443
451
|
calculateBounds?(): void;
|
|
444
452
|
oncreate_element?(element: HTMLElement): void;
|
|
445
|
-
removeComponent(component: Component, ghost?: boolean): void;
|
|
446
|
-
addComponent(component: Component, ghost?: boolean): void;
|
|
447
|
-
insertComponentAt(component: Component, index: number, ghost?: boolean): void;
|
|
448
|
-
getOverlay(component: Component): HTMLElement | undefined;
|
|
449
|
-
findById(id: string): Component | undefined;
|
|
450
|
-
findByRefid(ref: string | number): Component | undefined;
|
|
451
|
-
findAllById(id: string): Component[];
|
|
453
|
+
removeComponent(component: import("@hatiolab/things-scene").Component, ghost?: boolean): void;
|
|
454
|
+
addComponent(component: import("@hatiolab/things-scene").Component, ghost?: boolean): void;
|
|
455
|
+
insertComponentAt(component: import("@hatiolab/things-scene").Component, index: number, ghost?: boolean): void;
|
|
456
|
+
getOverlay(component: import("@hatiolab/things-scene").Component): HTMLElement | undefined;
|
|
457
|
+
findById(id: string): import("@hatiolab/things-scene").Component | undefined;
|
|
458
|
+
findByRefid(ref: string | number): import("@hatiolab/things-scene").Component | undefined;
|
|
459
|
+
findAllById(id: string): import("@hatiolab/things-scene").Component[];
|
|
452
460
|
resize(): void;
|
|
453
461
|
fit(type?: string): void;
|
|
454
|
-
get components(): Component[] | undefined;
|
|
462
|
+
get components(): import("@hatiolab/things-scene").Component[] | undefined;
|
|
455
463
|
get layout(): any;
|
|
456
464
|
get auxOverlay(): HTMLElement | undefined;
|
|
457
465
|
get isReady(): boolean;
|
|
458
466
|
get unitScale(): number;
|
|
459
|
-
get selected(): Component[];
|
|
460
|
-
set selected(_v: Component[]): any;
|
|
461
|
-
get focused(): Component | null;
|
|
462
|
-
set focused(_v: Component | null): any;
|
|
467
|
+
get selected(): import("@hatiolab/things-scene").Component[];
|
|
468
|
+
set selected(_v: import("@hatiolab/things-scene").Component[]): any;
|
|
469
|
+
get focused(): import("@hatiolab/things-scene").Component | null;
|
|
470
|
+
set focused(_v: import("@hatiolab/things-scene").Component | null): any;
|
|
463
471
|
get hasSameParentForAllSelected(): boolean;
|
|
464
472
|
set hasSameParentForAllSelected(_v: boolean): any;
|
|
465
473
|
get fitMode(): string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gauge-horizon.js","sourceRoot":"","sources":["../src/gauge-horizon.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,EAA8B,QAAQ,EAAE,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAEjH,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAElD,MAAM,MAAM,GAAoB;IAC9B,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,EAAE,YAAY;SACvB;KACF;IACD,IAAI,EAAE,+BAA+B;CACtC,CAAA;AAGc,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,WAAW,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACpE,MAAM,CAAC,OAAiC;QACtC,IAAI,EACF,UAAU,EACV,QAAQ,EACR,IAAI,EACJ,OAAO,EACP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,GAAG,UAAU,GAAG,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,QAAQ,GAAG,GAAG,CAAC,CAAA;QAE/E,OAAO,CAAC,SAAS,GAAG,eAAe,CAAA;QACnC,OAAO,CAAC,IAAI,EAAE,CAAA;QACd,OAAO,CAAC,SAAS,EAAE,CAAA;QAEnB,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,CAAA;AApKoB,YAAY;IADhC,cAAc,CAAC,eAAe,CAAC;GACX,YAAY,CAoKhC;eApKoB,YAAY","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport { Component, ComponentNature, RectPath, Shape, ValueHolder, sceneComponent } from '@hatiolab/things-scene'\n\nimport { PROPERTIES } from './gauge-properties.js'\n\nconst NATURE: ComponentNature = {\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-horizon'\n}\n\n@sceneComponent('gauge-horizon')\nexport default class GaugeHorizon extends ValueHolder(RectPath(Shape)) {\n render(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.state\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 (\n v: { position: number; color: string },\n idx: number,\n arr: { position: number; color: string }[]\n ) {\n context.beginPath()\n\n let value = Math.max(Math.min(v.position - startValue, totalValue), 0) // v.position 범위의 최소값은 0, 최대값은 totalValue가 되야함.\n let startStepPosition = (width * beforeValue) / totalValue\n let endStepPosition\n // console.log(startStepPosition + (width * value / totalValue));\n if (idx == arr.length - 1 || startStepPosition + (width * value) / totalValue)\n // 배열의 마지막 값이거나 중간 시작값 + 그려지는 값이 width 를 넘을 경우는 무조건 끝까지 채워주도록 한다\n endStepPosition = width - startStepPosition\n else endStepPosition = (width * value) / totalValue\n\n if (beforeValue > totalValue || beforeValue > value)\n // 값이 게이지의 최대 값을 넘어가거나 이전 값 보다 현재값이 작으면 다시 그릴 필요 없음\n return false\n\n context.rect(startStepPosition, 0, endStepPosition, height)\n\n context.fillStyle = v.color\n context.fill()\n\n beforeValue = value\n })\n }\n\n //// 스텝 선 그리기 ////\n context.fillStyle = stepFillStyle\n if (showStepLine) {\n let count = totalValue / step\n let stepSize = width * 0.06\n\n // Draw StartValue\n context.fillRect(0, height - stepSize, stepNeedleSize, stepSize)\n // Draw StepValue\n for (let num = 1; num < count; num++) {\n let locate = (width / count) * num\n\n context.fillRect(locate, height - stepSize, stepNeedleSize, stepSize)\n }\n // Draw EndValue\n context.fillRect(width, height - stepSize, stepNeedleSize, stepSize)\n }\n\n //// 서브 스탭 그리기 ////\n if (showSubStep) {\n let count = totalValue\n let subStepSize = width * 0.027\n // Draw StartValue\n context.fillRect(0, height - subStepSize, stepNeedleSize, subStepSize)\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 = (width / count) * num\n context.fillRect(locate, height - subStepSize, stepNeedleSize, subStepSize)\n }\n }\n\n //// 스텝 텍스트 그리기 ////\n let fontSize = (width * 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, 0, height + fontSize * 0.75)\n }\n\n if (showEndValue) {\n // Draw EndText\n context.fillText(endValue, width, height + fontSize * 0.75)\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 + step * num\n let locate = (width / count) * num\n\n context.fillText(value, locate, height + fontSize * 0.75)\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 = ((drawingValue - startValue) / totalValue) * width\n\n needleSize *= 4\n context.moveTo(position, height + fontSize * 1.4)\n context.lineTo(position + needleSize / 2, height + needleSize + fontSize * 1.4)\n context.lineTo(position - needleSize / 2, height + needleSize + fontSize * 1.4)\n\n context.fillStyle = needleFillStyle\n context.fill()\n context.closePath()\n\n context.translate(-left, -top)\n }\n\n postrender(context: CanvasRenderingContext2D) {\n this.drawText(context)\n }\n\n get nature() {\n return NATURE\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"gauge-horizon.js","sourceRoot":"","sources":["../src/gauge-horizon.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,EAAmB,QAAQ,EAAE,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,wBAAwB,CA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eAnKoB,YAAY","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport { ComponentNature, RectPath, Shape, ValueHolder, sceneComponent } from '@hatiolab/things-scene'\n\nimport { PROPERTIES } from './gauge-properties.js'\n\nconst NATURE: ComponentNature = {\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-horizon'\n}\n\n@sceneComponent('gauge-horizon')\nexport default class GaugeHorizon extends ValueHolder(RectPath(Shape)) {\n render(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.state\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 (\n v: { position: number; color: string },\n idx: number,\n arr: { position: number; color: string }[]\n ) {\n context.beginPath()\n\n let value = Math.max(Math.min(v.position - startValue, totalValue), 0) // v.position 범위의 최소값은 0, 최대값은 totalValue가 되야함.\n let startStepPosition = (width * beforeValue) / totalValue\n let endStepPosition\n // console.log(startStepPosition + (width * value / totalValue));\n if (idx == arr.length - 1 || startStepPosition + (width * value) / totalValue)\n // 배열의 마지막 값이거나 중간 시작값 + 그려지는 값이 width 를 넘을 경우는 무조건 끝까지 채워주도록 한다\n endStepPosition = width - startStepPosition\n else endStepPosition = (width * value) / totalValue\n\n if (beforeValue > totalValue || beforeValue > value)\n // 값이 게이지의 최대 값을 넘어가거나 이전 값 보다 현재값이 작으면 다시 그릴 필요 없음\n return false\n\n context.rect(startStepPosition, 0, endStepPosition, height)\n\n context.fillStyle = v.color\n context.fill()\n\n beforeValue = value\n })\n }\n\n //// 스텝 선 그리기 ////\n context.fillStyle = stepFillStyle\n if (showStepLine) {\n let count = totalValue / step\n let stepSize = width * 0.06\n\n // Draw StartValue\n context.fillRect(0, height - stepSize, stepNeedleSize, stepSize)\n // Draw StepValue\n for (let num = 1; num < count; num++) {\n let locate = (width / count) * num\n\n context.fillRect(locate, height - stepSize, stepNeedleSize, stepSize)\n }\n // Draw EndValue\n context.fillRect(width, height - stepSize, stepNeedleSize, stepSize)\n }\n\n //// 서브 스탭 그리기 ////\n if (showSubStep) {\n let count = totalValue\n let subStepSize = width * 0.027\n // Draw StartValue\n context.fillRect(0, height - subStepSize, stepNeedleSize, subStepSize)\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 = (width / count) * num\n context.fillRect(locate, height - subStepSize, stepNeedleSize, subStepSize)\n }\n }\n\n //// 스텝 텍스트 그리기 ////\n let fontSize = (width * 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, 0, height + fontSize * 0.75)\n }\n\n if (showEndValue) {\n // Draw EndText\n context.fillText(endValue, width, height + fontSize * 0.75)\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 + step * num\n let locate = (width / count) * num\n\n context.fillText(value, locate, height + fontSize * 0.75)\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 = ((drawingValue - startValue) / totalValue) * width\n\n needleSize *= 4\n context.moveTo(position, height + fontSize * 1.4)\n context.lineTo(position + needleSize / 2, height + needleSize + fontSize * 1.4)\n context.lineTo(position - needleSize / 2, height + needleSize + fontSize * 1.4)\n\n context.fillStyle = needleFillStyle\n context.fill()\n context.closePath()\n\n context.translate(-left, -top)\n }\n\n postrender(context: CanvasRenderingContext2D) {\n this.drawText(context)\n }\n get nature() {\n return NATURE\n }\n}\n"]}
|
package/dist/gauge-vertical.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ComponentNature, Shape } from '@hatiolab/things-scene';
|
|
2
2
|
declare const GaugeVertical_base: (new (...args: any[]) => {
|
|
3
3
|
_lastValue: number;
|
|
4
4
|
_anim_alpha: number;
|
|
@@ -40,7 +40,7 @@ declare const GaugeVertical_base: (new (...args: any[]) => {
|
|
|
40
40
|
get disposed(): boolean;
|
|
41
41
|
isLayer(): boolean;
|
|
42
42
|
isGroup(): boolean;
|
|
43
|
-
isContainer(): this is import("@hatiolab/things-scene
|
|
43
|
+
isContainer(): this is import("@hatiolab/things-scene").Container;
|
|
44
44
|
isLine(): boolean;
|
|
45
45
|
isRoot(): boolean;
|
|
46
46
|
isRootModel(): boolean;
|
|
@@ -56,9 +56,9 @@ declare const GaugeVertical_base: (new (...args: any[]) => {
|
|
|
56
56
|
get(property: any): any;
|
|
57
57
|
set(props: any, propval?: any): any;
|
|
58
58
|
getState(property: any): any;
|
|
59
|
-
setState(props:
|
|
59
|
+
setState(props: Partial<import("@hatiolab/things-scene").State> | string, propval?: any): any;
|
|
60
60
|
get model(): any;
|
|
61
|
-
get state():
|
|
61
|
+
get state(): import("@hatiolab/things-scene").State;
|
|
62
62
|
get hierarchy(): any;
|
|
63
63
|
get volatile(): never[];
|
|
64
64
|
_applyProps(target: any, props: any, options: any): any;
|
|
@@ -100,7 +100,7 @@ declare const GaugeVertical_base: (new (...args: any[]) => {
|
|
|
100
100
|
prerender(context: import("@hatiolab/things-scene").SceneRenderContext): void;
|
|
101
101
|
render(context: import("@hatiolab/things-scene").SceneRenderContext): void;
|
|
102
102
|
postrender(context: import("@hatiolab/things-scene").SceneRenderContext): void;
|
|
103
|
-
prepare(resolve: (component: Component) => void, reject: (reason: any) => void): void;
|
|
103
|
+
prepare(resolve: (component: import("@hatiolab/things-scene").Component) => void, reject: (reason: any) => void): void;
|
|
104
104
|
prepareIf(condition: boolean): void;
|
|
105
105
|
drawText(context: import("@hatiolab/things-scene").SceneRenderContext): void;
|
|
106
106
|
drawStroke(context: import("@hatiolab/things-scene").SceneRenderContext, override?: Record<string, unknown>): void;
|
|
@@ -149,16 +149,16 @@ declare const GaugeVertical_base: (new (...args: any[]) => {
|
|
|
149
149
|
get started(): boolean;
|
|
150
150
|
set started(v: boolean): any;
|
|
151
151
|
get controls(): import("@hatiolab/things-scene").Control[] | undefined;
|
|
152
|
-
findFirst(finder: string | ((c: Component) => boolean), ...others: any[]): Component | undefined;
|
|
153
|
-
findAll(s: string | ((c: Component) => boolean), ...others: any[]): any[] | undefined;
|
|
154
|
-
capture(x: number, y: number, except?: (c: Component) => boolean): any;
|
|
152
|
+
findFirst(finder: string | ((c: import("@hatiolab/things-scene").Component) => boolean), ...others: any[]): import("@hatiolab/things-scene").Component | undefined;
|
|
153
|
+
findAll(s: string | ((c: import("@hatiolab/things-scene").Component) => boolean), ...others: any[]): any[] | undefined;
|
|
154
|
+
capture(x: number, y: number, except?: (c: import("@hatiolab/things-scene").Component) => boolean): any;
|
|
155
155
|
findAnchor(name: string): any;
|
|
156
|
-
isDescendible(container: Component): boolean;
|
|
156
|
+
isDescendible(container: import("@hatiolab/things-scene").Component | any): boolean;
|
|
157
157
|
getContext(component?: unknown): any;
|
|
158
|
-
get root(): Component;
|
|
159
|
-
get rootModel(): Component;
|
|
160
|
-
get parent(): Component;
|
|
161
|
-
set parent(v: Component): any;
|
|
158
|
+
get root(): import("@hatiolab/things-scene").Component;
|
|
159
|
+
get rootModel(): import("@hatiolab/things-scene").Component;
|
|
160
|
+
get parent(): import("@hatiolab/things-scene").Component;
|
|
161
|
+
set parent(v: import("@hatiolab/things-scene").Component): any;
|
|
162
162
|
get anchors(): import("@hatiolab/things-scene").Anchor[];
|
|
163
163
|
get scalable(): boolean;
|
|
164
164
|
get stuck(): boolean;
|
|
@@ -184,46 +184,50 @@ declare const GaugeVertical_base: (new (...args: any[]) => {
|
|
|
184
184
|
ondropfile(transfered: FileList, files: string[]): void;
|
|
185
185
|
transcoordS2P(x: number, y: number, rp?: import("@hatiolab/things-scene").POINT): import("@hatiolab/things-scene").POINT;
|
|
186
186
|
transcoordP2S(x: number, y: number, rp?: import("@hatiolab/things-scene").POINT): import("@hatiolab/things-scene").POINT;
|
|
187
|
-
transcoordS2T(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
188
|
-
transcoordT2P(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
189
|
-
transcoordT2S(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
190
|
-
transcoordS2TR(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
191
|
-
transcoordS2O(x: number, y: number, target: Component): import("@hatiolab/things-scene").POINT;
|
|
192
|
-
transcoordC2S(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
193
|
-
transcoordS2C(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
187
|
+
transcoordS2T(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
188
|
+
transcoordT2P(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
189
|
+
transcoordT2S(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
190
|
+
transcoordS2TR(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
191
|
+
transcoordS2O(x: number, y: number, target: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
192
|
+
transcoordC2S(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
193
|
+
transcoordS2C(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
194
194
|
toParent(x: number, y: number, rp?: import("@hatiolab/things-scene").POINT): import("@hatiolab/things-scene").POINT;
|
|
195
195
|
fromParent(x: number, y: number, rp?: import("@hatiolab/things-scene").POINT): import("@hatiolab/things-scene").POINT;
|
|
196
|
-
toScene(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
197
|
-
fromScene(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
198
|
-
toLocal(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
199
|
-
toGlobal(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
200
|
-
toOther(x: number, y: number, target: Component): import("@hatiolab/things-scene").POINT;
|
|
196
|
+
toScene(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
197
|
+
fromScene(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
198
|
+
toLocal(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
199
|
+
toGlobal(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
200
|
+
toOther(x: number, y: number, target: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
201
|
+
on<K extends keyof import("@hatiolab/things-scene").ComponentEventMap>(name: K, callback: (...args: import("@hatiolab/things-scene").ComponentEventMap[K]) => void, context?: any): any;
|
|
201
202
|
on(name: string | object, callback: Function, context?: any): any;
|
|
203
|
+
off<K extends keyof import("@hatiolab/things-scene").ComponentEventMap>(name: K, callback?: ((...args: import("@hatiolab/things-scene").ComponentEventMap[K]) => void) | undefined, context?: any): any;
|
|
202
204
|
off(name?: string | object, callback?: Function, context?: any): any;
|
|
205
|
+
once<K extends keyof import("@hatiolab/things-scene").ComponentEventMap>(name: K, callback: (...args: import("@hatiolab/things-scene").ComponentEventMap[K]) => void, context?: any): any;
|
|
203
206
|
once(name: string | object, callback: Function, context?: any): any;
|
|
207
|
+
trigger<K extends keyof import("@hatiolab/things-scene").ComponentEventMap>(name: K, ...args: import("@hatiolab/things-scene").ComponentEventMap[K]): any;
|
|
204
208
|
trigger(name: string, ...args: any[]): any;
|
|
205
209
|
delegate_on(delegator: any): any;
|
|
206
210
|
delegate_off(delegator: any): any;
|
|
207
211
|
calculateBounds?(): void;
|
|
208
212
|
oncreate_element?(element: HTMLElement): void;
|
|
209
|
-
removeComponent(component: Component, ghost?: boolean): void;
|
|
210
|
-
addComponent(component: Component, ghost?: boolean): void;
|
|
211
|
-
insertComponentAt(component: Component, index: number, ghost?: boolean): void;
|
|
212
|
-
getOverlay(component: Component): HTMLElement | undefined;
|
|
213
|
-
findById(id: string): Component | undefined;
|
|
214
|
-
findByRefid(ref: string | number): Component | undefined;
|
|
215
|
-
findAllById(id: string): Component[];
|
|
213
|
+
removeComponent(component: import("@hatiolab/things-scene").Component, ghost?: boolean): void;
|
|
214
|
+
addComponent(component: import("@hatiolab/things-scene").Component, ghost?: boolean): void;
|
|
215
|
+
insertComponentAt(component: import("@hatiolab/things-scene").Component, index: number, ghost?: boolean): void;
|
|
216
|
+
getOverlay(component: import("@hatiolab/things-scene").Component): HTMLElement | undefined;
|
|
217
|
+
findById(id: string): import("@hatiolab/things-scene").Component | undefined;
|
|
218
|
+
findByRefid(ref: string | number): import("@hatiolab/things-scene").Component | undefined;
|
|
219
|
+
findAllById(id: string): import("@hatiolab/things-scene").Component[];
|
|
216
220
|
resize(): void;
|
|
217
221
|
fit(type?: string): void;
|
|
218
|
-
get components(): Component[] | undefined;
|
|
222
|
+
get components(): import("@hatiolab/things-scene").Component[] | undefined;
|
|
219
223
|
get layout(): any;
|
|
220
224
|
get auxOverlay(): HTMLElement | undefined;
|
|
221
225
|
get isReady(): boolean;
|
|
222
226
|
get unitScale(): number;
|
|
223
|
-
get selected(): Component[];
|
|
224
|
-
set selected(_v: Component[]): any;
|
|
225
|
-
get focused(): Component | null;
|
|
226
|
-
set focused(_v: Component | null): any;
|
|
227
|
+
get selected(): import("@hatiolab/things-scene").Component[];
|
|
228
|
+
set selected(_v: import("@hatiolab/things-scene").Component[]): any;
|
|
229
|
+
get focused(): import("@hatiolab/things-scene").Component | null;
|
|
230
|
+
set focused(_v: import("@hatiolab/things-scene").Component | null): any;
|
|
227
231
|
get hasSameParentForAllSelected(): boolean;
|
|
228
232
|
set hasSameParentForAllSelected(_v: boolean): any;
|
|
229
233
|
get fitMode(): string | undefined;
|
|
@@ -280,7 +284,7 @@ declare const GaugeVertical_base: (new (...args: any[]) => {
|
|
|
280
284
|
get disposed(): boolean;
|
|
281
285
|
isLayer(): boolean;
|
|
282
286
|
isGroup(): boolean;
|
|
283
|
-
isContainer(): this is import("@hatiolab/things-scene
|
|
287
|
+
isContainer(): this is import("@hatiolab/things-scene").Container;
|
|
284
288
|
isLine(): boolean;
|
|
285
289
|
isRoot(): boolean;
|
|
286
290
|
isRootModel(): boolean;
|
|
@@ -296,9 +300,9 @@ declare const GaugeVertical_base: (new (...args: any[]) => {
|
|
|
296
300
|
get(property: any): any;
|
|
297
301
|
set(props: any, propval?: any): any;
|
|
298
302
|
getState(property: any): any;
|
|
299
|
-
setState(props:
|
|
303
|
+
setState(props: Partial<import("@hatiolab/things-scene").State> | string, propval?: any): any;
|
|
300
304
|
get model(): any;
|
|
301
|
-
get state():
|
|
305
|
+
get state(): import("@hatiolab/things-scene").State;
|
|
302
306
|
get hierarchy(): any;
|
|
303
307
|
get volatile(): never[];
|
|
304
308
|
_applyProps(target: any, props: any, options: any): any;
|
|
@@ -334,7 +338,7 @@ declare const GaugeVertical_base: (new (...args: any[]) => {
|
|
|
334
338
|
draw(context?: import("@hatiolab/things-scene").SceneRenderContext): void;
|
|
335
339
|
prerender(context: import("@hatiolab/things-scene").SceneRenderContext): void;
|
|
336
340
|
postrender(context: import("@hatiolab/things-scene").SceneRenderContext): void;
|
|
337
|
-
prepare(resolve: (component: Component) => void, reject: (reason: any) => void): void;
|
|
341
|
+
prepare(resolve: (component: import("@hatiolab/things-scene").Component) => void, reject: (reason: any) => void): void;
|
|
338
342
|
prepareIf(condition: boolean): void;
|
|
339
343
|
drawText(context: import("@hatiolab/things-scene").SceneRenderContext): void;
|
|
340
344
|
drawStroke(context: import("@hatiolab/things-scene").SceneRenderContext, override?: Record<string, unknown>): void;
|
|
@@ -385,16 +389,16 @@ declare const GaugeVertical_base: (new (...args: any[]) => {
|
|
|
385
389
|
get started(): boolean;
|
|
386
390
|
set started(v: boolean): any;
|
|
387
391
|
get controls(): import("@hatiolab/things-scene").Control[] | undefined;
|
|
388
|
-
findFirst(finder: string | ((c: Component) => boolean), ...others: any[]): Component | undefined;
|
|
389
|
-
findAll(s: string | ((c: Component) => boolean), ...others: any[]): any[] | undefined;
|
|
390
|
-
capture(x: number, y: number, except?: (c: Component) => boolean): any;
|
|
392
|
+
findFirst(finder: string | ((c: import("@hatiolab/things-scene").Component) => boolean), ...others: any[]): import("@hatiolab/things-scene").Component | undefined;
|
|
393
|
+
findAll(s: string | ((c: import("@hatiolab/things-scene").Component) => boolean), ...others: any[]): any[] | undefined;
|
|
394
|
+
capture(x: number, y: number, except?: (c: import("@hatiolab/things-scene").Component) => boolean): any;
|
|
391
395
|
findAnchor(name: string): any;
|
|
392
|
-
isDescendible(container: Component): boolean;
|
|
396
|
+
isDescendible(container: import("@hatiolab/things-scene").Component | any): boolean;
|
|
393
397
|
getContext(component?: unknown): any;
|
|
394
|
-
get root(): Component;
|
|
395
|
-
get rootModel(): Component;
|
|
396
|
-
get parent(): Component;
|
|
397
|
-
set parent(v: Component): any;
|
|
398
|
+
get root(): import("@hatiolab/things-scene").Component;
|
|
399
|
+
get rootModel(): import("@hatiolab/things-scene").Component;
|
|
400
|
+
get parent(): import("@hatiolab/things-scene").Component;
|
|
401
|
+
set parent(v: import("@hatiolab/things-scene").Component): any;
|
|
398
402
|
get scalable(): boolean;
|
|
399
403
|
get stuck(): boolean;
|
|
400
404
|
get capturable(): boolean;
|
|
@@ -419,47 +423,51 @@ declare const GaugeVertical_base: (new (...args: any[]) => {
|
|
|
419
423
|
ondropfile(transfered: FileList, files: string[]): void;
|
|
420
424
|
transcoordS2P(x: number, y: number, rp?: import("@hatiolab/things-scene").POINT): import("@hatiolab/things-scene").POINT;
|
|
421
425
|
transcoordP2S(x: number, y: number, rp?: import("@hatiolab/things-scene").POINT): import("@hatiolab/things-scene").POINT;
|
|
422
|
-
transcoordS2T(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
423
|
-
transcoordT2P(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
424
|
-
transcoordT2S(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
425
|
-
transcoordS2TR(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
426
|
-
transcoordS2O(x: number, y: number, target: Component): import("@hatiolab/things-scene").POINT;
|
|
427
|
-
transcoordC2S(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
428
|
-
transcoordS2C(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
426
|
+
transcoordS2T(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
427
|
+
transcoordT2P(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
428
|
+
transcoordT2S(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
429
|
+
transcoordS2TR(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
430
|
+
transcoordS2O(x: number, y: number, target: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
431
|
+
transcoordC2S(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
432
|
+
transcoordS2C(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
429
433
|
toParent(x: number, y: number, rp?: import("@hatiolab/things-scene").POINT): import("@hatiolab/things-scene").POINT;
|
|
430
434
|
fromParent(x: number, y: number, rp?: import("@hatiolab/things-scene").POINT): import("@hatiolab/things-scene").POINT;
|
|
431
|
-
toScene(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
432
|
-
fromScene(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
433
|
-
toLocal(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
434
|
-
toGlobal(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
435
|
-
toOther(x: number, y: number, target: Component): import("@hatiolab/things-scene").POINT;
|
|
435
|
+
toScene(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
436
|
+
fromScene(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
437
|
+
toLocal(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
438
|
+
toGlobal(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
439
|
+
toOther(x: number, y: number, target: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
440
|
+
on<K extends keyof import("@hatiolab/things-scene").ComponentEventMap>(name: K, callback: (...args: import("@hatiolab/things-scene").ComponentEventMap[K]) => void, context?: any): any;
|
|
436
441
|
on(name: string | object, callback: Function, context?: any): any;
|
|
442
|
+
off<K extends keyof import("@hatiolab/things-scene").ComponentEventMap>(name: K, callback?: ((...args: import("@hatiolab/things-scene").ComponentEventMap[K]) => void) | undefined, context?: any): any;
|
|
437
443
|
off(name?: string | object, callback?: Function, context?: any): any;
|
|
444
|
+
once<K extends keyof import("@hatiolab/things-scene").ComponentEventMap>(name: K, callback: (...args: import("@hatiolab/things-scene").ComponentEventMap[K]) => void, context?: any): any;
|
|
438
445
|
once(name: string | object, callback: Function, context?: any): any;
|
|
446
|
+
trigger<K extends keyof import("@hatiolab/things-scene").ComponentEventMap>(name: K, ...args: import("@hatiolab/things-scene").ComponentEventMap[K]): any;
|
|
439
447
|
trigger(name: string, ...args: any[]): any;
|
|
440
448
|
delegate_on(delegator: any): any;
|
|
441
449
|
delegate_off(delegator: any): any;
|
|
442
450
|
onchange(after: Record<string, any>, before: Record<string, any>): void;
|
|
443
451
|
calculateBounds?(): void;
|
|
444
452
|
oncreate_element?(element: HTMLElement): void;
|
|
445
|
-
removeComponent(component: Component, ghost?: boolean): void;
|
|
446
|
-
addComponent(component: Component, ghost?: boolean): void;
|
|
447
|
-
insertComponentAt(component: Component, index: number, ghost?: boolean): void;
|
|
448
|
-
getOverlay(component: Component): HTMLElement | undefined;
|
|
449
|
-
findById(id: string): Component | undefined;
|
|
450
|
-
findByRefid(ref: string | number): Component | undefined;
|
|
451
|
-
findAllById(id: string): Component[];
|
|
453
|
+
removeComponent(component: import("@hatiolab/things-scene").Component, ghost?: boolean): void;
|
|
454
|
+
addComponent(component: import("@hatiolab/things-scene").Component, ghost?: boolean): void;
|
|
455
|
+
insertComponentAt(component: import("@hatiolab/things-scene").Component, index: number, ghost?: boolean): void;
|
|
456
|
+
getOverlay(component: import("@hatiolab/things-scene").Component): HTMLElement | undefined;
|
|
457
|
+
findById(id: string): import("@hatiolab/things-scene").Component | undefined;
|
|
458
|
+
findByRefid(ref: string | number): import("@hatiolab/things-scene").Component | undefined;
|
|
459
|
+
findAllById(id: string): import("@hatiolab/things-scene").Component[];
|
|
452
460
|
resize(): void;
|
|
453
461
|
fit(type?: string): void;
|
|
454
|
-
get components(): Component[] | undefined;
|
|
462
|
+
get components(): import("@hatiolab/things-scene").Component[] | undefined;
|
|
455
463
|
get layout(): any;
|
|
456
464
|
get auxOverlay(): HTMLElement | undefined;
|
|
457
465
|
get isReady(): boolean;
|
|
458
466
|
get unitScale(): number;
|
|
459
|
-
get selected(): Component[];
|
|
460
|
-
set selected(_v: Component[]): any;
|
|
461
|
-
get focused(): Component | null;
|
|
462
|
-
set focused(_v: Component | null): any;
|
|
467
|
+
get selected(): import("@hatiolab/things-scene").Component[];
|
|
468
|
+
set selected(_v: import("@hatiolab/things-scene").Component[]): any;
|
|
469
|
+
get focused(): import("@hatiolab/things-scene").Component | null;
|
|
470
|
+
set focused(_v: import("@hatiolab/things-scene").Component | null): any;
|
|
463
471
|
get hasSameParentForAllSelected(): boolean;
|
|
464
472
|
set hasSameParentForAllSelected(_v: boolean): any;
|
|
465
473
|
get fitMode(): string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gauge-vertical.js","sourceRoot":"","sources":["../src/gauge-vertical.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,EAA8B,QAAQ,EAAE,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAEjH,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAElD,MAAM,MAAM,GAAoB;IAC9B,OAAO,EAAE,KAAK;IACd,SAAS,EAAE,IAAI;IACf,SAAS,EAAE,IAAI;IACf,UAAU,EAAE;QACV,GAAG,UAAU;QACb;YACE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AAM,CAAC,CAAA;QACjD,CAAC;QAED,IAAI,YAAY,EAAE,CAAC;YACjB,eAAe;YACf,OAAO,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAA;QAC1C,CAAC;QAED,IAAI,YAAY,EAAE,CAAC;YACjB,gBAAgB;YAChB,IAAI,KAAK,GAAG,UAAU,GAAG,IAAI,CAAA;YAE7B,KAAK,IAAI,GAAG,GAAG,CAAC,EAAE,GAAG,GAAG,KAAK,EAAE,GAAG,EAAE,EAAE,CAAC;gBACrC,IAAI,KAAK,GAAG,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,GAAG,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;YAC5C,CAAC;QACH,CAAC;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,CAAA;AAnKoB,aAAa;IADjC,cAAc,CAAC,gBAAgB,CAAC;GACZ,aAAa,CAmKjC;eAnKoB,aAAa","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport { Component, ComponentNature, RectPath, Shape, ValueHolder, sceneComponent } from '@hatiolab/things-scene'\n\nimport { PROPERTIES } from './gauge-properties.js'\n\nconst NATURE: ComponentNature = {\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\n@sceneComponent('gauge-vertical')\nexport default class GaugeVertical extends ValueHolder(RectPath(Shape)) {\n render(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.state\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 (\n v: { position: number; color: string },\n idx: number,\n arr: { position: number; color: string }[]\n ) {\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 postrender(context: CanvasRenderingContext2D) {\n this.drawText(context)\n }\n\n get nature() {\n return NATURE\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"gauge-vertical.js","sourceRoot":"","sources":["../src/gauge-vertical.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,EAAmB,QAAQ,EAAE,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAEtG,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAElD,MAAM,MAAM,GAAoB;IAC9B,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,EAAE,YAAY;SACvB;KACF;IACD,IAAI,EAAE,gCAAgC;CACvC,CAAA;AAGc,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,WAAW,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACrE,MAAM,CAAC,OAAiC;QACtC,IAAI,EACF,UAAU,EACV,QAAQ,EACR,IAAI,EACJ,OAAO,EACP,UAAU,EACV,eAAe,EACf,aAAa,EACb,aAAa,EACb,UAAU,EACV,cAAc,EACd,YAAY,EACZ,YAAY,GAAG,IAAI,EACnB,cAAc,GAAG,IAAI,EACrB,YAAY,GAAG,IAAI,EACnB,YA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ChC,CAAC;IAED,UAAU,CAAC,OAAiC;QAC1C,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;IACxB,CAAC;IACD,IAAI,MAAM;QACR,OAAO,MAAM,CAAA;IACf,CAAC;CACF,CAAA;AAlKoB,aAAa;IADjC,cAAc,CAAC,gBAAgB,CAAC;GACZ,aAAa,CAkKjC;eAlKoB,aAAa","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport { ComponentNature, RectPath, Shape, ValueHolder, sceneComponent } from '@hatiolab/things-scene'\n\nimport { PROPERTIES } from './gauge-properties.js'\n\nconst NATURE: ComponentNature = {\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\n@sceneComponent('gauge-vertical')\nexport default class GaugeVertical extends ValueHolder(RectPath(Shape)) {\n render(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.state\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 (\n v: { position: number; color: string },\n idx: number,\n arr: { position: number; color: string }[]\n ) {\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 postrender(context: CanvasRenderingContext2D) {\n this.drawText(context)\n }\n get nature() {\n return NATURE\n }\n}\n"]}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* Copyright © HatioLab Inc. All rights reserved.
|
|
3
3
|
*/
|
|
4
|
+
/*
|
|
5
|
+
* Copyright © HatioLab Inc. All rights reserved.
|
|
6
|
+
*/
|
|
7
|
+
import './factories/index.js';
|
|
4
8
|
export { default as GaugeCircle } from './gauge-circle.js';
|
|
5
9
|
export { default as GaugeVertical } from './gauge-vertical.js';
|
|
6
10
|
export { default as GaugeHorizon } from './gauge-horizon.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC1D,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAC9D,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,oBAAoB,CAAA","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\nexport { default as GaugeCircle } from './gauge-circle.js'\nexport { default as GaugeVertical } from './gauge-vertical.js'\nexport { default as GaugeHorizon } from './gauge-horizon.js'\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;GAEG;AACH,OAAO,sBAAsB,CAAA;AAE7B,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC1D,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAC9D,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,oBAAoB,CAAA","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\n/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\nimport './factories/index.js'\n\nexport { default as GaugeCircle } from './gauge-circle.js'\nexport { default as GaugeVertical } from './gauge-vertical.js'\nexport { default as GaugeHorizon } from './gauge-horizon.js'\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@operato/scene-gauge",
|
|
3
|
-
"version": "10.0.0-beta.
|
|
3
|
+
"version": "10.0.0-beta.31",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Things Scene Gauge Component",
|
|
6
6
|
"author": "heartyoh",
|
|
@@ -58,5 +58,5 @@
|
|
|
58
58
|
"prettier --write"
|
|
59
59
|
]
|
|
60
60
|
},
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "fdafbd04fd083a43690be937230c7d96a3ee5da3"
|
|
62
62
|
}
|