@operato/scene-basic 9.0.1 → 10.0.0-beta.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/dist/audio.d.ts +240 -4
- package/dist/audio.js +6 -3
- package/dist/audio.js.map +1 -1
- package/dist/ellipse.d.ts +229 -4
- package/dist/ellipse.js.map +1 -1
- package/dist/gif-view.d.ts +1 -1
- package/dist/gif-view.js +3 -1
- package/dist/gif-view.js.map +1 -1
- package/dist/image-view.d.ts +240 -4
- package/dist/image-view.js +7 -3
- package/dist/image-view.js.map +1 -1
- package/dist/polyline.js +2 -3
- package/dist/polyline.js.map +1 -1
- package/dist/rect.d.ts +465 -4
- package/dist/star.js.map +1 -1
- package/dist/text.d.ts +237 -1
- package/package.json +13 -13
package/dist/rect.d.ts
CHANGED
|
@@ -1,9 +1,470 @@
|
|
|
1
1
|
import { Component, ComponentNature, POSITION, Shape } from '@hatiolab/things-scene';
|
|
2
2
|
declare const Rect_base: (new (...args: any[]) => {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
isConnectable(): boolean;
|
|
4
|
+
postrender(context: any): void;
|
|
5
|
+
_draw_anchors(context: any): void;
|
|
6
|
+
contains(x: number, y: number): boolean;
|
|
7
|
+
findInOutLines(anchorName: string): any;
|
|
8
|
+
findOutletLines(anchorName: string): any;
|
|
9
|
+
findOutletEnds(anchorName: string): any;
|
|
10
|
+
findInletLines(anchorName: string): any;
|
|
11
|
+
findInletEnds(anchorName: string): any;
|
|
12
|
+
_app: any;
|
|
13
|
+
_model: any;
|
|
14
|
+
_state: any;
|
|
15
|
+
_delta: any;
|
|
16
|
+
_animation: any;
|
|
17
|
+
_animate: any;
|
|
18
|
+
_parent: any;
|
|
19
|
+
_disposed: any;
|
|
20
|
+
_textHidden: any;
|
|
21
|
+
_text_substitutor: any;
|
|
22
|
+
_value_substitutor: any;
|
|
23
|
+
_mappings: any;
|
|
24
|
+
_realObject: import("@hatiolab/things-scene").IRealObject | undefined;
|
|
25
|
+
_cachedState: any;
|
|
26
|
+
updatedAt: any;
|
|
27
|
+
fontSize: any;
|
|
28
|
+
__cache__: any;
|
|
29
|
+
created(): void;
|
|
30
|
+
added(parent: any): void;
|
|
31
|
+
removed(parent: any): void;
|
|
32
|
+
ready(): Promise<void>;
|
|
33
|
+
touch(): void;
|
|
34
|
+
clearCache(...attrs: any[]): void;
|
|
35
|
+
removeSelf(completely: any): void;
|
|
36
|
+
resetAnimation(): void;
|
|
37
|
+
dispose(): void;
|
|
38
|
+
get nature(): import("@hatiolab/things-scene").ComponentNature;
|
|
39
|
+
get disposed(): boolean;
|
|
40
|
+
isLayer(): boolean;
|
|
41
|
+
isGroup(): boolean;
|
|
42
|
+
isContainer(): this is import("@hatiolab/things-scene/dist-types/types/component").Container;
|
|
43
|
+
isLine(): boolean;
|
|
44
|
+
isRoot(): boolean;
|
|
45
|
+
isRootModel(): boolean;
|
|
46
|
+
is3dish(): boolean;
|
|
47
|
+
get is3dMode(): boolean;
|
|
48
|
+
isIn3DSpace(): boolean;
|
|
49
|
+
isTemplate(): boolean;
|
|
50
|
+
isHTMLElement(): boolean;
|
|
51
|
+
isIdentifiable(): boolean;
|
|
52
|
+
isPositionable(): boolean;
|
|
53
|
+
replaceRefids(replaceMap: any): void;
|
|
54
|
+
get(property: any): any;
|
|
55
|
+
set(props: any, propval?: any): any;
|
|
56
|
+
getState(property: any): any;
|
|
57
|
+
setState(props: any, propval?: any): any;
|
|
58
|
+
get model(): any;
|
|
59
|
+
get state(): any;
|
|
60
|
+
get hierarchy(): any;
|
|
61
|
+
get volatile(): never[];
|
|
62
|
+
_applyProps(target: any, props: any, options: any): any;
|
|
63
|
+
move(offset: {
|
|
64
|
+
x: number;
|
|
65
|
+
y: number;
|
|
66
|
+
}, ...args: boolean[]): void;
|
|
67
|
+
symmetryX(x?: number): void;
|
|
68
|
+
symmetryY(y: number): void;
|
|
69
|
+
adjustResize(bounds: import("@hatiolab/things-scene").BOUNDS, origin_bounds: import("@hatiolab/things-scene").BOUNDS, diagonal: boolean): {
|
|
70
|
+
left: any;
|
|
71
|
+
top: any;
|
|
72
|
+
width: any;
|
|
73
|
+
height: any;
|
|
74
|
+
};
|
|
75
|
+
adjustRotation(rotation: number, step: boolean): number;
|
|
76
|
+
outline(progress: number): any;
|
|
77
|
+
get bounds(): import("@hatiolab/things-scene").BOUNDS;
|
|
78
|
+
set bounds(b: import("@hatiolab/things-scene").BOUNDS): any;
|
|
79
|
+
get center(): import("@hatiolab/things-scene").POINT;
|
|
80
|
+
set center(p: import("@hatiolab/things-scene").POINT): any;
|
|
81
|
+
get location(): import("@hatiolab/things-scene").POINT;
|
|
82
|
+
set location(l: import("@hatiolab/things-scene").POINT): any;
|
|
83
|
+
get rotate(): import("@hatiolab/things-scene").POINT;
|
|
84
|
+
set rotate(r: import("@hatiolab/things-scene").POINT): any;
|
|
85
|
+
get dimension(): import("@hatiolab/things-scene").DIMENSION;
|
|
86
|
+
set dimension(d: import("@hatiolab/things-scene").DIMENSION): any;
|
|
87
|
+
get path(): import("@hatiolab/things-scene").POINT[];
|
|
88
|
+
set path(p: import("@hatiolab/things-scene").POINT[]): any;
|
|
89
|
+
get drawPath(): import("@hatiolab/things-scene").POINT[];
|
|
90
|
+
get rotatePoint(): import("@hatiolab/things-scene").POINT;
|
|
91
|
+
get mutable(): boolean;
|
|
92
|
+
get resizable(): boolean;
|
|
93
|
+
get rotatable(): boolean;
|
|
94
|
+
buildRealObject(): import("@hatiolab/things-scene").IRealObject | undefined;
|
|
95
|
+
get realObject(): import("@hatiolab/things-scene").IRealObject | undefined;
|
|
96
|
+
draw(context?: import("@hatiolab/things-scene").SceneRenderContext): void;
|
|
97
|
+
prerender(context: import("@hatiolab/things-scene").SceneRenderContext): void;
|
|
98
|
+
render(context: import("@hatiolab/things-scene").SceneRenderContext): void;
|
|
99
|
+
prepare(resolve: (component: Component) => void, reject: (reason: any) => void): void;
|
|
100
|
+
prepareIf(condition: boolean): void;
|
|
101
|
+
drawText(context: import("@hatiolab/things-scene").SceneRenderContext): void;
|
|
102
|
+
drawStroke(context: import("@hatiolab/things-scene").SceneRenderContext, override?: Record<string, unknown>): void;
|
|
103
|
+
drawFill(context: import("@hatiolab/things-scene").SceneRenderContext, override?: Record<string, unknown>): void;
|
|
104
|
+
get strokeStyle(): any;
|
|
105
|
+
set strokeStyle(v: any): any;
|
|
106
|
+
get fillStyle(): any;
|
|
107
|
+
set fillStyle(v: any): any;
|
|
108
|
+
get fontColor(): string;
|
|
109
|
+
set fontColor(v: string): any;
|
|
110
|
+
get rotation(): number;
|
|
111
|
+
set rotation(v: number): any;
|
|
112
|
+
get decorators(): string[];
|
|
113
|
+
get decotag(): string;
|
|
114
|
+
get hidden(): boolean;
|
|
115
|
+
set hidden(v: boolean): any;
|
|
116
|
+
get tag(): string;
|
|
117
|
+
set tag(v: string): any;
|
|
118
|
+
get appendum(): any;
|
|
119
|
+
set appendum(v: any): any;
|
|
120
|
+
defaultTextSubstitutor(): string;
|
|
121
|
+
textLines(context?: import("@hatiolab/things-scene").SceneRenderContext): any[][];
|
|
122
|
+
get font(): string;
|
|
123
|
+
get lineHeight(): number;
|
|
124
|
+
get textSubstitutor(): () => string;
|
|
125
|
+
get text(): string;
|
|
126
|
+
set text(v: string): any;
|
|
127
|
+
get textBounds(): import("@hatiolab/things-scene").BOUNDS;
|
|
128
|
+
get textRotation(): number;
|
|
129
|
+
get textHidden(): boolean;
|
|
130
|
+
set textHidden(v: boolean): any;
|
|
131
|
+
get hasTextProperty(): boolean;
|
|
132
|
+
animate(opts: import("@hatiolab/things-scene").AnimationConfig): any;
|
|
133
|
+
effect(context: import("@hatiolab/things-scene").SceneRenderContext, model: any): void;
|
|
134
|
+
serialize(...others: any[]): string;
|
|
135
|
+
trim(): void;
|
|
136
|
+
closeScene(data: any): void;
|
|
137
|
+
delta(attr?: string | object, value?: any): any;
|
|
138
|
+
invalidate(): void;
|
|
139
|
+
get value(): any;
|
|
140
|
+
set value(v: any): any;
|
|
141
|
+
get data(): any;
|
|
142
|
+
set data(v: any): any;
|
|
143
|
+
set tap(v: any): any;
|
|
144
|
+
get mappings(): any[];
|
|
145
|
+
get retention(): number;
|
|
146
|
+
get animation(): import("@hatiolab/things-scene").AnimationController | undefined;
|
|
147
|
+
get started(): boolean;
|
|
148
|
+
set started(v: boolean): any;
|
|
149
|
+
get controls(): import("@hatiolab/things-scene").Control[] | undefined;
|
|
150
|
+
findFirst(finder: string | ((c: Component) => boolean), ...others: any[]): Component | undefined;
|
|
151
|
+
findAll(s: string | ((c: Component) => boolean), ...others: any[]): any[] | undefined;
|
|
152
|
+
capture(x: number, y: number, except?: (c: Component) => boolean): any;
|
|
153
|
+
findAnchor(name: string): any;
|
|
154
|
+
isDescendible(container: Component): boolean;
|
|
155
|
+
getContext(component?: unknown): any;
|
|
156
|
+
get root(): Component;
|
|
157
|
+
get rootModel(): Component;
|
|
158
|
+
get parent(): Component;
|
|
159
|
+
set parent(v: Component): any;
|
|
160
|
+
get anchors(): import("@hatiolab/things-scene").Anchor[];
|
|
161
|
+
get scalable(): boolean;
|
|
162
|
+
get stuck(): boolean;
|
|
163
|
+
get capturable(): boolean;
|
|
164
|
+
get position(): string;
|
|
165
|
+
get origin(): string;
|
|
166
|
+
get offset(): import("@hatiolab/things-scene").POINT;
|
|
167
|
+
get app(): import("@hatiolab/things-scene").ApplicationContext;
|
|
168
|
+
drawEffect(context: import("@hatiolab/things-scene").SceneRenderContext): void;
|
|
169
|
+
prepareFill(resolve: Function, reject: Function): void;
|
|
170
|
+
prepareFillIf(condition: boolean): void;
|
|
171
|
+
onchangeFill(after: Record<string, any>, before: Record<string, any>): void;
|
|
172
|
+
drawImage(context: import("@hatiolab/things-scene").SceneRenderContext, image: HTMLImageElement, left: number, top: number, width: number, height: number): void;
|
|
173
|
+
mutateBounds(logic: ((bounds: import("@hatiolab/things-scene").BOUNDS) => import("@hatiolab/things-scene").BOUNDS | void) | null, context?: any): void;
|
|
174
|
+
mutatePath(beforeLogic: ((path: import("@hatiolab/things-scene").POINT[]) => import("@hatiolab/things-scene").POINT[] | void) | null, afterLogic: ((path: import("@hatiolab/things-scene").POINT[]) => import("@hatiolab/things-scene").POINT[] | void) | null, context?: any): void;
|
|
175
|
+
access(accessor: string): any;
|
|
176
|
+
substitute(template: string, data: any): string | undefined;
|
|
177
|
+
onchangeMappings(after: Record<string, any>, before: Record<string, any>): void;
|
|
178
|
+
onchangeData(after: Record<string, any>, before: Record<string, any>): void;
|
|
179
|
+
buildMappings(): void;
|
|
180
|
+
executeMappings(force?: boolean): void;
|
|
181
|
+
disposeMappings(): void;
|
|
182
|
+
ondropfile(transfered: FileList, files: string[]): void;
|
|
183
|
+
transcoordS2P(x: number, y: number, rp?: import("@hatiolab/things-scene").POINT): import("@hatiolab/things-scene").POINT;
|
|
184
|
+
transcoordP2S(x: number, y: number, rp?: import("@hatiolab/things-scene").POINT): import("@hatiolab/things-scene").POINT;
|
|
185
|
+
transcoordS2T(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
186
|
+
transcoordT2P(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
187
|
+
transcoordT2S(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
188
|
+
transcoordS2TR(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
189
|
+
transcoordS2O(x: number, y: number, target: Component): import("@hatiolab/things-scene").POINT;
|
|
190
|
+
transcoordC2S(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
191
|
+
transcoordS2C(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
192
|
+
toParent(x: number, y: number, rp?: import("@hatiolab/things-scene").POINT): import("@hatiolab/things-scene").POINT;
|
|
193
|
+
fromParent(x: number, y: number, rp?: import("@hatiolab/things-scene").POINT): import("@hatiolab/things-scene").POINT;
|
|
194
|
+
toScene(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
195
|
+
fromScene(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
196
|
+
toLocal(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
197
|
+
toGlobal(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
198
|
+
toOther(x: number, y: number, target: Component): import("@hatiolab/things-scene").POINT;
|
|
199
|
+
on(name: string | object, callback: Function, context?: any): any;
|
|
200
|
+
off(name?: string | object, callback?: Function, context?: any): any;
|
|
201
|
+
once(name: string | object, callback: Function, context?: any): any;
|
|
202
|
+
trigger(name: string, ...args: any[]): any;
|
|
203
|
+
delegate_on(delegator: any): any;
|
|
204
|
+
delegate_off(delegator: any): any;
|
|
205
|
+
onchange(after: Record<string, any>, before: Record<string, any>): void;
|
|
206
|
+
calculateBounds?(): void;
|
|
207
|
+
oncreate_element?(element: HTMLElement): void;
|
|
208
|
+
removeComponent(component: Component, ghost?: boolean): void;
|
|
209
|
+
addComponent(component: Component, ghost?: boolean): void;
|
|
210
|
+
insertComponentAt(component: Component, index: number, ghost?: boolean): void;
|
|
211
|
+
getOverlay(component: Component): HTMLElement | undefined;
|
|
212
|
+
findById(id: string): Component | undefined;
|
|
213
|
+
findByRefid(ref: string | number): Component | undefined;
|
|
214
|
+
findAllById(id: string): Component[];
|
|
215
|
+
resize(): void;
|
|
216
|
+
fit(type?: string): void;
|
|
217
|
+
get components(): Component[] | undefined;
|
|
218
|
+
get layout(): any;
|
|
219
|
+
get auxOverlay(): HTMLElement | undefined;
|
|
220
|
+
get isReady(): boolean;
|
|
221
|
+
get unitScale(): number;
|
|
222
|
+
get selected(): Component[];
|
|
223
|
+
set selected(_v: Component[]): any;
|
|
224
|
+
get focused(): Component | null;
|
|
225
|
+
set focused(_v: Component | null): any;
|
|
226
|
+
get hasSameParentForAllSelected(): boolean;
|
|
227
|
+
set hasSameParentForAllSelected(_v: boolean): any;
|
|
228
|
+
get fitMode(): string | undefined;
|
|
229
|
+
set fitMode(_v: string | undefined): any;
|
|
230
|
+
get element(): HTMLElement | null;
|
|
231
|
+
set element(_v: HTMLElement | null): any;
|
|
232
|
+
}) & (new (...args: any[]) => {
|
|
233
|
+
contains(x: number, y: number): boolean;
|
|
234
|
+
get path(): {
|
|
235
|
+
x: any;
|
|
236
|
+
y: any;
|
|
237
|
+
}[];
|
|
238
|
+
set path(path: {
|
|
239
|
+
x: any;
|
|
240
|
+
y: any;
|
|
241
|
+
}[]): any;
|
|
242
|
+
get anchors(): {
|
|
243
|
+
name: string;
|
|
244
|
+
position: {
|
|
245
|
+
x: any;
|
|
246
|
+
y: any;
|
|
247
|
+
};
|
|
248
|
+
}[];
|
|
249
|
+
get bounds(): any;
|
|
250
|
+
set bounds(bounds: any): any;
|
|
251
|
+
render(ctx: CanvasRenderingContext2D): void;
|
|
252
|
+
_app: any;
|
|
253
|
+
_model: any;
|
|
254
|
+
_state: any;
|
|
255
|
+
_delta: any;
|
|
256
|
+
_animation: any;
|
|
257
|
+
_animate: any;
|
|
258
|
+
_parent: any;
|
|
259
|
+
_disposed: any;
|
|
260
|
+
_textHidden: any;
|
|
261
|
+
_text_substitutor: any;
|
|
262
|
+
_value_substitutor: any;
|
|
263
|
+
_mappings: any;
|
|
264
|
+
_realObject: import("@hatiolab/things-scene").IRealObject | undefined;
|
|
265
|
+
_cachedState: any;
|
|
266
|
+
updatedAt: any;
|
|
267
|
+
fontSize: any;
|
|
268
|
+
__cache__: any;
|
|
269
|
+
created(): void;
|
|
270
|
+
added(parent: any): void;
|
|
271
|
+
removed(parent: any): void;
|
|
272
|
+
ready(): Promise<void>;
|
|
273
|
+
touch(): void;
|
|
274
|
+
clearCache(...attrs: any[]): void;
|
|
275
|
+
removeSelf(completely: any): void;
|
|
276
|
+
resetAnimation(): void;
|
|
277
|
+
dispose(): void;
|
|
278
|
+
get nature(): import("@hatiolab/things-scene").ComponentNature;
|
|
279
|
+
get disposed(): boolean;
|
|
280
|
+
isLayer(): boolean;
|
|
281
|
+
isGroup(): boolean;
|
|
282
|
+
isContainer(): this is import("@hatiolab/things-scene/dist-types/types/component").Container;
|
|
283
|
+
isLine(): boolean;
|
|
284
|
+
isRoot(): boolean;
|
|
285
|
+
isRootModel(): boolean;
|
|
286
|
+
is3dish(): boolean;
|
|
287
|
+
get is3dMode(): boolean;
|
|
288
|
+
isIn3DSpace(): boolean;
|
|
289
|
+
isTemplate(): boolean;
|
|
290
|
+
isHTMLElement(): boolean;
|
|
291
|
+
isConnectable(): boolean;
|
|
292
|
+
isIdentifiable(): boolean;
|
|
293
|
+
isPositionable(): boolean;
|
|
294
|
+
replaceRefids(replaceMap: any): void;
|
|
295
|
+
get(property: any): any;
|
|
296
|
+
set(props: any, propval?: any): any;
|
|
297
|
+
getState(property: any): any;
|
|
298
|
+
setState(props: any, propval?: any): any;
|
|
299
|
+
get model(): any;
|
|
300
|
+
get state(): any;
|
|
301
|
+
get hierarchy(): any;
|
|
302
|
+
get volatile(): never[];
|
|
303
|
+
_applyProps(target: any, props: any, options: any): any;
|
|
304
|
+
move(offset: {
|
|
305
|
+
x: number;
|
|
306
|
+
y: number;
|
|
307
|
+
}, ...args: boolean[]): void;
|
|
308
|
+
symmetryX(x?: number): void;
|
|
309
|
+
symmetryY(y: number): void;
|
|
310
|
+
adjustResize(bounds: import("@hatiolab/things-scene").BOUNDS, origin_bounds: import("@hatiolab/things-scene").BOUNDS, diagonal: boolean): {
|
|
311
|
+
left: any;
|
|
312
|
+
top: any;
|
|
313
|
+
width: any;
|
|
314
|
+
height: any;
|
|
315
|
+
};
|
|
316
|
+
adjustRotation(rotation: number, step: boolean): number;
|
|
317
|
+
outline(progress: number): any;
|
|
318
|
+
get center(): import("@hatiolab/things-scene").POINT;
|
|
319
|
+
set center(p: import("@hatiolab/things-scene").POINT): any;
|
|
320
|
+
get location(): import("@hatiolab/things-scene").POINT;
|
|
321
|
+
set location(l: import("@hatiolab/things-scene").POINT): any;
|
|
322
|
+
get rotate(): import("@hatiolab/things-scene").POINT;
|
|
323
|
+
set rotate(r: import("@hatiolab/things-scene").POINT): any;
|
|
324
|
+
get dimension(): import("@hatiolab/things-scene").DIMENSION;
|
|
325
|
+
set dimension(d: import("@hatiolab/things-scene").DIMENSION): any;
|
|
326
|
+
get drawPath(): import("@hatiolab/things-scene").POINT[];
|
|
327
|
+
get rotatePoint(): import("@hatiolab/things-scene").POINT;
|
|
328
|
+
get mutable(): boolean;
|
|
329
|
+
get resizable(): boolean;
|
|
330
|
+
get rotatable(): boolean;
|
|
331
|
+
buildRealObject(): import("@hatiolab/things-scene").IRealObject | undefined;
|
|
332
|
+
get realObject(): import("@hatiolab/things-scene").IRealObject | undefined;
|
|
333
|
+
draw(context?: import("@hatiolab/things-scene").SceneRenderContext): void;
|
|
334
|
+
prerender(context: import("@hatiolab/things-scene").SceneRenderContext): void;
|
|
335
|
+
postrender(context: import("@hatiolab/things-scene").SceneRenderContext): void;
|
|
336
|
+
prepare(resolve: (component: Component) => void, reject: (reason: any) => void): void;
|
|
337
|
+
prepareIf(condition: boolean): void;
|
|
338
|
+
drawText(context: import("@hatiolab/things-scene").SceneRenderContext): void;
|
|
339
|
+
drawStroke(context: import("@hatiolab/things-scene").SceneRenderContext, override?: Record<string, unknown>): void;
|
|
340
|
+
drawFill(context: import("@hatiolab/things-scene").SceneRenderContext, override?: Record<string, unknown>): void;
|
|
341
|
+
get strokeStyle(): any;
|
|
342
|
+
set strokeStyle(v: any): any;
|
|
343
|
+
get fillStyle(): any;
|
|
344
|
+
set fillStyle(v: any): any;
|
|
345
|
+
get fontColor(): string;
|
|
346
|
+
set fontColor(v: string): any;
|
|
347
|
+
get rotation(): number;
|
|
348
|
+
set rotation(v: number): any;
|
|
349
|
+
get decorators(): string[];
|
|
350
|
+
get decotag(): string;
|
|
351
|
+
get hidden(): boolean;
|
|
352
|
+
set hidden(v: boolean): any;
|
|
353
|
+
get tag(): string;
|
|
354
|
+
set tag(v: string): any;
|
|
355
|
+
get appendum(): any;
|
|
356
|
+
set appendum(v: any): any;
|
|
357
|
+
defaultTextSubstitutor(): string;
|
|
358
|
+
textLines(context?: import("@hatiolab/things-scene").SceneRenderContext): any[][];
|
|
359
|
+
get font(): string;
|
|
360
|
+
get lineHeight(): number;
|
|
361
|
+
get textSubstitutor(): () => string;
|
|
362
|
+
get text(): string;
|
|
363
|
+
set text(v: string): any;
|
|
364
|
+
get textBounds(): import("@hatiolab/things-scene").BOUNDS;
|
|
365
|
+
get textRotation(): number;
|
|
366
|
+
get textHidden(): boolean;
|
|
367
|
+
set textHidden(v: boolean): any;
|
|
368
|
+
get hasTextProperty(): boolean;
|
|
369
|
+
animate(opts: import("@hatiolab/things-scene").AnimationConfig): any;
|
|
370
|
+
effect(context: import("@hatiolab/things-scene").SceneRenderContext, model: any): void;
|
|
371
|
+
serialize(...others: any[]): string;
|
|
372
|
+
trim(): void;
|
|
373
|
+
closeScene(data: any): void;
|
|
374
|
+
delta(attr?: string | object, value?: any): any;
|
|
375
|
+
invalidate(): void;
|
|
376
|
+
get value(): any;
|
|
377
|
+
set value(v: any): any;
|
|
378
|
+
get data(): any;
|
|
379
|
+
set data(v: any): any;
|
|
380
|
+
set tap(v: any): any;
|
|
381
|
+
get mappings(): any[];
|
|
382
|
+
get retention(): number;
|
|
383
|
+
get animation(): import("@hatiolab/things-scene").AnimationController | undefined;
|
|
384
|
+
get started(): boolean;
|
|
385
|
+
set started(v: boolean): any;
|
|
386
|
+
get controls(): import("@hatiolab/things-scene").Control[] | undefined;
|
|
387
|
+
findFirst(finder: string | ((c: Component) => boolean), ...others: any[]): Component | undefined;
|
|
388
|
+
findAll(s: string | ((c: Component) => boolean), ...others: any[]): any[] | undefined;
|
|
389
|
+
capture(x: number, y: number, except?: (c: Component) => boolean): any;
|
|
390
|
+
findAnchor(name: string): any;
|
|
391
|
+
isDescendible(container: Component): boolean;
|
|
392
|
+
getContext(component?: unknown): any;
|
|
393
|
+
get root(): Component;
|
|
394
|
+
get rootModel(): Component;
|
|
395
|
+
get parent(): Component;
|
|
396
|
+
set parent(v: Component): any;
|
|
397
|
+
get scalable(): boolean;
|
|
398
|
+
get stuck(): boolean;
|
|
399
|
+
get capturable(): boolean;
|
|
400
|
+
get position(): string;
|
|
401
|
+
get origin(): string;
|
|
402
|
+
get offset(): import("@hatiolab/things-scene").POINT;
|
|
403
|
+
get app(): import("@hatiolab/things-scene").ApplicationContext;
|
|
404
|
+
drawEffect(context: import("@hatiolab/things-scene").SceneRenderContext): void;
|
|
405
|
+
prepareFill(resolve: Function, reject: Function): void;
|
|
406
|
+
prepareFillIf(condition: boolean): void;
|
|
407
|
+
onchangeFill(after: Record<string, any>, before: Record<string, any>): void;
|
|
408
|
+
drawImage(context: import("@hatiolab/things-scene").SceneRenderContext, image: HTMLImageElement, left: number, top: number, width: number, height: number): void;
|
|
409
|
+
mutateBounds(logic: ((bounds: import("@hatiolab/things-scene").BOUNDS) => import("@hatiolab/things-scene").BOUNDS | void) | null, context?: any): void;
|
|
410
|
+
mutatePath(beforeLogic: ((path: import("@hatiolab/things-scene").POINT[]) => import("@hatiolab/things-scene").POINT[] | void) | null, afterLogic: ((path: import("@hatiolab/things-scene").POINT[]) => import("@hatiolab/things-scene").POINT[] | void) | null, context?: any): void;
|
|
411
|
+
access(accessor: string): any;
|
|
412
|
+
substitute(template: string, data: any): string | undefined;
|
|
413
|
+
onchangeMappings(after: Record<string, any>, before: Record<string, any>): void;
|
|
414
|
+
onchangeData(after: Record<string, any>, before: Record<string, any>): void;
|
|
415
|
+
buildMappings(): void;
|
|
416
|
+
executeMappings(force?: boolean): void;
|
|
417
|
+
disposeMappings(): void;
|
|
418
|
+
ondropfile(transfered: FileList, files: string[]): void;
|
|
419
|
+
transcoordS2P(x: number, y: number, rp?: import("@hatiolab/things-scene").POINT): import("@hatiolab/things-scene").POINT;
|
|
420
|
+
transcoordP2S(x: number, y: number, rp?: import("@hatiolab/things-scene").POINT): import("@hatiolab/things-scene").POINT;
|
|
421
|
+
transcoordS2T(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
422
|
+
transcoordT2P(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
423
|
+
transcoordT2S(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
424
|
+
transcoordS2TR(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
425
|
+
transcoordS2O(x: number, y: number, target: Component): import("@hatiolab/things-scene").POINT;
|
|
426
|
+
transcoordC2S(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
427
|
+
transcoordS2C(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
428
|
+
toParent(x: number, y: number, rp?: import("@hatiolab/things-scene").POINT): import("@hatiolab/things-scene").POINT;
|
|
429
|
+
fromParent(x: number, y: number, rp?: import("@hatiolab/things-scene").POINT): import("@hatiolab/things-scene").POINT;
|
|
430
|
+
toScene(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
431
|
+
fromScene(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
432
|
+
toLocal(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
433
|
+
toGlobal(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
434
|
+
toOther(x: number, y: number, target: Component): import("@hatiolab/things-scene").POINT;
|
|
435
|
+
on(name: string | object, callback: Function, context?: any): any;
|
|
436
|
+
off(name?: string | object, callback?: Function, context?: any): any;
|
|
437
|
+
once(name: string | object, callback: Function, context?: any): any;
|
|
438
|
+
trigger(name: string, ...args: any[]): any;
|
|
439
|
+
delegate_on(delegator: any): any;
|
|
440
|
+
delegate_off(delegator: any): any;
|
|
441
|
+
onchange(after: Record<string, any>, before: Record<string, any>): void;
|
|
442
|
+
calculateBounds?(): void;
|
|
443
|
+
oncreate_element?(element: HTMLElement): void;
|
|
444
|
+
removeComponent(component: Component, ghost?: boolean): void;
|
|
445
|
+
addComponent(component: Component, ghost?: boolean): void;
|
|
446
|
+
insertComponentAt(component: Component, index: number, ghost?: boolean): void;
|
|
447
|
+
getOverlay(component: Component): HTMLElement | undefined;
|
|
448
|
+
findById(id: string): Component | undefined;
|
|
449
|
+
findByRefid(ref: string | number): Component | undefined;
|
|
450
|
+
findAllById(id: string): Component[];
|
|
451
|
+
resize(): void;
|
|
452
|
+
fit(type?: string): void;
|
|
453
|
+
get components(): Component[] | undefined;
|
|
454
|
+
get layout(): any;
|
|
455
|
+
get auxOverlay(): HTMLElement | undefined;
|
|
456
|
+
get isReady(): boolean;
|
|
457
|
+
get unitScale(): number;
|
|
458
|
+
get selected(): Component[];
|
|
459
|
+
set selected(_v: Component[]): any;
|
|
460
|
+
get focused(): Component | null;
|
|
461
|
+
set focused(_v: Component | null): any;
|
|
462
|
+
get hasSameParentForAllSelected(): boolean;
|
|
463
|
+
set hasSameParentForAllSelected(_v: boolean): any;
|
|
464
|
+
get fitMode(): string | undefined;
|
|
465
|
+
set fitMode(_v: string | undefined): any;
|
|
466
|
+
get element(): HTMLElement | null;
|
|
467
|
+
set element(_v: HTMLElement | null): any;
|
|
7
468
|
}) & typeof Shape;
|
|
8
469
|
export default class Rect extends Rect_base {
|
|
9
470
|
is3dish(): boolean;
|
package/dist/star.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"star.js","sourceRoot":"","sources":["../src/star.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,EAAE,SAAS,EAAmB,OAAO,EAAY,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAEtG,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,OAAO;YACd,IAAI,EAAE,OAAO;YACb,QAAQ,EAAE,OAAO;SAClB;QACD;YACE,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,MAAM;YACb,IAAI,EAAE,MA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AG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,EACjF,CAAC,CAAC,EAAE,GAAG,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAClF,CAAA;QACH,CAAC;QACD,gBAAgB;QAChB,GAAG,CAAC,SAAS,EAAE,CAAA;QACf,GAAG,CAAC,OAAO,EAAE,CAAA;IACf,CAAC;IAED,IAAI,QAAQ;QACV,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC,KAAK,CAAA;QAEtC,OAAO;YACL;gBACE,CAAC,EAAE,EAAE;gBACL,CAAC,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,KAAK,GAAG,GAAG,CAAC;gBAC/B,OAAO,EAAE,cAAc;aACxB;SACF,CAAA;IACH,CAAC;IAED,IAAI,MAAM;QACR,OAAO,MAAM,CAAA;IACf,CAAC;CACF,CAAA;AAxDoB,IAAI;IADxB,cAAc,CAAC,MAAM,CAAC;GACF,IAAI,CAwDxB;eAxDoB,IAAI;AA0DzB,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,UAAU,EAAE,KAAK,CAAC,CAAA","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport { Component, ComponentNature, Ellipse, POSITION, sceneComponent } 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: 'ratio',\n name: 'ratio',\n property: 'ratio'\n },\n {\n type: 'number',\n label: 'wing',\n name: 'wing',\n property: 'wing'\n }\n ],\n help: 'scene/component/star'\n}\n\nvar controlHandler = {\n ondragmove: function (point: POSITION, index: number, component: Component) {\n var controls = component.controls\n var { cy, ry } = component.model\n\n var transcoorded = component.transcoordP2S(point.x, point.y)\n\n var ratio = ((transcoorded.y - cy) / ry) * 100 + 100\n\n if (ratio >= 100) ratio = 100\n else if (ratio <= 0) ratio = 0\n\n component.set({ ratio }) // ratio: ratio => ratio\n }\n}\n\n@sceneComponent('star')\nexport default class Star extends Ellipse {\n is3dish() {\n return false\n }\n\n render(ctx: CanvasRenderingContext2D) {\n var { ratio = 30, wing = 5, cx, cy, rx, ry, startAngle, endAngle, anticlockwise } = this.state\n\n // 박스 그리기\n\n if (wing < 3) return\n\n const RADIAN = 1.5707963267948966 // 90도 뒤틀기\n var a = (Math.PI * 2) / wing\n var xRatio = rx - (ratio / 100) * rx\n var yRatio = ry - (ratio / 100) * ry\n\n ctx.save()\n ctx.beginPath()\n\n ctx.translate(cx, cy)\n\n ctx.moveTo(rx * Math.cos(-RADIAN), ry * Math.sin(-RADIAN))\n ctx.lineTo(\n ((rx - xRatio) * (Math.cos(a - RADIAN) + Math.cos(0 - RADIAN))) / 2,\n ((ry - yRatio) * (Math.sin(a - RADIAN) + Math.sin(0 - RADIAN))) / 2\n )\n\n for (var i = 1; i < wing; i++) {\n ctx.lineTo(rx * Math.cos(a * i - RADIAN), ry * Math.sin(a * i - RADIAN))\n\n ctx.lineTo(\n ((rx - xRatio) * (Math.cos(a * (i + 1) - RADIAN) + Math.cos(a * i - RADIAN))) / 2,\n ((ry - yRatio) * (Math.sin(a * (i + 1) - RADIAN) + Math.sin(a * i - RADIAN))) / 2\n )\n }\n // ratio /= 1.5;\n ctx.closePath()\n ctx.restore()\n }\n\n get controls() {\n var { cx, cy, ry, ratio } = this.state\n\n return [\n {\n x: cx,\n y: cy - ry + ry * (ratio / 100),\n handler: controlHandler\n }\n ]\n }\n\n get nature() {\n return NATURE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AAO,EAAE,cAAc;aACxB;SACF,CAAA;IACH,CAAC;IAED,IAAI,MAAM;QACR,OAAO,MAAM,CAAA;IACf,CAAC;CACF,CAAA;AAxDoB,IAAI;IADxB,cAAc,CAAC,MAAM,CAAC;GACF,IAAI,CAwDxB;eAxDoB,IAAI;AA0DzB,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,UAAU,EAAE,KAAK,CAAC,CAAA","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport { Component, ComponentNature, Ellipse, POSITION, sceneComponent } 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: 'ratio',\n name: 'ratio',\n property: 'ratio'\n },\n {\n type: 'number',\n label: 'wing',\n name: 'wing',\n property: 'wing'\n }\n ],\n help: 'scene/component/star'\n}\n\nvar controlHandler = {\n ondragmove: function (point: POSITION, index: number, component: Component) {\n var controls = component.controls\n var { cy, ry } = component.model\n\n var transcoorded = component.transcoordP2S(point.x, point.y)\n\n var ratio = ((transcoorded.y - cy) / ry) * 100 + 100\n\n if (ratio >= 100) ratio = 100\n else if (ratio <= 0) ratio = 0\n\n component.set({ ratio }) // ratio: ratio => ratio\n }\n}\n\n@sceneComponent('star')\nexport default class Star extends Ellipse {\n is3dish() {\n return false\n }\n\n render(ctx: CanvasRenderingContext2D) {\n var { ratio = 30, wing = 5, cx, cy, rx, ry, startAngle, endAngle, anticlockwise } = this.state\n\n // 박스 그리기\n\n if (wing < 3) return\n\n const RADIAN = 1.5707963267948966 // 90도 뒤틀기\n var a = (Math.PI * 2) / wing\n var xRatio = rx - (ratio / 100) * rx\n var yRatio = ry - (ratio / 100) * ry\n\n ctx.save()\n ctx.beginPath()\n\n ctx.translate(cx, cy)\n\n ctx.moveTo(rx * Math.cos(-RADIAN), ry * Math.sin(-RADIAN))\n ctx.lineTo(\n ((rx - xRatio) * (Math.cos(a - RADIAN) + Math.cos(0 - RADIAN))) / 2,\n ((ry - yRatio) * (Math.sin(a - RADIAN) + Math.sin(0 - RADIAN))) / 2\n )\n\n for (var i = 1; i < wing; i++) {\n ctx.lineTo(rx * Math.cos(a * i - RADIAN), ry * Math.sin(a * i - RADIAN))\n\n ctx.lineTo(\n ((rx - xRatio) * (Math.cos(a * (i + 1) - RADIAN) + Math.cos(a * i - RADIAN))) / 2,\n ((ry - yRatio) * (Math.sin(a * (i + 1) - RADIAN) + Math.sin(a * i - RADIAN))) / 2\n )\n }\n // ratio /= 1.5;\n ctx.closePath()\n ctx.restore()\n }\n\n get controls() {\n var { cx, cy, ry, ratio } = this.state\n\n return [\n {\n x: cx,\n y: cy - ry + ry * (ratio / 100),\n handler: controlHandler\n }\n ]\n }\n\n get nature(): ComponentNature {\n return NATURE\n }\n}\n\nComponent.memoize(Star.prototype, 'controls', false)\n"]}
|