@operato/scene-legend 10.0.0-beta.7 → 10.0.1
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 +23 -19
- package/dist/legend-item.d.ts +53 -46
- package/dist/legend-item.js.map +1 -1
- package/dist/legend.d.ts +1 -8
- package/dist/legend.js.map +1 -1
- package/dist/templates/legend.js +1 -1
- package/dist/templates/legend.js.map +1 -1
- package/dist/templates/svg.js +1 -1
- package/dist/templates/svg.js.map +1 -1
- package/package.json +6 -10
package/README.md
CHANGED
|
@@ -1,31 +1,35 @@
|
|
|
1
|
-
|
|
1
|
+
# @operato/scene-legend
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> Legend component for things-scene.
|
|
4
4
|
|
|
5
|
-
-
|
|
6
|
-
- 범례 : 컬러 또는 이미지, 레이블
|
|
5
|
+
<!-- AUTOGEN_BEGIN: do not edit between markers (run scripts/regenerate-readmes.mjs to update) -->
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
## Components
|
|
9
8
|
|
|
10
|
-
-
|
|
9
|
+
- `Legend`
|
|
10
|
+
- `LegendItem`
|
|
11
|
+
- `Svg`
|
|
11
12
|
|
|
12
|
-
|
|
13
|
+
## Install
|
|
13
14
|
|
|
14
|
-
|
|
15
|
-
-
|
|
15
|
+
```bash
|
|
16
|
+
yarn add @operato/scene-legend
|
|
17
|
+
```
|
|
16
18
|
|
|
17
|
-
|
|
19
|
+
## Usage
|
|
18
20
|
|
|
19
|
-
|
|
21
|
+
```ts
|
|
22
|
+
import { Legend, LegendItem, Svg } from '@operato/scene-legend'
|
|
23
|
+
```
|
|
20
24
|
|
|
21
|
-
|
|
25
|
+
## Build
|
|
22
26
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
| UMD | things-scene-legend-ie.js | ie 11 | O |
|
|
27
|
-
| ESM | things-scene-legend.mjs | modern browser | O |
|
|
27
|
+
```bash
|
|
28
|
+
yarn build
|
|
29
|
+
```
|
|
28
30
|
|
|
29
|
-
|
|
31
|
+
Output: ESM module at `dist/index.js` (single bundle, no UMD/IE legacy).
|
|
30
32
|
|
|
31
|
-
|
|
33
|
+
_Version: 10.0.0-beta.7_
|
|
34
|
+
|
|
35
|
+
<!-- AUTOGEN_END -->
|
package/dist/legend-item.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ComponentNature, Properties, Shape } from '@hatiolab/things-scene';
|
|
2
2
|
declare const LegendItem_base: (new (...args: any[]) => {
|
|
3
3
|
contains(x: number, y: number): boolean;
|
|
4
4
|
get path(): {
|
|
@@ -37,19 +37,21 @@ declare const LegendItem_base: (new (...args: any[]) => {
|
|
|
37
37
|
fontSize: any;
|
|
38
38
|
__cache__: any;
|
|
39
39
|
created(): void;
|
|
40
|
-
added(parent:
|
|
41
|
-
removed(parent:
|
|
40
|
+
added(parent: import("@hatiolab/things-scene/dist-types/types/component.js").Container): void;
|
|
41
|
+
removed(parent: import("@hatiolab/things-scene/dist-types/types/component.js").Container): void;
|
|
42
42
|
ready(): Promise<void>;
|
|
43
|
+
_readyInvoked: boolean;
|
|
44
|
+
invokeReady(): void | Promise<void>;
|
|
43
45
|
touch(): void;
|
|
44
|
-
clearCache(...attrs:
|
|
45
|
-
removeSelf(completely
|
|
46
|
+
clearCache(...attrs: string[]): void;
|
|
47
|
+
removeSelf(completely?: boolean): void;
|
|
46
48
|
resetAnimation(): void;
|
|
47
49
|
dispose(): void;
|
|
48
50
|
get nature(): import("@hatiolab/things-scene").ComponentNature;
|
|
49
51
|
get disposed(): boolean;
|
|
50
52
|
isLayer(): boolean;
|
|
51
53
|
isGroup(): boolean;
|
|
52
|
-
isContainer(): this is import("@hatiolab/things-scene/dist-types/types/component").Container;
|
|
54
|
+
isContainer(): this is import("@hatiolab/things-scene/dist-types/types/component.js").Container;
|
|
53
55
|
isLine(): boolean;
|
|
54
56
|
isRoot(): boolean;
|
|
55
57
|
isRootModel(): boolean;
|
|
@@ -61,16 +63,17 @@ declare const LegendItem_base: (new (...args: any[]) => {
|
|
|
61
63
|
isConnectable(): boolean;
|
|
62
64
|
isIdentifiable(): boolean;
|
|
63
65
|
isPositionable(): boolean;
|
|
64
|
-
replaceRefids(replaceMap:
|
|
65
|
-
get(property:
|
|
66
|
+
replaceRefids(replaceMap: Record<string, string>): void;
|
|
67
|
+
get(property: string): any;
|
|
66
68
|
set(props: any, propval?: any): any;
|
|
67
|
-
getState(property:
|
|
68
|
-
setState(props:
|
|
69
|
+
getState(property: string): any;
|
|
70
|
+
setState(props: Partial<import("@hatiolab/things-scene").State> | string, propval?: any): any;
|
|
69
71
|
get model(): any;
|
|
70
|
-
get state():
|
|
72
|
+
get state(): import("@hatiolab/things-scene").State;
|
|
73
|
+
get refid(): any;
|
|
71
74
|
get hierarchy(): any;
|
|
72
|
-
get volatile():
|
|
73
|
-
_applyProps(target:
|
|
75
|
+
get volatile(): string[];
|
|
76
|
+
_applyProps(target: Record<string, any>, props: Record<string, any>, options: import("@hatiolab/things-scene/dist-types/components/component.js").ApplyPropsOptions): any;
|
|
74
77
|
move(offset: {
|
|
75
78
|
x: number;
|
|
76
79
|
y: number;
|
|
@@ -103,7 +106,7 @@ declare const LegendItem_base: (new (...args: any[]) => {
|
|
|
103
106
|
draw(context?: import("@hatiolab/things-scene").SceneRenderContext): void;
|
|
104
107
|
prerender(context: import("@hatiolab/things-scene").SceneRenderContext): void;
|
|
105
108
|
postrender(context: import("@hatiolab/things-scene").SceneRenderContext): void;
|
|
106
|
-
prepare(resolve: (component: Component) => void, reject: (reason: any) => void): void;
|
|
109
|
+
prepare(resolve: (component: import("@hatiolab/things-scene").Component) => void, reject: (reason: any) => void): void;
|
|
107
110
|
prepareIf(condition: boolean): void;
|
|
108
111
|
drawText(context: import("@hatiolab/things-scene").SceneRenderContext): void;
|
|
109
112
|
drawStroke(context: import("@hatiolab/things-scene").SceneRenderContext, override?: Record<string, unknown>): void;
|
|
@@ -154,16 +157,16 @@ declare const LegendItem_base: (new (...args: any[]) => {
|
|
|
154
157
|
get started(): boolean;
|
|
155
158
|
set started(v: boolean): any;
|
|
156
159
|
get controls(): import("@hatiolab/things-scene").Control[] | undefined;
|
|
157
|
-
findFirst(finder: string | ((c: Component) => boolean), ...others: any[]): Component | undefined;
|
|
158
|
-
findAll(s: string | ((c: Component) => boolean), ...others: any[]): any[] | undefined;
|
|
159
|
-
capture(x: number, y: number, except?: (c: Component) => boolean): any;
|
|
160
|
+
findFirst(finder: string | ((c: import("@hatiolab/things-scene").Component) => boolean), ...others: any[]): import("@hatiolab/things-scene").Component | undefined;
|
|
161
|
+
findAll(s: string | ((c: import("@hatiolab/things-scene").Component) => boolean), ...others: any[]): any[] | undefined;
|
|
162
|
+
capture(x: number, y: number, except?: (c: import("@hatiolab/things-scene").Component) => boolean): any;
|
|
160
163
|
findAnchor(name: string): any;
|
|
161
|
-
isDescendible(container: Component): boolean;
|
|
164
|
+
isDescendible(container: import("@hatiolab/things-scene").Component | any): boolean;
|
|
162
165
|
getContext(component?: unknown): any;
|
|
163
|
-
get root(): Component;
|
|
164
|
-
get rootModel(): Component;
|
|
165
|
-
get parent(): Component;
|
|
166
|
-
set parent(v: Component): any;
|
|
166
|
+
get root(): import("@hatiolab/things-scene").Component;
|
|
167
|
+
get rootModel(): import("@hatiolab/things-scene").Component;
|
|
168
|
+
get parent(): import("@hatiolab/things-scene").Component;
|
|
169
|
+
set parent(v: import("@hatiolab/things-scene").Component): any;
|
|
167
170
|
get scalable(): boolean;
|
|
168
171
|
get stuck(): boolean;
|
|
169
172
|
get capturable(): boolean;
|
|
@@ -188,47 +191,51 @@ declare const LegendItem_base: (new (...args: any[]) => {
|
|
|
188
191
|
ondropfile(transfered: FileList, files: string[]): void;
|
|
189
192
|
transcoordS2P(x: number, y: number, rp?: import("@hatiolab/things-scene").POINT): import("@hatiolab/things-scene").POINT;
|
|
190
193
|
transcoordP2S(x: number, y: number, rp?: import("@hatiolab/things-scene").POINT): import("@hatiolab/things-scene").POINT;
|
|
191
|
-
transcoordS2T(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
192
|
-
transcoordT2P(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
193
|
-
transcoordT2S(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
194
|
-
transcoordS2TR(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
195
|
-
transcoordS2O(x: number, y: number, target: Component): import("@hatiolab/things-scene").POINT;
|
|
196
|
-
transcoordC2S(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
197
|
-
transcoordS2C(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
194
|
+
transcoordS2T(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
195
|
+
transcoordT2P(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
196
|
+
transcoordT2S(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
197
|
+
transcoordS2TR(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
198
|
+
transcoordS2O(x: number, y: number, target: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
199
|
+
transcoordC2S(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
200
|
+
transcoordS2C(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
198
201
|
toParent(x: number, y: number, rp?: import("@hatiolab/things-scene").POINT): import("@hatiolab/things-scene").POINT;
|
|
199
202
|
fromParent(x: number, y: number, rp?: import("@hatiolab/things-scene").POINT): import("@hatiolab/things-scene").POINT;
|
|
200
|
-
toScene(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
201
|
-
fromScene(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
202
|
-
toLocal(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
203
|
-
toGlobal(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
204
|
-
toOther(x: number, y: number, target: Component): import("@hatiolab/things-scene").POINT;
|
|
203
|
+
toScene(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
204
|
+
fromScene(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
205
|
+
toLocal(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
206
|
+
toGlobal(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
207
|
+
toOther(x: number, y: number, target: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
|
|
208
|
+
on<K extends keyof import("@hatiolab/things-scene").ComponentEventMap>(name: K, callback: (...args: import("@hatiolab/things-scene").ComponentEventMap[K]) => void, context?: any): any;
|
|
205
209
|
on(name: string | object, callback: Function, context?: any): any;
|
|
210
|
+
off<K extends keyof import("@hatiolab/things-scene").ComponentEventMap>(name: K, callback?: ((...args: import("@hatiolab/things-scene").ComponentEventMap[K]) => void) | undefined, context?: any): any;
|
|
206
211
|
off(name?: string | object, callback?: Function, context?: any): any;
|
|
212
|
+
once<K extends keyof import("@hatiolab/things-scene").ComponentEventMap>(name: K, callback: (...args: import("@hatiolab/things-scene").ComponentEventMap[K]) => void, context?: any): any;
|
|
207
213
|
once(name: string | object, callback: Function, context?: any): any;
|
|
214
|
+
trigger<K extends keyof import("@hatiolab/things-scene").ComponentEventMap>(name: K, ...args: import("@hatiolab/things-scene").ComponentEventMap[K]): any;
|
|
208
215
|
trigger(name: string, ...args: any[]): any;
|
|
209
216
|
delegate_on(delegator: any): any;
|
|
210
217
|
delegate_off(delegator: any): any;
|
|
211
218
|
onchange(after: Record<string, any>, before: Record<string, any>): void;
|
|
212
219
|
calculateBounds?(): void;
|
|
213
220
|
oncreate_element?(element: HTMLElement): void;
|
|
214
|
-
removeComponent(component: Component, ghost?: boolean): void;
|
|
215
|
-
addComponent(component: Component, ghost?: boolean): void;
|
|
216
|
-
insertComponentAt(component: Component, index: number, ghost?: boolean): void;
|
|
217
|
-
getOverlay(component: Component): HTMLElement | undefined;
|
|
218
|
-
findById(id: string): Component | undefined;
|
|
219
|
-
findByRefid(ref: string | number): Component | undefined;
|
|
220
|
-
findAllById(id: string): Component[];
|
|
221
|
+
removeComponent(component: import("@hatiolab/things-scene").Component, ghost?: boolean): void;
|
|
222
|
+
addComponent(component: import("@hatiolab/things-scene").Component, ghost?: boolean): void;
|
|
223
|
+
insertComponentAt(component: import("@hatiolab/things-scene").Component, index: number, ghost?: boolean): void;
|
|
224
|
+
getOverlay(component: import("@hatiolab/things-scene").Component): HTMLElement | undefined;
|
|
225
|
+
findById(id: string): import("@hatiolab/things-scene").Component | undefined;
|
|
226
|
+
findByRefid(ref: string | number): import("@hatiolab/things-scene").Component | undefined;
|
|
227
|
+
findAllById(id: string): import("@hatiolab/things-scene").Component[];
|
|
221
228
|
resize(): void;
|
|
222
229
|
fit(type?: string): void;
|
|
223
|
-
get components(): Component[] | undefined;
|
|
230
|
+
get components(): import("@hatiolab/things-scene").Component[] | undefined;
|
|
224
231
|
get layout(): any;
|
|
225
232
|
get auxOverlay(): HTMLElement | undefined;
|
|
226
233
|
get isReady(): boolean;
|
|
227
234
|
get unitScale(): number;
|
|
228
|
-
get selected(): Component[];
|
|
229
|
-
set selected(_v: Component[]): any;
|
|
230
|
-
get focused(): Component | null;
|
|
231
|
-
set focused(_v: Component | null): any;
|
|
235
|
+
get selected(): import("@hatiolab/things-scene").Component[];
|
|
236
|
+
set selected(_v: import("@hatiolab/things-scene").Component[]): any;
|
|
237
|
+
get focused(): import("@hatiolab/things-scene").Component | null;
|
|
238
|
+
set focused(_v: import("@hatiolab/things-scene").Component | null): any;
|
|
232
239
|
get hasSameParentForAllSelected(): boolean;
|
|
233
240
|
set hasSameParentForAllSelected(_v: boolean): any;
|
|
234
241
|
get fitMode(): string | undefined;
|
package/dist/legend-item.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"legend-item.js","sourceRoot":"","sources":["../src/legend-item.ts"],"names":[],"mappings":";AAAA;;GAEG;AACH,OAAO,
|
|
1
|
+
{"version":3,"file":"legend-item.js","sourceRoot":"","sources":["../src/legend-item.ts"],"names":[],"mappings":";AAAA;;GAEG;AACH,OAAO,EAA+B,QAAQ,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAErG,MAAM,MAAM,GAAoB;IAC9B,OAAO,EAAE,KAAK;IACd,SAAS,EAAE,KAAK;IAChB,SAAS,EAAE,KAAK;IAChB,UAAU,EAAE,EAAE;CACf,CAAA;AAGc,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,QAAQ,CAAC,KAAK,CAAC;IACrD,MAAM,CAAC,OAAiC;QACtC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC,KAAK,CAAA;QAE7C,OAAO,CAAC,SAAS,EAAE,CAAA;QAEnB,IAAI,CAAC,GAAG,MAAM,GAAG,CAAC,CAAA;QAClB,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;QAEb,OAAO,CAAC,IAAI,EAAE,CAAA;QAEd,OAAO,CAAC,SAAS,GAAG,KAAK,CAAA;QACzB,OAAO,CAAC,OAAO,CAAC,IAAI,GAAG,CAAC,EAAE,GAAG,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,EAAE,GAAG,CAAC,EAAE,IAAI,CAAC,CAAA;QACjE,OAAO,CAAC,WAAW,GAAG,kBAAkB,CAAA;QACxC,OAAO,CAAC,UAAU,GAAG,CAAC,CAAA;QACtB,OAAO,CAAC,aAAa,GAAG,CAAC,CAAA;QACzB,OAAO,CAAC,aAAa,GAAG,CAAC,CAAA;QACzB,OAAO,CAAC,IAAI,EAAE,CAAA;QAEd,OAAO,CAAC,OAAO,EAAE,CAAA;IACnB,CAAC;IAED,QAAQ,CAAC,KAAiB;QACxB,IAAI,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC;YAAE,IAAI,CAAC,GAAG,CAAC,aAAa,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;IAC3E,CAAC;IAED,IAAI,KAAK;QACP,OAAO,IAAI,CAAA;IACb,CAAC;IAED,IAAI,UAAU;QACZ,OAAO,KAAK,CAAA;IACd,CAAC;IAED,IAAI,MAAM;QACR,OAAO,MAAM,CAAA;IACf,CAAC;CACF,CAAA;AArCoB,UAAU;IAD9B,cAAc,CAAC,aAAa,CAAC;GACT,UAAU,CAqC9B;eArCoB,UAAU","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\nimport { ComponentNature, Properties, RectPath, Shape, sceneComponent } from '@hatiolab/things-scene'\n\nconst NATURE: ComponentNature = {\n mutable: false,\n resizable: false,\n rotatable: false,\n properties: []\n}\n\n@sceneComponent('legend-item')\nexport default class LegendItem extends RectPath(Shape) {\n render(context: CanvasRenderingContext2D) {\n var { left, top, height, color } = this.state\n\n context.beginPath()\n\n var c = height / 2\n var r = c / 2\n\n context.save()\n\n context.fillStyle = color\n context.ellipse(left + c, top + c, r, r, 0, 0, Math.PI * 2, true)\n context.shadowColor = 'rgba(0,0,0,0.15)'\n context.shadowBlur = 2\n context.shadowOffsetX = 1\n context.shadowOffsetY = 2\n context.fill()\n\n context.restore()\n }\n\n onchange(after: Properties) {\n if (after.hasOwnProperty('height')) this.set('paddingLeft', after.height)\n }\n\n get stuck() {\n return true\n }\n\n get capturable() {\n return false\n }\n\n get nature() {\n return NATURE\n }\n}\n"]}
|
package/dist/legend.d.ts
CHANGED
|
@@ -10,14 +10,7 @@ export default class Legend extends Container {
|
|
|
10
10
|
ondragmove: (point: POSITION, index: number, component: Component) => void;
|
|
11
11
|
};
|
|
12
12
|
}[];
|
|
13
|
-
get layout():
|
|
14
|
-
reflow(container: import("@hatiolab/things-scene/dist-types/types/component").Container): void;
|
|
15
|
-
capturables(container: import("@hatiolab/things-scene/dist-types/types/component").Container): import("@hatiolab/things-scene").ComponentInterface[];
|
|
16
|
-
drawables(container: import("@hatiolab/things-scene/dist-types/types/component").Container): import("@hatiolab/things-scene").ComponentInterface[];
|
|
17
|
-
isStuck(component: import("@hatiolab/things-scene").ComponentInterface): boolean;
|
|
18
|
-
keyNavigate(container: import("@hatiolab/things-scene/dist-types/types/component").Container, component: import("@hatiolab/things-scene").ComponentInterface, e: KeyboardEvent): import("@hatiolab/things-scene").ComponentInterface | undefined;
|
|
19
|
-
joinType: boolean;
|
|
20
|
-
};
|
|
13
|
+
get layout(): any;
|
|
21
14
|
get nature(): ComponentNature;
|
|
22
15
|
rebuildLegendItems(): void;
|
|
23
16
|
get hasTextProperty(): boolean;
|
package/dist/legend.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"legend.js","sourceRoot":"","sources":["../src/legend.ts"],"names":[],"mappings":";AAAA;;GAEG;AACH,OAAO,EAGL,SAAS,EACT,KAAK,EAGL,WAAW,EACX,cAAc,EACf,MAAM,wBAAwB,CAAA;AAE/B,MAAM,MAAM,GAAoB;IAC9B,OAAO,EAAE,KAAK;IACd,SAAS,EAAE,IAAI;IACf,SAAS,EAAE,IAAI;IACf,UAAU,EAAE;QACV;YACE,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,MAAM;YACb,IAAI,EAAE,MAAM;SACb;QACD;YACE,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,SAAS;YAChB,IAAI,EAAE,SAAS;SAChB;QACD;YACE,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,WAAW;YAClB,IAAI,EAAE,WAAW;YACjB,QAAQ,EAAE;gBACR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AAI,IAAI,EAAE,OAAO,CAAA;QAEjB,IAAI,CAAC,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC;YACtB,IAAI,GAAG,KAAK,CAAA;YACZ,OAAO,GAAG,CAAC,CAAA;QACb,CAAC;aAAM,IAAI,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC;YAC5B,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,CAAA;QAC3C,CAAC;aAAM,IAAI,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YAC5B,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAA;QAC3C,CAAC;QAED,IAAI,CAAC,GAAG,CAAC;YACP,YAAY,EAAE;gBACZ,IAAI;gBACJ,OAAO;aACR;SACF,CAAC,CAAA;IACJ,CAAC;IAED,IAAI,eAAe;QACjB,OAAO,IAAI,CAAA;IACb,CAAC;IAED,IAAI,UAAU;QACZ,OAAO,IAAI,CAAA;IACb,CAAC;IAED,QAAQ,CAAC,KAAiB,EAAE,MAAkB;QAC5C,IAAI,CAAC,kBAAkB,EAAE,CAAA;IAC3B,CAAC;CACF,CAAA;AAzJoB,MAAM;IAD1B,cAAc,CAAC,QAAQ,CAAC;GACJ,MAAM,CAyJ1B;eAzJoB,MAAM","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\nimport {\n Component,\n ComponentNature,\n Container,\n Model,\n POSITION,\n Properties,\n TableLayout,\n sceneComponent\n} from '@hatiolab/things-scene'\n\nconst NATURE: ComponentNature = {\n mutable: false,\n resizable: true,\n rotatable: true,\n properties: [\n {\n type: 'number',\n label: 'rows',\n name: 'rows'\n },\n {\n type: 'number',\n label: 'columns',\n name: 'columns'\n },\n {\n type: 'select',\n label: 'direction',\n name: 'direction',\n property: {\n options: [\n {\n display: 'Horizontal',\n value: 'horizontal'\n },\n {\n display: 'Vertical',\n value: 'vertical'\n }\n ]\n }\n },\n {\n type: 'number',\n label: 'round',\n name: 'round'\n },\n {\n type: 'legend-status',\n label: '',\n name: 'status'\n }\n ],\n help: 'scene/component/legend'\n}\n\nvar controlHandler = {\n ondragmove: function (point: POSITION, index: number, component: Component) {\n var { left, top, width, height } = component.model\n /*\n * point의 좌표는 부모 레이어 기준의 x, y 값이다.\n * 따라서, 도형의 회전을 감안한 좌표로의 변환이 필요하다.\n * Transcoord시에는 point좌표가 부모까지 transcoord되어있는 상태이므로,\n * 컴포넌트자신에 대한 transcoord만 필요하다.(마지막 파라미터를 false로).\n */\n var transcoorded = component.transcoordP2S(point.x, point.y)\n var round = ((transcoorded.x - left) / (width / 2)) * 100\n\n round = roundSet(round, width, height)\n\n component.set({ round })\n }\n}\n\nfunction roundSet(round: number, width: number, height: number) {\n var max = width > height ? (height / width) * 100 : 100\n\n if (round >= max) round = max\n else if (round <= 0) round = 0\n\n return round\n}\n\n@sceneComponent('legend')\nexport default class Legend extends Container {\n async ready() {\n await super.ready()\n\n this.rebuildLegendItems()\n }\n\n get showMoveHandle() {\n return false\n }\n\n render(context: CanvasRenderingContext2D) {\n var { round = 0 } = this.state\n\n var { left, top, width, height } = this.bounds\n\n // 박스 그리기\n context.beginPath()\n\n round = roundSet(round, width, height)\n\n if (round > 0) {\n var radius = (round / 100) * (width / 2)\n\n context.moveTo(left + radius, top)\n context.lineTo(left + width - radius, top)\n context.quadraticCurveTo(left + width, top, left + width, top + radius)\n context.lineTo(left + width, top + height - radius)\n context.quadraticCurveTo(left + width, top + height, left + width - radius, top + height)\n context.lineTo(left + radius, top + height)\n context.quadraticCurveTo(left, top + height, left, top + height - radius)\n context.lineTo(left, top + radius)\n context.quadraticCurveTo(left, top, left + radius, top)\n\n this.model.padding = {\n top: round / 2,\n left: round / 2,\n right: round / 2,\n bottom: round / 2\n }\n } else {\n context.rect(left, top, width, height)\n }\n\n this.drawFill(context)\n this.drawStroke(context)\n }\n\n get controls() {\n var { left, top, width, round, height } = this.state\n round = round == undefined ? 0 : roundSet(round, width, height)\n\n return [\n {\n x: left + (width / 2) * (round / 100),\n y: top,\n handler: controlHandler\n }\n ]\n }\n\n get layout() {\n return TableLayout\n }\n\n get nature() {\n return NATURE\n }\n\n rebuildLegendItems() {\n if (this.components.length) {\n this.components.slice().forEach((m: any) => m.dispose())\n }\n\n var {\n left,\n top,\n width,\n height,\n fillStyle,\n strokeStyle,\n fontColor,\n fontFamily,\n fontSize,\n lineHeight,\n textAlign = 'left',\n round = 0,\n italic,\n bold,\n lineWidth = 0,\n rows,\n columns,\n status = {}\n } = this.state\n\n let statusRanges: {\n min: string\n max: string\n description: string\n color: string\n }[] = status.ranges || []\n\n var count = statusRanges.length\n\n this.add(\n statusRanges.map(range =>\n Model.compile({\n type: 'legend-item',\n text: range.description || `${range.min || ''} ~ ${range.max || ''}`,\n width: 1,\n height: 1,\n color: range.color,\n fontColor,\n fontFamily,\n fontSize,\n lineHeight,\n italic,\n bold,\n textAlign\n } as any, this.app)\n )\n )\n\n var rows, columns\n\n if (!columns && !rows) {\n rows = count\n columns = 1\n } else if (columns && !rows) {\n rows = Math.ceil(count / Number(columns))\n } else if (rows && !columns) {\n columns = Math.ceil(count / Number(rows))\n }\n\n this.set({\n layoutConfig: {\n rows,\n columns\n }\n })\n }\n\n get hasTextProperty() {\n return true\n }\n\n get textHidden() {\n return true\n }\n\n onchange(after: Properties, before: Properties) {\n this.rebuildLegendItems()\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"legend.js","sourceRoot":"","sources":["../src/legend.ts"],"names":[],"mappings":";AAAA;;GAEG;AACH,OAAO,EAGL,SAAS,EACT,KAAK,EAGL,WAAW,EACX,cAAc,EACf,MAAM,wBAAwB,CAAA;AAE/B,MAAM,MAAM,GAAoB;IAC9B,OAAO,EAAE,KAAK;IACd,SAAS,EAAE,IAAI;IACf,SAAS,EAAE,IAAI;IACf,UAAU,EAAE;QACV;YACE,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,M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,KAAK,EAAE,CAAC;YACR,MAAM,EAAE,CAAC;YACT,KAAK,EAAE,KAAK,CAAC,KAAK;YAClB,SAAS;YACT,UAAU;YACV,QAAQ;YACR,UAAU;YACV,MAAM;YACN,IAAI;YACJ,SAAS;SACH,EAAE,IAAI,CAAC,GAAG,CAAC,CACpB,CACF,CAAA;QAED,IAAI,IAAI,EAAE,OAAO,CAAA;QAEjB,IAAI,CAAC,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC;YACtB,IAAI,GAAG,KAAK,CAAA;YACZ,OAAO,GAAG,CAAC,CAAA;QACb,CAAC;aAAM,IAAI,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC;YAC5B,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,CAAA;QAC3C,CAAC;aAAM,IAAI,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YAC5B,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAA;QAC3C,CAAC;QAED,IAAI,CAAC,GAAG,CAAC;YACP,YAAY,EAAE;gBACZ,IAAI;gBACJ,OAAO;aACR;SACF,CAAC,CAAA;IACJ,CAAC;IAED,IAAI,eAAe;QACjB,OAAO,IAAI,CAAA;IACb,CAAC;IAED,IAAI,UAAU;QACZ,OAAO,IAAI,CAAA;IACb,CAAC;IAED,QAAQ,CAAC,KAAiB,EAAE,MAAkB;QAC5C,IAAI,CAAC,kBAAkB,EAAE,CAAA;IAC3B,CAAC;CACF,CAAA;AAzJoB,MAAM;IAD1B,cAAc,CAAC,QAAQ,CAAC;GACJ,MAAM,CAyJ1B;eAzJoB,MAAM","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\nimport {\n Component,\n ComponentNature,\n Container,\n Model,\n POSITION,\n Properties,\n TableLayout,\n sceneComponent\n} from '@hatiolab/things-scene'\n\nconst NATURE: ComponentNature = {\n mutable: false,\n resizable: true,\n rotatable: true,\n properties: [\n {\n type: 'number',\n label: 'rows',\n name: 'rows'\n },\n {\n type: 'number',\n label: 'columns',\n name: 'columns'\n },\n {\n type: 'select',\n label: 'direction',\n name: 'direction',\n property: {\n options: [\n {\n display: 'Horizontal',\n value: 'horizontal'\n },\n {\n display: 'Vertical',\n value: 'vertical'\n }\n ]\n }\n },\n {\n type: 'number',\n label: 'round',\n name: 'round'\n },\n {\n type: 'legend-status',\n label: '',\n name: 'status'\n }\n ],\n help: 'scene/component/legend'\n}\n\nvar controlHandler = {\n ondragmove: function (point: POSITION, index: number, component: Component) {\n var { left, top, width, height } = component.model\n /*\n * point의 좌표는 부모 레이어 기준의 x, y 값이다.\n * 따라서, 도형의 회전을 감안한 좌표로의 변환이 필요하다.\n * Transcoord시에는 point좌표가 부모까지 transcoord되어있는 상태이므로,\n * 컴포넌트자신에 대한 transcoord만 필요하다.(마지막 파라미터를 false로).\n */\n var transcoorded = component.transcoordP2S(point.x, point.y)\n var round = ((transcoorded.x - left) / (width / 2)) * 100\n\n round = roundSet(round, width, height)\n\n component.set({ round })\n }\n}\n\nfunction roundSet(round: number, width: number, height: number) {\n var max = width > height ? (height / width) * 100 : 100\n\n if (round >= max) round = max\n else if (round <= 0) round = 0\n\n return round\n}\n\n@sceneComponent('legend')\nexport default class Legend extends Container {\n async ready() {\n await super.ready()\n\n this.rebuildLegendItems()\n }\n\n get showMoveHandle() {\n return false\n }\n\n render(context: CanvasRenderingContext2D) {\n var { round = 0 } = this.state\n\n var { left, top, width, height } = this.bounds\n\n // 박스 그리기\n context.beginPath()\n\n round = roundSet(round, width, height)\n\n if (round > 0) {\n var radius = (round / 100) * (width / 2)\n\n context.moveTo(left + radius, top)\n context.lineTo(left + width - radius, top)\n context.quadraticCurveTo(left + width, top, left + width, top + radius)\n context.lineTo(left + width, top + height - radius)\n context.quadraticCurveTo(left + width, top + height, left + width - radius, top + height)\n context.lineTo(left + radius, top + height)\n context.quadraticCurveTo(left, top + height, left, top + height - radius)\n context.lineTo(left, top + radius)\n context.quadraticCurveTo(left, top, left + radius, top)\n\n this.model.padding = {\n top: round / 2,\n left: round / 2,\n right: round / 2,\n bottom: round / 2\n }\n } else {\n context.rect(left, top, width, height)\n }\n\n this.drawFill(context)\n this.drawStroke(context)\n }\n\n get controls() {\n var { left, top, width, round, height } = this.state\n round = round == undefined ? 0 : roundSet(round, width, height)\n\n return [\n {\n x: left + (width / 2) * (round / 100),\n y: top,\n handler: controlHandler\n }\n ]\n }\n\n get layout(): any {\n return TableLayout\n }\n\n get nature() {\n return NATURE\n }\n\n rebuildLegendItems() {\n if (this.components.length) {\n this.components.slice().forEach((m: any) => m.dispose())\n }\n\n var {\n left,\n top,\n width,\n height,\n fillStyle,\n strokeStyle,\n fontColor,\n fontFamily,\n fontSize,\n lineHeight,\n textAlign = 'left',\n round = 0,\n italic,\n bold,\n lineWidth = 0,\n rows,\n columns,\n status = {}\n } = this.state\n\n let statusRanges: {\n min: string\n max: string\n description: string\n color: string\n }[] = status.ranges || []\n\n var count = statusRanges.length\n\n this.add(\n statusRanges.map(range =>\n Model.compile({\n type: 'legend-item',\n text: range.description || `${range.min || ''} ~ ${range.max || ''}`,\n width: 1,\n height: 1,\n color: range.color,\n fontColor,\n fontFamily,\n fontSize,\n lineHeight,\n italic,\n bold,\n textAlign\n } as any, this.app)\n )\n )\n\n var rows, columns\n\n if (!columns && !rows) {\n rows = count\n columns = 1\n } else if (columns && !rows) {\n rows = Math.ceil(count / Number(columns))\n } else if (rows && !columns) {\n columns = Math.ceil(count / Number(rows))\n }\n\n this.set({\n layoutConfig: {\n rows,\n columns\n }\n })\n }\n\n get hasTextProperty() {\n return true\n }\n\n get textHidden() {\n return true\n }\n\n onchange(after: Properties, before: Properties) {\n this.rebuildLegendItems()\n }\n}\n"]}
|
package/dist/templates/legend.js
CHANGED
|
@@ -2,7 +2,7 @@ const icon = new URL('../../icons/legend.png', import.meta.url).href;
|
|
|
2
2
|
export default {
|
|
3
3
|
type: 'legend',
|
|
4
4
|
description: 'legend for visualizer',
|
|
5
|
-
group: '
|
|
5
|
+
group: 'chartAndGauge' /* line|shape|textAndMedia|chartAndGauge|table|container|dataSource|3D|facility|storage|conveyance|transport|form|etc */,
|
|
6
6
|
icon,
|
|
7
7
|
model: {
|
|
8
8
|
type: 'legend',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"legend.js","sourceRoot":"","sources":["../../src/templates/legend.ts"],"names":[],"mappings":"AAAA,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,wBAAwB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAA;AAEpE,eAAe;IACb,IAAI,EAAE,QAAQ;IACd,WAAW,EAAE,uBAAuB;IACpC,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"legend.js","sourceRoot":"","sources":["../../src/templates/legend.ts"],"names":[],"mappings":"AAAA,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,wBAAwB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAA;AAEpE,eAAe;IACb,IAAI,EAAE,QAAQ;IACd,WAAW,EAAE,uBAAuB;IACpC,KAAK,EAAE,eAAe,CAAC,wHAAwH;IAC/I,IAAI;IACJ,KAAK,EAAE;QACL,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE,GAAG;QACT,GAAG,EAAE,GAAG;QACR,KAAK,EAAE,GAAG;QACV,MAAM,EAAE,GAAG;QACX,SAAS,EAAE,SAAS;QACpB,SAAS,EAAE,UAAU;QACrB,WAAW,EAAE,oBAAoB;QACjC,SAAS,EAAE,CAAC;KACb;CACF,CAAA","sourcesContent":["const icon = new URL('../../icons/legend.png', import.meta.url).href\n\nexport default {\n type: 'legend',\n description: 'legend for visualizer',\n group: 'chartAndGauge' /* line|shape|textAndMedia|chartAndGauge|table|container|dataSource|3D|facility|storage|conveyance|transport|form|etc */,\n icon,\n model: {\n type: 'legend',\n left: 100,\n top: 100,\n width: 200,\n height: 150,\n fillStyle: '#efefef',\n direction: 'vertical',\n strokeStyle: 'rgba(0, 0, 0, 0.3)',\n lineWidth: 1\n }\n}\n"]}
|
package/dist/templates/svg.js
CHANGED
|
@@ -2,7 +2,7 @@ const icon = new URL('../../icons/svg.png', import.meta.url).href;
|
|
|
2
2
|
export default {
|
|
3
3
|
type: 'svg',
|
|
4
4
|
description: 'svg for visualizer',
|
|
5
|
-
group: '
|
|
5
|
+
group: 'textAndMedia' /* line|shape|textAndMedia|chartAndGauge|table|container|dataSource|3D|facility|storage|conveyance|transport|form|etc */,
|
|
6
6
|
icon,
|
|
7
7
|
model: {
|
|
8
8
|
type: 'svg',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"svg.js","sourceRoot":"","sources":["../../src/templates/svg.ts"],"names":[],"mappings":"AAAA,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,qBAAqB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAA;AAEjE,eAAe;IACb,IAAI,EAAE,KAAK;IACX,WAAW,EAAE,oBAAoB;IACjC,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"svg.js","sourceRoot":"","sources":["../../src/templates/svg.ts"],"names":[],"mappings":"AAAA,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,qBAAqB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAA;AAEjE,eAAe;IACb,IAAI,EAAE,KAAK;IACX,WAAW,EAAE,oBAAoB;IACjC,KAAK,EAAE,cAAc,CAAC,wHAAwH;IAC9I,IAAI;IACJ,KAAK,EAAE;QACL,IAAI,EAAE,KAAK;QACX,IAAI,EAAE,GAAG;QACT,GAAG,EAAE,GAAG;QACR,KAAK,EAAE,GAAG;QACV,MAAM,EAAE,GAAG;QACX,SAAS,EAAE,SAAS;QACpB,SAAS,EAAE,UAAU;QACrB,WAAW,EAAE,oBAAoB;QACjC,SAAS,EAAE,CAAC;KACb;CACF,CAAA","sourcesContent":["const icon = new URL('../../icons/svg.png', import.meta.url).href\n\nexport default {\n type: 'svg',\n description: 'svg for visualizer',\n group: 'textAndMedia' /* line|shape|textAndMedia|chartAndGauge|table|container|dataSource|3D|facility|storage|conveyance|transport|form|etc */,\n icon,\n model: {\n type: 'svg',\n left: 100,\n top: 100,\n width: 400,\n height: 300,\n fillStyle: '#efefef',\n direction: 'vertical',\n strokeStyle: 'rgba(0, 0, 0, 0.3)',\n lineWidth: 1\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@operato/scene-legend",
|
|
3
3
|
"description": "Legend component for things-scene.",
|
|
4
4
|
"author": "heartyoh",
|
|
5
|
-
"version": "10.0.
|
|
5
|
+
"version": "10.0.1",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"module": "dist/index.js",
|
|
@@ -18,24 +18,20 @@
|
|
|
18
18
|
"directory": "packages/legend"
|
|
19
19
|
},
|
|
20
20
|
"scripts": {
|
|
21
|
-
"serve": "tsc && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"things-factory-dev\"",
|
|
22
|
-
"serve:dev": "npm run serve",
|
|
23
21
|
"start": "tsc && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wds\"",
|
|
24
22
|
"build": "tsc",
|
|
25
23
|
"prepublishOnly": "tsc",
|
|
26
24
|
"lint": "eslint src/ && prettier \"src/**/*.ts\" --check",
|
|
27
|
-
"format": "eslint src/ --fix && prettier \"src/**/*.ts\" --write"
|
|
28
|
-
"migration": "things-factory-migration"
|
|
25
|
+
"format": "eslint src/ --fix && prettier \"src/**/*.ts\" --write"
|
|
29
26
|
},
|
|
30
27
|
"dependencies": {
|
|
31
|
-
"@hatiolab/things-scene": "^10.0.0
|
|
32
|
-
"@operato/i18n": "^10.0.0
|
|
28
|
+
"@hatiolab/things-scene": "^10.0.0",
|
|
29
|
+
"@operato/i18n": "^10.0.0",
|
|
30
|
+
"@operato/property-editor": "^10.0.0",
|
|
33
31
|
"lit": "^3.1.2"
|
|
34
32
|
},
|
|
35
33
|
"devDependencies": {
|
|
36
34
|
"@hatiolab/prettier-config": "^1.0.0",
|
|
37
|
-
"@things-factory/builder": "^10.0.0-beta.1",
|
|
38
|
-
"@things-factory/operato-board": "^10.0.0-beta.1",
|
|
39
35
|
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
40
36
|
"@typescript-eslint/parser": "^8.0.0",
|
|
41
37
|
"@web/dev-server": "^0.1.28",
|
|
@@ -60,5 +56,5 @@
|
|
|
60
56
|
"prettier --write"
|
|
61
57
|
]
|
|
62
58
|
},
|
|
63
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "3b4000cc6b720286a44085047ff14b6c12b33fd4"
|
|
64
60
|
}
|