@hatiolab/things-scene 2.7.18 → 2.7.22

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/things-scene.d.ts CHANGED
@@ -1,10 +1,16 @@
1
1
  declare module '@hatiolab/things-scene' {
2
2
  type Constructor<T = {}> = new (...args: any[]) => T
3
+ type Class = { new (...args: any[]): any }
3
4
 
4
5
  const MODE_VIEW = 0
5
6
  const MODE_EDIT = 1
6
7
  const MODE_SHIFT = 2
7
8
 
9
+ enum SCENE_MODE {
10
+ VIEW = 0,
11
+ EDIT = 1
12
+ }
13
+
8
14
  type FITMODE = 'both' | 'ratio' | 'width' | 'height' | 'center' | 'none'
9
15
  type DIMENSION = { x: number; y: number }
10
16
  type SCALE = DIMENSION
@@ -13,6 +19,16 @@ declare module '@hatiolab/things-scene' {
13
19
 
14
20
  type Properties = { [key: string]: any }
15
21
 
22
+ type AnimationConfig = {
23
+ duration?: number
24
+ delay?: number
25
+ step: Function
26
+ delta: 'linear' | 'quad' | 'circ' | 'back' | 'bounce' | 'elastic' | Function
27
+ ease: 'out' | 'inout'
28
+ options?: object
29
+ repeat?: boolean
30
+ }
31
+
16
32
  type ControlHandler = {
17
33
  ondragstart?(point: POSITION, index: number, component: Component): void
18
34
  ondragmove?(point: POSITION, index: number, component: Component): void
@@ -129,6 +145,7 @@ declare module '@hatiolab/things-scene' {
129
145
 
130
146
  class Component extends MixinEvent(Object) {
131
147
  static register(type: string, Clazz: typeof Component): void
148
+ static memoize(base: any, property: string, needClone: boolean): void
132
149
 
133
150
  state: Properties
134
151
  bounds: { top: number; left: number; width: number; height: number }
@@ -155,6 +172,11 @@ declare module '@hatiolab/things-scene' {
155
172
  transcoordP2S(x: number, y: number): POSITION
156
173
  render(context: CanvasRenderingContext2D): void
157
174
  executeMappings(force?: boolean): void
175
+ invalidate(): void
176
+ animate(config: AnimationConfig): {
177
+ start: Function /* start function */
178
+ stop: Function /* stop function */
179
+ }
158
180
 
159
181
  onchange(after: Properties, before: Properties): void
160
182
 
@@ -186,15 +208,17 @@ declare module '@hatiolab/things-scene' {
186
208
  canvas: HTMLCanvasElement
187
209
 
188
210
  getContext(): CanvasRenderingContext2D
189
- invalidate(): void
190
211
  }
191
212
 
192
213
  class ModelLayer extends Layer {
193
214
  overlay: HTMLDivElement
194
215
  }
195
216
 
217
+ class Text extends RectPath(Component) {}
196
218
  class Shape extends Component {}
197
219
  class Ellipse extends Shape {}
220
+ class Polygon extends Shape {}
221
+ class Donut extends Ellipse {}
198
222
  class Rect extends RectPath(Shape) {}
199
223
  class HTMLOverlayElement extends MixinHTMLElement(RectPath(Component)) {}
200
224
 
@@ -229,23 +253,7 @@ declare module '@hatiolab/things-scene' {
229
253
  */
230
254
  remove(): void
231
255
 
232
- animate({
233
- duration /* unit: milli-second, 1000 milli-seconds by default */,
234
- delay /* default 30 */,
235
- step /* step function */,
236
- delta /* delta function */,
237
- ease /* ease function */,
238
- options,
239
- repeat /* default false */
240
- }: {
241
- duration: number
242
- delay: number
243
- step: Function
244
- delta: 'linear' | 'quad' | 'circ' | 'back' | 'bounce' | 'elastic' | Function
245
- ease: 'out' | 'inout'
246
- options?: object
247
- repeat: boolean
248
- }): {
256
+ animate(config: AnimationConfig): {
249
257
  start: Function /* start function */
250
258
  stop: Function /* stop function */
251
259
  }