@operato/scene-basic 9.1.1 → 10.0.0-beta.14
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/donut.d.ts +0 -1
- package/dist/donut.js +0 -3
- package/dist/donut.js.map +1 -1
- package/dist/ellipse.d.ts +229 -5
- package/dist/ellipse.js +0 -3
- 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/polygon.d.ts +0 -1
- package/dist/polygon.js +0 -3
- package/dist/polygon.js.map +1 -1
- package/dist/polyline.js +2 -3
- package/dist/polyline.js.map +1 -1
- package/dist/rect.d.ts +465 -5
- package/dist/rect.js +0 -3
- package/dist/rect.js.map +1 -1
- package/dist/star.d.ts +0 -1
- package/dist/star.js +0 -3
- package/dist/star.js.map +1 -1
- package/dist/text.d.ts +237 -2
- package/dist/text.js +0 -3
- package/dist/text.js.map +1 -1
- package/package.json +13 -13
package/dist/ellipse.d.ts
CHANGED
|
@@ -1,12 +1,236 @@
|
|
|
1
1
|
import { Anchor, Component, ComponentNature, Shape } from '@hatiolab/things-scene';
|
|
2
2
|
declare const Ellipse_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.js").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;
|
|
7
232
|
}) & typeof Shape;
|
|
8
233
|
export default class Ellipse extends Ellipse_base {
|
|
9
|
-
is3dish(): boolean;
|
|
10
234
|
render(context: CanvasRenderingContext2D): void;
|
|
11
235
|
get path(): {
|
|
12
236
|
x: any;
|
package/dist/ellipse.js
CHANGED
|
@@ -13,9 +13,6 @@ const NATURE = {
|
|
|
13
13
|
'value-property': 'text'
|
|
14
14
|
};
|
|
15
15
|
let Ellipse = class Ellipse extends Connectable(Shape) {
|
|
16
|
-
is3dish() {
|
|
17
|
-
return true;
|
|
18
|
-
}
|
|
19
16
|
render(context) {
|
|
20
17
|
var { cx, cy, rx, ry, startAngle, endAngle, anticlockwise } = this.state;
|
|
21
18
|
context.beginPath();
|
package/dist/ellipse.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ellipse.js","sourceRoot":"","sources":["../src/ellipse.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,EAAU,SAAS,EAAmB,WAAW,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAE/G,OAAO,cAAc,MAAM,8BAA8B,CAAA;AACzD,OAAO,cAAc,MAAM,8BAA8B,CAAA;AAEzD,MAAM,MAAM,GAAoB;IAC9B,OAAO,EAAE,KAAK;IACd,SAAS,EAAE,IAAI;IACf,SAAS,EAAE,IAAI;IACf,UAAU,EAAE,EAAE;IACd,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AO,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,IAAI,CAAA;IAC7C,CAAC;IAED,OAAO,CAAC,QAAgB;QACtB,OAAO,cAAc,CAAC,IAAW,EAAE,QAAQ,CAAC,CAAA;IAC9C,CAAC;IAED,IAAI,OAAO;QACT,OAAO,cAAc,CAAC,IAAW,CAAC,CAAA;IACpC,CAAC;IAED,IAAI,MAAM;QACR,OAAO,MAAM,CAAA;IACf,CAAC;CACF,CAAA;AAhEoB,OAAO;IAD3B,cAAc,CAAC,SAAS,CAAC;GACL,OAAO,CAgE3B;eAhEoB,OAAO;AAkE5B,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,CAAC,CAAA","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport { Anchor, Component, ComponentNature, Connectable, Shape, sceneComponent } from '@hatiolab/things-scene'\n\nimport ellipseAnchors from './anchors/ellipse-anchors.js'\nimport ellipseOutline from './outline/ellipse-outline.js'\n\nconst NATURE: ComponentNature = {\n mutable: false,\n resizable: true,\n rotatable: true,\n properties: [],\n 'value-property': 'text'\n}\n\n@sceneComponent('ellipse')\nexport default class Ellipse extends Connectable(Shape) {\n render(context: CanvasRenderingContext2D) {\n var { cx, cy, rx, ry, startAngle, endAngle, anticlockwise } = this.state\n\n context.beginPath()\n\n context.ellipse(cx, cy, Math.abs(rx), Math.abs(ry), 0, startAngle || 0, endAngle || 2 * Math.PI, anticlockwise)\n }\n\n get path() {\n var { cx, cy, rx, ry } = this.state\n\n return [\n {\n x: cx - rx,\n y: cy - ry\n },\n {\n x: cx + rx,\n y: cy - ry\n },\n {\n x: cx + rx,\n y: cy + ry\n },\n {\n x: cx - rx,\n y: cy + ry\n }\n ]\n }\n\n set path(path) {\n var left_top = path[0]\n var right_bottom = path[2]\n\n this.set({\n cx: left_top.x + (right_bottom.x - left_top.x) / 2,\n cy: left_top.y + (right_bottom.y - left_top.y) / 2,\n rx: (right_bottom.x - left_top.x) / 2,\n ry: (right_bottom.y - left_top.y) / 2\n })\n }\n\n contains(x: number, y: number) {\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 outline(progress: number) {\n return ellipseOutline(this as any, progress)\n }\n\n get anchors(): Array<Anchor> {\n return ellipseAnchors(this as any)\n }\n\n get nature() {\n return NATURE\n }\n}\n\nComponent.memoize(Ellipse.prototype, 'path', false)\n"]}
|
package/dist/gif-view.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export default class GifView extends HTMLOverlayElement {
|
|
|
8
8
|
setElementProperties(div: HTMLDivElement): void;
|
|
9
9
|
onchangeplay(play: boolean): void;
|
|
10
10
|
onchangesrc(src: string): void;
|
|
11
|
-
ondropfile(transfered:
|
|
11
|
+
ondropfile(transfered: FileList, files: string[]): void;
|
|
12
12
|
get src(): any;
|
|
13
13
|
set src(src: any);
|
|
14
14
|
get play(): any;
|
package/dist/gif-view.js
CHANGED
|
@@ -25,6 +25,7 @@ const NATURE = {
|
|
|
25
25
|
};
|
|
26
26
|
const NOIMAGE_DATA_URI = 'data:image/gif;base64,R0lGODlhYABIAPcAAAAAAAEBAQICAgMDAwQEBAUFBQYGBgcHBwgICAkJCQoKCgsLCwwMDA0NDQ4ODg8PDxAQEBERERISEhMTExQUFBUVFRYWFhcXFxgYGBkZGRoaGhsbGxwcHB0dHR4eHh8fHyAgICEhISIiIiMjIyQkJCUlJSYmJicnJygoKCkpKSoqKisrKywsLC0tLS4uLi8vLzAwMDExMTIyMjMzMzQ0NDU1NTY2Njc3Nzg4ODk5OTo6Ojs7Ozw8PD09PT4+Pj8/P0BAQEFBQUJCQkNDQ0REREVFRUZGRkdHR0hISElJSUpKSktLS0xMTE1NTU5OTk9PT1BQUFFRUVJSUlNTU1RUVFVVVVZWVldXV1hYWFlZWVpaWltbW1xcXF1dXV5eXl9fX2BgYGFhYWJiYmNjY2RkZGVlZWZmZmdnZ2hoaGlpaWpqamtra2xsbG1tbW5ubm9vb3BwcHFxcXJycnNzc3R0dHV1dXZ2dnd3d3h4eHl5eXp6ent7e3x8fH19fX5+fn9/f4CAgIGBgYKCgoODg4SEhIWFhYaGhoeHh4iIiImJiYqKio+Pj5iYmKCgoKampqurq66urrCwsLGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrOzs7S0tLa2tre3t7m5ubu7u7+/v8DAwMHBwcPDw8XFxcfHx8vLy8/Pz9LS0tXV1dfX193d3eTk5Onp6fj4+Pz8/P7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v///////////////////////////////////////////////////////////////////////////////yH5BAkAAPUAIf47R2VuZXJhdGVkIGJ5IGpzZ2lmIChodHRwczovL2dpdGh1Yi5jb20vYW50aW1hdHRlcjE1L2pzZ2lmLykALAAAAABgAEgAAAj+AGcJHEiwoMGDCBMqXMiwocOHECNKnEixosWLGDNq3Mixo8ePIEOKHEmypMmR9VKqXMmypcuXMGPKnJkSIs2bOHPqZGlzp8+fQOv1DEq0KMyhRpMmRaq0KVCmTqPmhCq1qkyqLrFRSyYwGTVsVo1iZXmNa8Fk18ISHasSm1mDycCq/ck2JTWF1ObSfTjz7cFken3WFbow8M7BDA3rHOwXruKpfGXeTZg3qDVrUge7RRg3KLZjx+Q2HVyvLNy0QaMJjBaVdD2tZr2K/mmNIObRkR+n9AsYt0Pddg1WXppb8bWDx1CLLW74GcJnSl3TtDY8Zu2Et4tKl7n52eyWnxXvhl7+26jqrspbnlfIWjtz2gWPZV95neH8veU9NxZYfbfD3kFt99J6Bnmn0mQO9XfYezrVxxlmx0GUXIAM4hSeffsxBN1TFd5E4Ef3QZbfTg6CNJ5gHXJ3TEntLThiTh+KFCJNAqZU4kgAitjQTheepOBMNcZI0oQ6JpbTjSZtiNN2PZ400IxHpdiSc07G911M0iFZZYtAStnWilUeBGVLrlEZpmM0elmPlmfO8iOZXl4DZpsGEYmll2bSWWCXLwJXVY1+urhjoGEBSuiSah6K36CKtpZoo4s9CimielZq6aWYZqrpppx26umnoIZ6UkAAOw==';
|
|
27
27
|
let GifView = class GifView extends HTMLOverlayElement {
|
|
28
|
+
_superGif;
|
|
28
29
|
async oncreate_element(div) {
|
|
29
30
|
var { src, play } = this.state;
|
|
30
31
|
this.onchangesrc(src);
|
|
@@ -33,6 +34,8 @@ let GifView = class GifView extends HTMLOverlayElement {
|
|
|
33
34
|
buildImg() {
|
|
34
35
|
/* clear first */
|
|
35
36
|
var div = this.element;
|
|
37
|
+
if (!div)
|
|
38
|
+
return document.createElement('img');
|
|
36
39
|
div.innerHTML = '';
|
|
37
40
|
var gif = document.createElement('img');
|
|
38
41
|
gif.style.width = '100%';
|
|
@@ -68,7 +71,6 @@ let GifView = class GifView extends HTMLOverlayElement {
|
|
|
68
71
|
this._superGif = new SuperGif(gif, {
|
|
69
72
|
autoPlay: false /* Without this setting, the first play's framerate is too fast. */
|
|
70
73
|
});
|
|
71
|
-
//@ts-ignore
|
|
72
74
|
this._superGif.init();
|
|
73
75
|
for (const child of this.element.children) {
|
|
74
76
|
child.style.width = '100%';
|
package/dist/gif-view.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gif-view.js","sourceRoot":"","sources":["../src/gif-view.ts"],"names":[],"mappings":";AAAA;;GAEG;AACH,OAAO,EAGL,kBAAkB,EAIlB,cAAc,EACf,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAE9C,MAAM,MAAM,GAAoB;IAC9B,OAAO,EAAE,KAAK;IACd,S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AI,CAAC,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,CAAA;gBACnB,OAAM;YACR,CAAC;QACH,CAAC;IACH,CAAC;IAED,IAAI,GAAG;QACL,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;IAC7B,CAAC;IAED,IAAI,GAAG,CAAC,GAAG;QACT,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA;IAC3B,CAAC;IAED,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;IAC9B,CAAC;IAED,IAAI,IAAI,CAAC,IAAI;QACX,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;IAC7B,CAAC;IAED,IAAI,MAAM;QACR,OAAO,MAAM,CAAA;IACf,CAAC;IAED,IAAI,OAAO;QACT,OAAO,KAAK,CAAA;IACd,CAAC;CACF,CAAA;AAlHoB,OAAO;IAD3B,cAAc,CAAC,UAAU,CAAC;GACN,OAAO,CAkH3B;eAlHoB,OAAO","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\nimport {\n Component,\n ComponentNature,\n HTMLOverlayElement,\n Properties,\n RectPath,\n Shape,\n sceneComponent\n} from '@hatiolab/things-scene'\nimport { SuperGif } from '@wizpanda/super-gif'\n\nconst NATURE: ComponentNature = {\n mutable: false,\n resizable: true,\n rotatable: true,\n properties: [\n {\n type: 'string',\n label: 'src',\n name: 'src'\n },\n {\n type: 'checkbox',\n label: 'play',\n name: 'play'\n }\n ],\n 'value-property': 'src',\n help: 'scene/component/gif-view'\n}\n\nconst NOIMAGE_DATA_URI =\n 'data:image/gif;base64,R0lGODlhYABIAPcAAAAAAAEBAQICAgMDAwQEBAUFBQYGBgcHBwgICAkJCQoKCgsLCwwMDA0NDQ4ODg8PDxAQEBERERISEhMTExQUFBUVFRYWFhcXFxgYGBkZGRoaGhsbGxwcHB0dHR4eHh8fHyAgICEhISIiIiMjIyQkJCUlJSYmJicnJygoKCkpKSoqKisrKywsLC0tLS4uLi8vLzAwMDExMTIyMjMzMzQ0NDU1NTY2Njc3Nzg4ODk5OTo6Ojs7Ozw8PD09PT4+Pj8/P0BAQEFBQUJCQkNDQ0REREVFRUZGRkdHR0hISElJSUpKSktLS0xMTE1NTU5OTk9PT1BQUFFRUVJSUlNTU1RUVFVVVVZWVldXV1hYWFlZWVpaWltbW1xcXF1dXV5eXl9fX2BgYGFhYWJiYmNjY2RkZGVlZWZmZmdnZ2hoaGlpaWpqamtra2xsbG1tbW5ubm9vb3BwcHFxcXJycnNzc3R0dHV1dXZ2dnd3d3h4eHl5eXp6ent7e3x8fH19fX5+fn9/f4CAgIGBgYKCgoODg4SEhIWFhYaGhoeHh4iIiImJiYqKio+Pj5iYmKCgoKampqurq66urrCwsLGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrOzs7S0tLa2tre3t7m5ubu7u7+/v8DAwMHBwcPDw8XFxcfHx8vLy8/Pz9LS0tXV1dfX193d3eTk5Onp6fj4+Pz8/P7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v///////////////////////////////////////////////////////////////////////////////yH5BAkAAPUAIf47R2VuZXJhdGVkIGJ5IGpzZ2lmIChodHRwczovL2dpdGh1Yi5jb20vYW50aW1hdHRlcjE1L2pzZ2lmLykALAAAAABgAEgAAAj+AGcJHEiwoMGDCBMqXMiwocOHECNKnEixosWLGDNq3Mixo8ePIEOKHEmypMmR9VKqXMmypcuXMGPKnJkSIs2bOHPqZGlzp8+fQOv1DEq0KMyhRpMmRaq0KVCmTqPmhCq1qkyqLrFRSyYwGTVsVo1iZXmNa8Fk18ISHasSm1mDycCq/ck2JTWF1ObSfTjz7cFken3WFbow8M7BDA3rHOwXruKpfGXeTZg3qDVrUge7RRg3KLZjx+Q2HVyvLNy0QaMJjBaVdD2tZr2K/mmNIObRkR+n9AsYt0Pddg1WXppb8bWDx1CLLW74GcJnSl3TtDY8Zu2Et4tKl7n52eyWnxXvhl7+26jqrspbnlfIWjtz2gWPZV95neH8veU9NxZYfbfD3kFt99J6Bnmn0mQO9XfYezrVxxlmx0GUXIAM4hSeffsxBN1TFd5E4Ef3QZbfTg6CNJ5gHXJ3TEntLThiTh+KFCJNAqZU4kgAitjQTheepOBMNcZI0oQ6JpbTjSZtiNN2PZ400IxHpdiSc07G911M0iFZZYtAStnWilUeBGVLrlEZpmM0elmPlmfO8iOZXl4DZpsGEYmll2bSWWCXLwJXVY1+urhjoGEBSuiSah6K36CKtpZoo4s9CimielZq6aWYZqrpppx26umnoIZ6UkAAOw=='\n\n@sceneComponent('gif-view')\nexport default class GifView extends HTMLOverlayElement {\n _superGif?: SuperGif\n\n async oncreate_element(div: HTMLDivElement) {\n var { src, play } = this.state\n\n this.onchangesrc(src)\n this.onchangeplay(play)\n }\n\n buildImg() {\n /* clear first */\n var div = this.element\n if (!div) return document.createElement('img')\n div.innerHTML = ''\n\n var gif = document.createElement('img')\n gif.style.width = '100%'\n gif.style.height = '100%'\n\n div.appendChild(gif)\n\n return gif\n }\n\n onchange(after: Properties, before: Properties) {\n super.onchange(after, before)\n\n 'src' in after && this.onchangesrc(after.src)\n 'play' in after && this.onchangeplay(after.play)\n }\n\n setElementProperties(div: HTMLDivElement) {}\n\n onchangeplay(play: boolean) {\n var superGif = this._superGif\n\n if (!superGif || !superGif.isReady()) {\n return\n }\n\n if (play) {\n superGif.play()\n } else {\n superGif.pause()\n }\n }\n\n onchangesrc(src: string) {\n var gif = this.buildImg()\n\n if (!src) src = NOIMAGE_DATA_URI\n\n gif.src = src\n gif.setAttribute('rel:animated_src', src)\n gif.setAttribute('rel:auto_play', '0')\n\n this._superGif = new SuperGif(gif, {\n autoPlay: false /* Without this setting, the first play's framerate is too fast. */\n })\n ;(this._superGif as any).init()\n\n for (const child of this.element!.children as any) {\n child.style.width = '100%'\n child.style.height = '100%'\n }\n\n var canvas = this._superGif!.getCanvas()\n canvas.style.width = '100%'\n canvas.style.height = '100%'\n\n this._superGif.load(() => {\n this._superGif!.moveTo(0)\n\n /*\n * FIXME. this.play 는 컴포넌트의 getState()를 통해서 가져오게 되는데, 체크박스의 경우 문제가 있는 것 같다.\n * 문제 해결 후 this.get(\"play\") => this.play로 수정할 것.\n */\n this.play && this._superGif!.play()\n })\n }\n\n ondropfile(transfered: FileList, files: string[]) {\n for (let i = 0; i < transfered.length; i++) {\n if (/\\.gif$/.test(transfered[i].name)) {\n this.src = files[i]\n return\n }\n }\n }\n\n get src() {\n return this.getState('src')\n }\n\n set src(src) {\n this.setState('src', src)\n }\n\n get play() {\n return this.getState('play')\n }\n\n set play(play) {\n this.setState('play', play)\n }\n\n get nature() {\n return NATURE\n }\n\n get tagName() {\n return 'div'\n }\n}\n"]}
|
package/dist/image-view.d.ts
CHANGED
|
@@ -1,5 +1,241 @@
|
|
|
1
|
-
import { ComponentNature, Properties, Shape } from '@hatiolab/things-scene';
|
|
2
|
-
declare const ImageView_base:
|
|
1
|
+
import { Component, ComponentNature, Properties, Shape } from '@hatiolab/things-scene';
|
|
2
|
+
declare const ImageView_base: (new (...args: any[]) => {
|
|
3
|
+
contains(x: number, y: number): boolean;
|
|
4
|
+
get path(): {
|
|
5
|
+
x: any;
|
|
6
|
+
y: any;
|
|
7
|
+
}[];
|
|
8
|
+
set path(path: {
|
|
9
|
+
x: any;
|
|
10
|
+
y: any;
|
|
11
|
+
}[]): any;
|
|
12
|
+
get anchors(): {
|
|
13
|
+
name: string;
|
|
14
|
+
position: {
|
|
15
|
+
x: any;
|
|
16
|
+
y: any;
|
|
17
|
+
};
|
|
18
|
+
}[];
|
|
19
|
+
get bounds(): any;
|
|
20
|
+
set bounds(bounds: any): any;
|
|
21
|
+
render(ctx: CanvasRenderingContext2D): void;
|
|
22
|
+
_app: any;
|
|
23
|
+
_model: any;
|
|
24
|
+
_state: any;
|
|
25
|
+
_delta: any;
|
|
26
|
+
_animation: any;
|
|
27
|
+
_animate: any;
|
|
28
|
+
_parent: any;
|
|
29
|
+
_disposed: any;
|
|
30
|
+
_textHidden: any;
|
|
31
|
+
_text_substitutor: any;
|
|
32
|
+
_value_substitutor: any;
|
|
33
|
+
_mappings: any;
|
|
34
|
+
_realObject: import("@hatiolab/things-scene").IRealObject | undefined;
|
|
35
|
+
_cachedState: any;
|
|
36
|
+
updatedAt: any;
|
|
37
|
+
fontSize: any;
|
|
38
|
+
__cache__: any;
|
|
39
|
+
created(): void;
|
|
40
|
+
added(parent: any): void;
|
|
41
|
+
removed(parent: any): void;
|
|
42
|
+
ready(): Promise<void>;
|
|
43
|
+
touch(): void;
|
|
44
|
+
clearCache(...attrs: any[]): void;
|
|
45
|
+
removeSelf(completely: any): void;
|
|
46
|
+
resetAnimation(): void;
|
|
47
|
+
dispose(): void;
|
|
48
|
+
get nature(): import("@hatiolab/things-scene").ComponentNature;
|
|
49
|
+
get disposed(): boolean;
|
|
50
|
+
isLayer(): boolean;
|
|
51
|
+
isGroup(): boolean;
|
|
52
|
+
isContainer(): this is import("@hatiolab/things-scene/dist-types/types/component").Container;
|
|
53
|
+
isLine(): boolean;
|
|
54
|
+
isRoot(): boolean;
|
|
55
|
+
isRootModel(): boolean;
|
|
56
|
+
is3dish(): boolean;
|
|
57
|
+
get is3dMode(): boolean;
|
|
58
|
+
isIn3DSpace(): boolean;
|
|
59
|
+
isTemplate(): boolean;
|
|
60
|
+
isHTMLElement(): boolean;
|
|
61
|
+
isConnectable(): boolean;
|
|
62
|
+
isIdentifiable(): boolean;
|
|
63
|
+
isPositionable(): boolean;
|
|
64
|
+
replaceRefids(replaceMap: any): void;
|
|
65
|
+
get(property: any): any;
|
|
66
|
+
set(props: any, propval?: any): any;
|
|
67
|
+
getState(property: any): any;
|
|
68
|
+
setState(props: any, propval?: any): any;
|
|
69
|
+
get model(): any;
|
|
70
|
+
get state(): any;
|
|
71
|
+
get hierarchy(): any;
|
|
72
|
+
get volatile(): never[];
|
|
73
|
+
_applyProps(target: any, props: any, options: any): any;
|
|
74
|
+
move(offset: {
|
|
75
|
+
x: number;
|
|
76
|
+
y: number;
|
|
77
|
+
}, ...args: boolean[]): void;
|
|
78
|
+
symmetryX(x?: number): void;
|
|
79
|
+
symmetryY(y: number): void;
|
|
80
|
+
adjustResize(bounds: import("@hatiolab/things-scene").BOUNDS, origin_bounds: import("@hatiolab/things-scene").BOUNDS, diagonal: boolean): {
|
|
81
|
+
left: any;
|
|
82
|
+
top: any;
|
|
83
|
+
width: any;
|
|
84
|
+
height: any;
|
|
85
|
+
};
|
|
86
|
+
adjustRotation(rotation: number, step: boolean): number;
|
|
87
|
+
outline(progress: number): any;
|
|
88
|
+
get center(): import("@hatiolab/things-scene").POINT;
|
|
89
|
+
set center(p: import("@hatiolab/things-scene").POINT): any;
|
|
90
|
+
get location(): import("@hatiolab/things-scene").POINT;
|
|
91
|
+
set location(l: import("@hatiolab/things-scene").POINT): any;
|
|
92
|
+
get rotate(): import("@hatiolab/things-scene").POINT;
|
|
93
|
+
set rotate(r: import("@hatiolab/things-scene").POINT): any;
|
|
94
|
+
get dimension(): import("@hatiolab/things-scene").DIMENSION;
|
|
95
|
+
set dimension(d: import("@hatiolab/things-scene").DIMENSION): any;
|
|
96
|
+
get drawPath(): import("@hatiolab/things-scene").POINT[];
|
|
97
|
+
get rotatePoint(): import("@hatiolab/things-scene").POINT;
|
|
98
|
+
get mutable(): boolean;
|
|
99
|
+
get resizable(): boolean;
|
|
100
|
+
get rotatable(): boolean;
|
|
101
|
+
buildRealObject(): import("@hatiolab/things-scene").IRealObject | undefined;
|
|
102
|
+
get realObject(): import("@hatiolab/things-scene").IRealObject | undefined;
|
|
103
|
+
draw(context?: import("@hatiolab/things-scene").SceneRenderContext): void;
|
|
104
|
+
prerender(context: import("@hatiolab/things-scene").SceneRenderContext): void;
|
|
105
|
+
postrender(context: import("@hatiolab/things-scene").SceneRenderContext): void;
|
|
106
|
+
prepare(resolve: (component: Component) => void, reject: (reason: any) => void): void;
|
|
107
|
+
prepareIf(condition: boolean): void;
|
|
108
|
+
drawText(context: import("@hatiolab/things-scene").SceneRenderContext): void;
|
|
109
|
+
drawStroke(context: import("@hatiolab/things-scene").SceneRenderContext, override?: Record<string, unknown>): void;
|
|
110
|
+
drawFill(context: import("@hatiolab/things-scene").SceneRenderContext, override?: Record<string, unknown>): void;
|
|
111
|
+
get strokeStyle(): any;
|
|
112
|
+
set strokeStyle(v: any): any;
|
|
113
|
+
get fillStyle(): any;
|
|
114
|
+
set fillStyle(v: any): any;
|
|
115
|
+
get fontColor(): string;
|
|
116
|
+
set fontColor(v: string): any;
|
|
117
|
+
get rotation(): number;
|
|
118
|
+
set rotation(v: number): any;
|
|
119
|
+
get decorators(): string[];
|
|
120
|
+
get decotag(): string;
|
|
121
|
+
get hidden(): boolean;
|
|
122
|
+
set hidden(v: boolean): any;
|
|
123
|
+
get tag(): string;
|
|
124
|
+
set tag(v: string): any;
|
|
125
|
+
get appendum(): any;
|
|
126
|
+
set appendum(v: any): any;
|
|
127
|
+
defaultTextSubstitutor(): string;
|
|
128
|
+
textLines(context?: import("@hatiolab/things-scene").SceneRenderContext): any[][];
|
|
129
|
+
get font(): string;
|
|
130
|
+
get lineHeight(): number;
|
|
131
|
+
get textSubstitutor(): () => string;
|
|
132
|
+
get text(): string;
|
|
133
|
+
set text(v: string): any;
|
|
134
|
+
get textBounds(): import("@hatiolab/things-scene").BOUNDS;
|
|
135
|
+
get textRotation(): number;
|
|
136
|
+
get textHidden(): boolean;
|
|
137
|
+
set textHidden(v: boolean): any;
|
|
138
|
+
get hasTextProperty(): boolean;
|
|
139
|
+
animate(opts: import("@hatiolab/things-scene").AnimationConfig): any;
|
|
140
|
+
effect(context: import("@hatiolab/things-scene").SceneRenderContext, model: any): void;
|
|
141
|
+
serialize(...others: any[]): string;
|
|
142
|
+
trim(): void;
|
|
143
|
+
closeScene(data: any): void;
|
|
144
|
+
delta(attr?: string | object, value?: any): any;
|
|
145
|
+
invalidate(): void;
|
|
146
|
+
get value(): any;
|
|
147
|
+
set value(v: any): any;
|
|
148
|
+
get data(): any;
|
|
149
|
+
set data(v: any): any;
|
|
150
|
+
set tap(v: any): any;
|
|
151
|
+
get mappings(): any[];
|
|
152
|
+
get retention(): number;
|
|
153
|
+
get animation(): import("@hatiolab/things-scene").AnimationController | undefined;
|
|
154
|
+
get started(): boolean;
|
|
155
|
+
set started(v: boolean): any;
|
|
156
|
+
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
|
+
findAnchor(name: string): any;
|
|
161
|
+
isDescendible(container: Component): boolean;
|
|
162
|
+
getContext(component?: unknown): any;
|
|
163
|
+
get root(): Component;
|
|
164
|
+
get rootModel(): Component;
|
|
165
|
+
get parent(): Component;
|
|
166
|
+
set parent(v: Component): any;
|
|
167
|
+
get scalable(): boolean;
|
|
168
|
+
get stuck(): boolean;
|
|
169
|
+
get capturable(): boolean;
|
|
170
|
+
get position(): string;
|
|
171
|
+
get origin(): string;
|
|
172
|
+
get offset(): import("@hatiolab/things-scene").POINT;
|
|
173
|
+
get app(): import("@hatiolab/things-scene").ApplicationContext;
|
|
174
|
+
drawEffect(context: import("@hatiolab/things-scene").SceneRenderContext): void;
|
|
175
|
+
prepareFill(resolve: Function, reject: Function): void;
|
|
176
|
+
prepareFillIf(condition: boolean): void;
|
|
177
|
+
onchangeFill(after: Record<string, any>, before: Record<string, any>): void;
|
|
178
|
+
drawImage(context: import("@hatiolab/things-scene").SceneRenderContext, image: HTMLImageElement, left: number, top: number, width: number, height: number): void;
|
|
179
|
+
mutateBounds(logic: ((bounds: import("@hatiolab/things-scene").BOUNDS) => import("@hatiolab/things-scene").BOUNDS | void) | null, context?: any): void;
|
|
180
|
+
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;
|
|
181
|
+
access(accessor: string): any;
|
|
182
|
+
substitute(template: string, data: any): string | undefined;
|
|
183
|
+
onchangeMappings(after: Record<string, any>, before: Record<string, any>): void;
|
|
184
|
+
onchangeData(after: Record<string, any>, before: Record<string, any>): void;
|
|
185
|
+
buildMappings(): void;
|
|
186
|
+
executeMappings(force?: boolean): void;
|
|
187
|
+
disposeMappings(): void;
|
|
188
|
+
ondropfile(transfered: FileList, files: string[]): void;
|
|
189
|
+
transcoordS2P(x: number, y: number, rp?: import("@hatiolab/things-scene").POINT): import("@hatiolab/things-scene").POINT;
|
|
190
|
+
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;
|
|
198
|
+
toParent(x: number, y: number, rp?: import("@hatiolab/things-scene").POINT): import("@hatiolab/things-scene").POINT;
|
|
199
|
+
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;
|
|
205
|
+
on(name: string | object, callback: Function, context?: any): any;
|
|
206
|
+
off(name?: string | object, callback?: Function, context?: any): any;
|
|
207
|
+
once(name: string | object, callback: Function, context?: any): any;
|
|
208
|
+
trigger(name: string, ...args: any[]): any;
|
|
209
|
+
delegate_on(delegator: any): any;
|
|
210
|
+
delegate_off(delegator: any): any;
|
|
211
|
+
onchange(after: Record<string, any>, before: Record<string, any>): void;
|
|
212
|
+
calculateBounds?(): void;
|
|
213
|
+
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
|
+
resize(): void;
|
|
222
|
+
fit(type?: string): void;
|
|
223
|
+
get components(): Component[] | undefined;
|
|
224
|
+
get layout(): any;
|
|
225
|
+
get auxOverlay(): HTMLElement | undefined;
|
|
226
|
+
get isReady(): boolean;
|
|
227
|
+
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;
|
|
232
|
+
get hasSameParentForAllSelected(): boolean;
|
|
233
|
+
set hasSameParentForAllSelected(_v: boolean): any;
|
|
234
|
+
get fitMode(): string | undefined;
|
|
235
|
+
set fitMode(_v: string | undefined): any;
|
|
236
|
+
get element(): HTMLElement | null;
|
|
237
|
+
set element(_v: HTMLElement | null): any;
|
|
238
|
+
}) & typeof Shape;
|
|
3
239
|
export default class ImageView extends ImageView_base {
|
|
4
240
|
static NOIMAGE?: any;
|
|
5
241
|
static get noimage(): any;
|
|
@@ -9,11 +245,11 @@ export default class ImageView extends ImageView_base {
|
|
|
9
245
|
render(ctx: CanvasRenderingContext2D): void;
|
|
10
246
|
get nature(): ComponentNature;
|
|
11
247
|
get hasTextProperty(): boolean;
|
|
12
|
-
ready(): void
|
|
248
|
+
ready(): Promise<void>;
|
|
13
249
|
prepare(resolve: (ret?: any) => void, reject: (e?: any) => void): void;
|
|
14
250
|
get src(): any;
|
|
15
251
|
set src(src: any);
|
|
16
252
|
onchange(after: Properties, before: Properties): void;
|
|
17
|
-
ondropfile(transfered:
|
|
253
|
+
ondropfile(transfered: FileList, files: string[]): void;
|
|
18
254
|
}
|
|
19
255
|
export {};
|
package/dist/image-view.js
CHANGED
|
@@ -43,7 +43,9 @@ const NATURE = {
|
|
|
43
43
|
help: 'scene/component/image-view'
|
|
44
44
|
};
|
|
45
45
|
const NOIMAGE_DATA_URI = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABIBAMAAAD7Se1QAAAAIVBMVEUAAABHcEwBAQEREREBAQEEBAQGBgYLCwsDAwMDAwMICAi6HF9tAAAAC3RSTlNNAEAERiMYCS41Eac10lYAAAEgSURBVHhe7dY9asQwEAXgh7DNertNiJy48pIitY3SB7bYdk0ukL1BDDmA9gZecoH4pmFQ3MQayUMguPBrNPD4wD9TCMvJmt3M/AtYwXOlXiWgqADVCUBD46MAnGhMBaCiUQmAm8VA/Eh/eWl9Fn5WcxD+OLuRrUYJDKLluwH2InACUgkoACSdADxQc50Bytadb9RkM0CT13TcvlCT1HFg8UTHvasuUVACCa3El6u2UdD8LFTlKhUFFgA+d3dj10aABkUN72N3jAADCrJq7PIIsPidcxBoTHIIAjMFmyCwmGYIAA1P9gFgfCANAOsDSccCDW+uLDB+kLGg94OkZoAGkwsDDAe2DOg5oPxAg03rBR88OHpBz4N8UVeHFSwma74BTW6Ge4rIRa4AAAAASUVORK5CYII=';
|
|
46
|
-
let ImageView =
|
|
46
|
+
let ImageView = class ImageView extends RectPath(Shape) {
|
|
47
|
+
static { ImageView_1 = this; }
|
|
48
|
+
static NOIMAGE;
|
|
47
49
|
static get noimage() {
|
|
48
50
|
if (!ImageView_1.NOIMAGE) {
|
|
49
51
|
ImageView_1.NOIMAGE = new Image();
|
|
@@ -51,6 +53,8 @@ let ImageView = ImageView_1 = class ImageView extends RectPath(Shape) {
|
|
|
51
53
|
}
|
|
52
54
|
return ImageView_1.NOIMAGE;
|
|
53
55
|
}
|
|
56
|
+
_offcanvas;
|
|
57
|
+
_image;
|
|
54
58
|
dispose() {
|
|
55
59
|
super.dispose();
|
|
56
60
|
delete this._offcanvas;
|
|
@@ -85,8 +89,8 @@ let ImageView = ImageView_1 = class ImageView extends RectPath(Shape) {
|
|
|
85
89
|
get hasTextProperty() {
|
|
86
90
|
return false;
|
|
87
91
|
}
|
|
88
|
-
ready() {
|
|
89
|
-
super.ready();
|
|
92
|
+
async ready() {
|
|
93
|
+
await super.ready();
|
|
90
94
|
this.prepareIf(!this._image && this.state.src);
|
|
91
95
|
}
|
|
92
96
|
prepare(resolve, reject) {
|