@cesdk/cesdk-js 1.4.0-alpha.6 → 1.4.2

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/BlockAPI.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  type Vec2 = { x: number; y: number };
2
- type DesignElementId = number;
3
- type DesignElementType = string;
2
+ type DesignBlockId = number;
3
+ type DesignBlockType = string;
4
4
  type MimeType =
5
5
  | 'image/png'
6
6
  | 'image/jpeg'
@@ -10,14 +10,15 @@ type Size2 = {
10
10
  width: number;
11
11
  height: number;
12
12
  };
13
+ type RGBA = [r: number, g: number, b: number, a: number];
13
14
 
14
15
  export enum PositionMode {
15
16
  /** Position in absolute design units. */
16
17
  Absolute = 'Absolute',
17
18
  /** Position in relation to the block's parent's size in percent, where 1.0 means 100%. */
18
19
  Percent = 'Percent',
19
- /** Position is not defined. */
20
- Undefined = 'Undefined'
20
+ /** Position is automatically determined. */
21
+ Undefined = 'Auto'
21
22
  }
22
23
 
23
24
  export enum SizeMode {
@@ -29,6 +30,16 @@ export enum SizeMode {
29
30
  Auto = 'Auto'
30
31
  }
31
32
 
33
+ export enum PropertyType {
34
+ Bool = 'Bool',
35
+ Int = 'Int',
36
+ Float = 'Float',
37
+ String = 'String',
38
+ Color = 'Color',
39
+ Enum = 'Enum',
40
+ Struct = 'Struct'
41
+ }
42
+
32
43
  export default class BlockAPI {
33
44
  /**
34
45
  * Exports a design block element as a file of the given mime type.
@@ -37,7 +48,7 @@ export default class BlockAPI {
37
48
  * @param mimeType The mime type of the output file. Defaults to 'image/png'
38
49
  * @returns A promise that resolves with the exported image or is rejected with an error.
39
50
  */
40
- export(handle: DesignElementId, mimeType?: MimeType): Promise<Blob>;
51
+ export(handle: DesignBlockId, mimeType?: MimeType): Promise<Blob>;
41
52
 
42
53
  /**
43
54
  * Loads existing blocks from the given string.
@@ -45,7 +56,7 @@ export default class BlockAPI {
45
56
  * @param content A string representing the given blocks.
46
57
  * @returns A promise that resolves with a list of handles representing the found blocks or an error.
47
58
  */
48
- loadFromString(content: string): Promise<DesignElementId[]>;
59
+ loadFromString(content: string): Promise<DesignBlockId[]>;
49
60
 
50
61
  /**
51
62
  * Saves the given blocks into a string. If given the root of a block hierarchy, e.g. a
@@ -53,14 +64,14 @@ export default class BlockAPI {
53
64
  * @param blocks
54
65
  * @returns A promise that resolves to a string representing the blocks or an error.
55
66
  */
56
- saveToString(blocks: DesignElementId[]): Promise<string>;
67
+ saveToString(blocks: DesignBlockId[]): Promise<string>;
57
68
 
58
69
  /**
59
70
  * Create a new block, fails if type is unknown.
60
71
  * @param type The type of the block that shall be created.
61
72
  * @returns The created blocks handle.
62
73
  */
63
- create(type: DesignElementType): DesignElementId;
74
+ create(type: DesignBlockType): DesignBlockId;
64
75
 
65
76
  /**
66
77
 
@@ -68,7 +79,7 @@ export default class BlockAPI {
68
79
  * @param id The block to query.
69
80
  * @returns The blocks type.
70
81
  */
71
- getType(id: DesignElementId): DesignElementType;
82
+ getType(id: DesignBlockId): DesignBlockType;
72
83
 
73
84
  /**
74
85
  * Update the selection state of a block.
@@ -76,53 +87,60 @@ export default class BlockAPI {
76
87
  * @param id The block to query.
77
88
  * @param selected Whether or not the block should be selected.
78
89
  */
79
- setSelected(id: DesignElementId, selected: boolean): void;
90
+ setSelected(id: DesignBlockId, selected: boolean): void;
80
91
 
81
92
  /**
82
93
  * Get the selected state of a block.
83
94
  * @param id The block to query.
84
95
  * @returns True if the block is selected, false otherwise.
85
96
  */
86
- isSelected(id: DesignElementId): boolean;
97
+ isSelected(id: DesignBlockId): boolean;
87
98
 
88
99
  /**
89
100
  * Get all currently selected blocks.
90
101
  * @returns An array of block ids.
91
102
  */
92
- findAllSelected(): DesignElementId[];
103
+ findAllSelected(): DesignBlockId[];
104
+
105
+ /** Checks whether the given block references any variables. Doesn't check the blocks children.
106
+ *
107
+ * @param block The block to inspect.
108
+ * @return true if the block references variables and false otherwise.
109
+ */
110
+ referencesAnyVariables(id: DesignBlockId): boolean;
93
111
 
94
112
  /**
95
113
  * Update a block's name.
96
114
  * @param id The block to update.
97
115
  * @param name The name to set.
98
116
  */
99
- setName(id: DesignElementId, name: string): void;
117
+ setName(id: DesignBlockId, name: string): void;
100
118
 
101
119
  /**
102
120
  * Get a block's name.
103
121
  * @param id The block to update.
104
122
  */
105
- getName(id: DesignElementId): string;
123
+ getName(id: DesignBlockId): string;
106
124
 
107
125
  /**
108
126
  * Finds all blocks with the given name.
109
127
  * @param name The name to search for.
110
128
  * @returns A list of block ids.
111
129
  */
112
- findByName(name: string): DesignElementId[];
130
+ findByName(name: string): DesignBlockId[];
113
131
 
114
132
  /**
115
133
  * Finds all blocks with the given type.
116
134
  * @param type The type to search for.
117
135
  * @returns A list of block ids.
118
136
  */
119
- findByType(type: DesignElementType): DesignElementId[];
137
+ findByType(type: DesignBlockType): DesignBlockId[];
120
138
 
121
139
  /**
122
140
  * Return all blocks currently known to the engine.
123
141
  * @returns A list of block ids.
124
142
  */
125
- findAll(): /* filterSpec?: unknown */ DesignElementId[];
143
+ findAll(): /* filterSpec?: unknown */ DesignBlockId[];
126
144
 
127
145
  // Element
128
146
 
@@ -131,195 +149,202 @@ export default class BlockAPI {
131
149
  * @param id The block to query.
132
150
  * @returns True if visible, false otherwise.
133
151
  */
134
- isVisible(id: DesignElementId): boolean;
152
+ isVisible(id: DesignBlockId): boolean;
135
153
 
136
154
  /**
137
155
  * Update a block's visibility.
138
156
  * @param id The block to update.
139
157
  * @param visible Whether the block shall be visible.
140
158
  */
141
- setVisible(id: DesignElementId, visible: boolean): void;
159
+ setVisible(id: DesignBlockId, visible: boolean): void;
142
160
 
143
161
  /**
144
162
  * Query a block's x position.
145
163
  * @param id The block to query.
146
164
  * @returns The value of the x position.
147
165
  */
148
- getPositionX(id: DesignElementId): number;
166
+ getPositionX(id: DesignBlockId): number;
149
167
 
150
168
  /**
151
169
  * Query a block's mode for its x position.
152
170
  * @param id The block to query.
153
171
  * @returns The current mode for the x position: absolute, percent or undefined.
154
172
  */
155
- getPositionXMode(id: DesignElementId): PositionMode;
173
+ getPositionXMode(id: DesignBlockId): PositionMode;
156
174
 
157
175
  /**
158
176
  * Query a block's y position.
159
177
  * @param id The block to query.
160
178
  * @returns The value of the y position.
161
179
  */
162
- getPositionY(id: DesignElementId): number;
180
+ getPositionY(id: DesignBlockId): number;
163
181
 
164
182
  /**
165
183
  * Query a block's mode for its y position.
166
184
  * @param id The block to query.
167
185
  * @returns The current mode for the y position: absolute, percent or undefined.
168
186
  */
169
- getPositionYMode(id: DesignElementId): PositionMode;
187
+ getPositionYMode(id: DesignBlockId): PositionMode;
170
188
 
171
189
  /**
172
190
  * Update a block's x position.
173
191
  * @param id The block to update.
174
192
  * @param value The value of the x position.
175
193
  */
176
- setPositionX(id: DesignElementId, value: number): void;
194
+ setPositionX(id: DesignBlockId, value: number): void;
177
195
 
178
196
  /**
179
197
  * Set a block's mode for its x position.
180
198
  * @param id The block to update.
181
199
  * @param mode The x position mode: absolute, percent or undefined.
182
200
  */
183
- setPositionXMode(id: DesignElementId, mode: PositionMode): void;
201
+ setPositionXMode(id: DesignBlockId, mode: PositionMode): void;
184
202
 
185
203
  /**
186
204
  * Update a block's y position.
187
205
  * @param id The block to update.
188
206
  * @param value The value of the y position.
189
207
  */
190
- setPositionY(id: DesignElementId, value: number): void;
208
+ setPositionY(id: DesignBlockId, value: number): void;
191
209
 
192
210
  /**
193
211
  * Set a block's mode for its y position.
194
212
  * @param id The block to update.
195
213
  * @param mode The y position mode: absolute, percent or undefined.
196
214
  */
197
- setPositionYMode(id: DesignElementId, mode: PositionMode): void;
215
+ setPositionYMode(id: DesignBlockId, mode: PositionMode): void;
198
216
 
199
217
  /**
200
218
  * Query a block's rotation in radians.
201
219
  * @param id The block to query.
202
220
  * @returns The block's rotation around its center in radians.
203
221
  */
204
- getRotation(id: DesignElementId): number;
222
+ getRotation(id: DesignBlockId): number;
205
223
 
206
224
  /**
207
225
  * Update a block's rotation.
208
226
  * @param id The block to update.
209
227
  * @param radians The new rotation in radians. Rotation is applied around the block's center.
210
228
  */
211
- setRotation(id: DesignElementId, radians: number): void;
229
+ setRotation(id: DesignBlockId, radians: number): void;
212
230
 
213
231
  /**
214
232
  * Query a block's horizontal flip state.
215
233
  * @param id The block to query.
216
234
  * @returns A boolean indicating for whether the block is flipped in the queried direction
217
235
  */
218
- getFlipHorizontal(id: DesignElementId): boolean;
236
+ getFlipHorizontal(id: DesignBlockId): boolean;
219
237
 
220
238
  /**
221
239
  * Query a block's vertical flip state.
222
240
  * @param id The block to query.
223
241
  * @returns A boolean indicating for whether the block is flipped in the queried direction
224
242
  */
225
- getFlipVertical(id: DesignElementId): boolean;
243
+ getFlipVertical(id: DesignBlockId): boolean;
226
244
 
227
245
  /**
228
246
  * Update a block's horizontal flip.
229
247
  * @param id The block to update.
230
248
  * @param horizontal Whether the block should be flipped along its x-axis.
231
249
  */
232
- setFlipHorizontal(id: DesignElementId, flip: boolean): void;
250
+ setFlipHorizontal(id: DesignBlockId, flip: boolean): void;
233
251
 
234
252
  /**
235
253
  * Update a block's vertical flip.
236
254
  * @param id The block to update.
237
255
  * @param vertical Whether the block should be flipped along its y-axis.
238
256
  */
239
- setFlipVertical(id: DesignElementId, flip: boolean): void;
257
+ setFlipVertical(id: DesignBlockId, flip: boolean): void;
240
258
 
241
259
  /**
242
260
  * Query a block's width.
243
261
  * @param id The block to query.
244
262
  * @returns The value of the block's width.
245
263
  */
246
- getWidth(id: DesignElementId): number;
264
+ getWidth(id: DesignBlockId): number;
247
265
 
248
266
  /**
249
267
  * Query a block's mode for its width.
250
268
  * @param id The block to query.
251
269
  * @returns The current mode for the width: absolute, percent or auto.
252
270
  */
253
- getWidthMode(id: DesignElementId): SizeMode;
271
+ getWidthMode(id: DesignBlockId): SizeMode;
254
272
 
255
273
  /**
256
274
  * Query a block's height.
257
275
  * @param id The block to query.
258
276
  * @returns The value of the block's height.
259
277
  */
260
- getHeight(id: DesignElementId): number;
278
+ getHeight(id: DesignBlockId): number;
261
279
 
262
280
  /**
263
281
  * Query a block's mode for its height.
264
282
  * @param id The block to query.
265
283
  * @returns The current mode for the height: absolute, percent or auto.
266
284
  */
267
- getHeightMode(id: DesignElementId): SizeMode;
285
+ getHeightMode(id: DesignBlockId): SizeMode;
268
286
 
269
287
  /**
270
288
  * Update a block's width.
271
289
  * @param id The block to update.
272
290
  * @param value The new width of the block.
273
291
  */
274
- setWidth(id: DesignElementId, value: number): void;
292
+ setWidth(id: DesignBlockId, value: number): void;
275
293
 
276
294
  /**
277
295
  * Set a block's mode for its width.
278
296
  * @param id The block to update.
279
297
  * @param mode The width mode: absolute, percent or auto.
280
298
  */
281
- setWidthMode(id: DesignElementId, mode: SizeMode): void;
299
+ setWidthMode(id: DesignBlockId, mode: SizeMode): void;
282
300
 
283
301
  /**
284
302
  * Update a block's height.
285
303
  * @param id The block to update.
286
304
  * @param value The new height of the block.
287
305
  */
288
- setHeight(id: DesignElementId, value: number): void;
306
+ setHeight(id: DesignBlockId, value: number): void;
289
307
 
290
308
  /**
291
309
  * Set a block's mode for its height.
292
310
  * @param id The block to update.
293
311
  * @param mode The height mode: absolute, percent or auto.
294
312
  */
295
- setHeightMode(id: DesignElementId, mode: SizeMode): void;
313
+ setHeightMode(id: DesignBlockId, mode: SizeMode): void;
296
314
 
297
315
  /**
298
- * Get a block's layouted size. Requires an `engine.render()` beforehand.
316
+ * Get a block's layouted width. Requires an `engine.render()` beforehand.
299
317
  * @param id The block to query.
300
- * @returns A `Size2` object holding the size.
318
+ * @returns The layouted width.
301
319
  */
302
- getFrameSize(id: DesignElementId): Size2;
320
+ getFrameWidth(id: DesignBlockId): number;
321
+
322
+ /**
323
+ * Get a block's layouted height. Requires an `engine.render()` beforehand.
324
+ * @param id The block to query.
325
+ * @returns The layouted height.
326
+ */
327
+ getFrameHeight(id: DesignBlockId): number;
303
328
 
304
329
  /**
305
330
  * Duplicates a block including its children.
306
331
  * @param id The block to duplicate.
307
332
  * @returns The handle of the duplicate.
308
333
  */
309
- duplicate(id: DesignElementId): DesignElementId;
334
+ duplicate(id: DesignBlockId): DesignBlockId;
310
335
 
311
336
  /**
312
337
  * Destroys a block.
313
338
  * @param id The block to destroy.
314
339
  */
315
- destroy(id: DesignElementId): void;
340
+ destroy(id: DesignBlockId): void;
316
341
 
317
342
  /**
318
343
  * Query a block's parent.
319
344
  * @param id The block to query.
320
345
  * @returns The parent's handle.
321
346
  */
322
- getParent(id: DesignElementId): DesignElementId;
347
+ getParent(id: DesignBlockId): DesignBlockId;
323
348
 
324
349
  /**
325
350
  * Get all children of the given block. Children
@@ -328,7 +353,7 @@ export default class BlockAPI {
328
353
  * @param id The block to query.
329
354
  * @returns A list of block ids.
330
355
  */
331
- getChildren(id: DesignElementId): DesignElementId[];
356
+ getChildren(id: DesignBlockId): DesignBlockId[];
332
357
 
333
358
  /**
334
359
  * Insert a new or existing child at a certain position in the parent's children.
@@ -336,16 +361,425 @@ export default class BlockAPI {
336
361
  * @param child The child to insert. Can be an existing child of `parent`.
337
362
  * @param index The index to insert or move to.
338
363
  */
339
- insertChild(
340
- parent: DesignElementId,
341
- child: DesignElementId,
342
- index: number
343
- ): void;
364
+ insertChild(parent: DesignBlockId, child: DesignBlockId, index: number): void;
344
365
 
345
366
  /**
346
367
  * Appends a new or existing child to a block's children.
347
368
  * @param parent The block whose children should be updated.
348
369
  * @param child The child to insert. Can be an existing child of `parent`.
349
370
  */
350
- appendChild(parent: DesignElementId, child: DesignElementId): void;
371
+ appendChild(parent: DesignBlockId, child: DesignBlockId): void;
372
+
373
+ /**
374
+ * Get the x position of the block's axis-aligned bounding box in the scene's global coordinate space.
375
+ * The scene's global coordinate space has its position at the top left.
376
+ * @param id The block whose bounding box should be calculated.
377
+ * @return UBQResult<float> The x coordinate of the position of the axis-aligned bounding box.
378
+ */
379
+ getGlobalBoundingBoxX(id: DesignBlockId): number;
380
+
381
+ /**
382
+ * Get the y position of the block's axis-aligned bounding box in the scene's global coordinate space.
383
+ * The scene's global coordinate space has its position at the top left.
384
+ * @param id The block whose bounding box should be calculated.
385
+ * @return UBQResult<float> The y coordinate of the position of the axis-aligned bounding box.
386
+ */
387
+ getGlobalBoundingBoxY(id: DesignBlockId): number;
388
+
389
+ /**
390
+ * Get the width of the block's axis-aligned bounding box in the scene's global coordinate space.
391
+ * The scene's global coordinate space has its position at the top left.
392
+ * @param id The block whose bounding box should be calculated.
393
+ * @return UBQResult<float> The width of the axis-aligned bounding box.
394
+ */
395
+ getGlobalBoundingBoxWidth(id: DesignBlockId): number;
396
+
397
+ /**
398
+ * Get the height of the block's axis-aligned bounding box in the scene's global coordinate space.
399
+ * The scene's global coordinate space has its position at the top left.
400
+ * @param id The block whose bounding box should be calculated.
401
+ * @return UBQResult<float> The height of the axis-aligned bounding box.
402
+ */
403
+ getGlobalBoundingBoxHeight(id: DesignBlockId): number;
404
+
405
+ /**
406
+ * Get all available properties of a block.
407
+ * @param id The block whose properties should be queried.
408
+ * @returns A list of the property names.
409
+ */
410
+ findAllProperties(id: DesignBlockId): string[];
411
+
412
+ /**
413
+ * Get the type of a property given its name.
414
+ * @param property The name of the property whose type should be queried.
415
+ * @returns The property type.
416
+ */
417
+ getPropertyType(property: string): PropertyType;
418
+
419
+ /**
420
+ * Get all the possible values of an enum given an enum property.
421
+ * @param enumProperty The name of the property whose enum values should be queried.
422
+ * @returns A list of the enum value names as string.
423
+ */
424
+ getEnumValues<T = string>(enumProperty: string): T[];
425
+
426
+ /**
427
+ * Set a bool property of the given design block to the given value.
428
+ * @param id The block whose property should be set.
429
+ * @param property The name of the property to set.
430
+ * @param value The value to set.
431
+ */
432
+ setBool(id: DesignBlockId, property: string, value: boolean): void;
433
+
434
+ /**
435
+ * Get the value of a bool property of the given design block.
436
+ * @param id The block whose property should be queried.
437
+ * @param property The name of the property to query.
438
+ * @returns The value of the property.
439
+ */
440
+ getBool(id: DesignBlockId, property: string): boolean;
441
+
442
+ /**
443
+ * Set an int property of the given design block to the given value.
444
+ * @param id The block whose property should be set.
445
+ * @param property The name of the property to set.
446
+ * @param value The value to set.
447
+ */
448
+ setInt(id: DesignBlockId, property: string, value: number): void;
449
+
450
+ /**
451
+ * Get the value of an int property of the given design block.
452
+ * @param id The block whose property should be queried.
453
+ * @param property The name of the property to query.
454
+ * @returns The value of the property.
455
+ */
456
+ getInt(id: DesignBlockId, property: string): number;
457
+
458
+ /**
459
+ * Set a float property of the given design block to the given value.
460
+ * @param id The block whose property should be set.
461
+ * @param property The name of the property to set.
462
+ * @param value The value to set.
463
+ */
464
+ setFloat(id: DesignBlockId, property: string, value: number): void;
465
+
466
+ /**
467
+ * Get the value of a float property of the given design block.
468
+ * @param id The block whose property should be queried.
469
+ * @param property The name of the property to query.
470
+ * @returns The value of the property.
471
+ */
472
+ getFloat(id: DesignBlockId, property: string): number;
473
+
474
+ /**
475
+ * Set a string property of the given design block to the given value.
476
+ * @param id The block whose property should be set.
477
+ * @param property The name of the property to set.
478
+ * @param value The value to set.
479
+ */
480
+ setString(id: DesignBlockId, property: string, value: string): void;
481
+
482
+ /**
483
+ * Get the value of a string property of the given design block.
484
+ * @param id The block whose property should be queried.
485
+ * @param property The name of the property to query.
486
+ * @returns The value of the property.
487
+ */
488
+ getString(id: DesignBlockId, property: string): string;
489
+
490
+ /**
491
+ * Set a color property of the given design block to the given value.
492
+ * @param id The block whose property should be set.
493
+ * @param property The name of the property to set.
494
+ * @param r The red color component in the range of 0 to 1.
495
+ * @param g The green color component in the range of 0 to 1.
496
+ * @param b The blue color component in the range of 0 to 1.
497
+ * @param a The alpha color component in the range of 0 to 1.
498
+ */
499
+ setColorRGBA(
500
+ id: DesignBlockId,
501
+ property: string,
502
+ r: number,
503
+ g: number,
504
+ b: number,
505
+ a: number
506
+ ): void;
507
+
508
+ /**
509
+ * Get the value of a string property of the given design block.
510
+ * @param id The block whose property should be queried.
511
+ * @param property The name of the property to query.
512
+ * @returns A tuple of channels red, green, blue and alpha in the range of 0 to 1.
513
+ */
514
+ getColorRGBA(id: DesignBlockId, property: string): RGBA;
515
+
516
+ /**
517
+ * Set an enum property of the given design block to the given value.
518
+ * @param block The block whose property should be set.
519
+ * @param property The name of the property to set.
520
+ * @param value The enum value as string.
521
+ */
522
+ setEnum(id: DesignBlockId, property: string, value: string): void;
523
+
524
+ /**
525
+ * Get the value of an enum property of the given design block.
526
+ * @param block The block whose property should be queried.
527
+ * @param property The name of the property to query.
528
+ * @returns The value as string.
529
+ */
530
+ getEnum(id: DesignBlockId, property: string): string;
531
+
532
+ /**
533
+ * Query if the given block has crop properties.
534
+ * @param id The block to query.
535
+ * @returns true, if the block has crop properties.
536
+ */
537
+ hasCrop(id: DesignBlockId): boolean;
538
+
539
+ /**
540
+ * Set the crop scale in x direction of the given design block.
541
+ * @param id The block whose crop should be set.
542
+ * @param scaleX The scale in x direction.
543
+ */
544
+ setCropScaleX(id: DesignBlockId, scaleX: number): void;
545
+
546
+ /**
547
+ * Set the crop scale in y direction of the given design block.
548
+ * @param id The block whose crop should be set.
549
+ * @param scaleY The scale in y direction.
550
+ */
551
+ setCropScaleY(id: DesignBlockId, scaleY: number): void;
552
+
553
+ /**
554
+ * Set the crop rotation of the given design block.
555
+ * @param id The block whose crop should be set.
556
+ * @param rotation The rotation in radians.
557
+ */
558
+ setCropRotation(id: DesignBlockId, rotation: number): void;
559
+
560
+ /**
561
+ * Set the crop translation in x direction of the given design block.
562
+ * @param id The block whose crop should be set.
563
+ * @param translationY The translation in x direction.
564
+ */
565
+ setCropTranslationX(id: DesignBlockId, translationX: number): void;
566
+
567
+ /**
568
+ * Set the crop translation in y direction of the given design block.
569
+ * @param id The block whose crop should be set.
570
+ * @param translationY The translation in y direction.
571
+ */
572
+ setCropTranslationY(id: DesignBlockId, translationY: number): void;
573
+
574
+ /**
575
+ * Resets the manually set crop of the given design block.
576
+ * The block's content fill mode is set to 'cover'.
577
+ * @param id The block whose crop should be reset.
578
+ */
579
+ resetCrop(id: DesignBlockId): void;
580
+
581
+ /**
582
+ * Get the crop scale on the x axis of the given design block.
583
+ * @param id The block whose scale should be queried.
584
+ * @returns The scale on the x axis.
585
+ */
586
+ getCropScaleX(id: DesignBlockId): number;
587
+
588
+ /**
589
+ * Get the crop scale on the y axis of the given design block.
590
+ * @param id The block whose scale should be queried.
591
+ * @returns The scale on the y axis.
592
+ */
593
+ getCropScaleY(id: DesignBlockId): number;
594
+
595
+ /**
596
+ * Get the crop rotation of the given design block.
597
+ * @param id The block whose crop rotation should be queried.
598
+ * @returns The crop rotation.
599
+ */
600
+ getCropRotation(id: DesignBlockId): number;
601
+
602
+ /**
603
+ * Get the crop translation on the x axis of the given design block.
604
+ * @param id The block whose translation should be queried.
605
+ * @returns The translation on the x axis.
606
+ */
607
+ getCropTranslationX(id: DesignBlockId): number;
608
+
609
+ /**
610
+ * Get the crop translation on the y axis of the given design block.
611
+ * @param id The block whose translation should be queried.
612
+ * @returns The translation on the y axis.
613
+ */
614
+ getCropTranslationY(id: DesignBlockId): number;
615
+
616
+ /**
617
+ * Query if the given block has an opacity.
618
+ * @param id The block to query.
619
+ * @returns true, if the block has an opcity.
620
+ */
621
+ hasOpacity(id: DesignBlockId): boolean;
622
+
623
+ /**
624
+ * Set the opacity of the given design block.
625
+ * @param id The block whose opacity should be set.
626
+ * @param opacity The opacity to be set. The valid range is 0 to 1.
627
+ */
628
+ setOpacity(id: DesignBlockId, opacity: number): void;
629
+
630
+ /**
631
+ * Get the opacity of the given design block.
632
+ * @param id The block whose opacity should be queried.
633
+ * @returns The opacity in a range of 0 to 1.
634
+ */
635
+ getOpacity(id: DesignBlockId): number;
636
+
637
+ /**
638
+ * Query if the given block has fill color properties.
639
+ * @param id The block to query.
640
+ * @returns true, if the block has fill color properties.
641
+ */
642
+ hasFillColor(id: DesignBlockId): boolean;
643
+
644
+ /**
645
+ * Set the fill color of the given design block.
646
+ * @param id The block whose fill color should be set.
647
+ * @param color The fill color to be set, a tuple of
648
+ * @param r The red color component in the range of 0 to 1.
649
+ * @param g The green color component in the range of 0 to 1.
650
+ * @param b The blue color component in the range of 0 to 1.
651
+ * @param a The alpha color component in the range of 0 to 1.
652
+ */
653
+ setFillColorRGBA(
654
+ id: DesignBlockId,
655
+ r: number,
656
+ g: number,
657
+ b: number,
658
+ a: number
659
+ ): void;
660
+
661
+ /**
662
+ * Get the fill color of the given design block.
663
+ * @param id The block whose fill color should be queried.
664
+ * @returns The fill color.
665
+ */
666
+ getFillColorRGBA(id: DesignBlockId): RGBA;
667
+
668
+ /**
669
+ * Enable or disable the fill of the given design block.
670
+ * @param id The block whose fill should be enabled or disabled.
671
+ * @param enabled If true, the fill will be enabled.
672
+ */
673
+ setFillColorEnabled(id: DesignBlockId, enabled: boolean): void;
674
+
675
+ /**
676
+ * Query if the fill of the given design block is enabled.
677
+ * @param id The block whose fill state should be queried.
678
+ * @returns True, if fill is enabled.
679
+ */
680
+ isFillColorEnabled(id: DesignBlockId): boolean;
681
+
682
+ /**
683
+ * Query if the given block has background color properties.
684
+ * @param id The block to query.
685
+ * @returns true, if the block has background color properties.
686
+ */
687
+ hasBackgroundColor(id: DesignBlockId): boolean;
688
+
689
+ /**
690
+ * Set the background color of the given design block.
691
+ * @param id The block whose background color should be set.
692
+ * @param color The background color to be set, a tuple of
693
+ * @param r The red color component in the range of 0 to 1.
694
+ * @param g The green color component in the range of 0 to 1.
695
+ * @param b The blue color component in the range of 0 to 1.
696
+ * @param a The alpha color component in the range of 0 to 1.
697
+ */
698
+ setBackgroundColorRGBA(
699
+ id: DesignBlockId,
700
+ r: number,
701
+ g: number,
702
+ b: number,
703
+ a: number
704
+ ): void;
705
+
706
+ /**
707
+ * Get the background color of the given design block.
708
+ * @param id The block whose background color should be queried.
709
+ * @returns The background color.
710
+ */
711
+ getBackgroundColorRGBA(id: DesignBlockId): RGBA;
712
+
713
+ /**
714
+ * Enable or disable the background of the given design block.
715
+ * @param id The block whose background should be enabled or disabled.
716
+ * @param enabled If true, the background will be enabled.
717
+ */
718
+ setBackgroundColorEnabled(id: DesignBlockId, enabled: boolean): void;
719
+
720
+ /**
721
+ * Query if the background of the given design block is enabled.
722
+ * @param id The block whose background state should be queried.
723
+ * @returns True, if background is enabled.
724
+ */
725
+ isBackgroundColorEnabled(id: DesignBlockId): boolean;
726
+
727
+ /**
728
+ * Query if the given block has outline properties.
729
+ * @param id The block to query.
730
+ * @returns true, if the block has outline properties.
731
+ */
732
+ hasOutline(id: DesignBlockId): boolean;
733
+
734
+ /**
735
+ * Set the outline color of the given design block.
736
+ * @param id The block whose outline color should be set.
737
+ * @param color The outline color to be set, a tuple of
738
+ * @param r The red color component in the range of 0 to 1.
739
+ * @param g The green color component in the range of 0 to 1.
740
+ * @param b The blue color component in the range of 0 to 1.
741
+ * @param a The alpha color component in the range of 0 to 1.
742
+ */
743
+ setOutlineColorRGBA(
744
+ id: DesignBlockId,
745
+ r: number,
746
+ g: number,
747
+ b: number,
748
+ a: number
749
+ ): void;
750
+
751
+ /**
752
+ * Get the outline color of the given design block.
753
+ * @param id The block whose outline color should be queried.
754
+ * @returns The outline color.
755
+ */
756
+ getOutlineColorRGBA(id: DesignBlockId): RGBA;
757
+
758
+ /**
759
+ * Enable or disable the outline of the given design block.
760
+ * @param id The block whose outline should be enabled or disabled.
761
+ * @param enabled If true, the outline will be enabled.
762
+ */
763
+ setOutlineEnabled(id: DesignBlockId, enabled: boolean): void;
764
+
765
+ /**
766
+ * Query if the outline of the given design block is enabled.
767
+ * @param id The block whose outline state should be queried.
768
+ * @returns True, if outline is enabled.
769
+ */
770
+ isOutlineEnabled(id: DesignBlockId): boolean;
771
+
772
+ /**
773
+ * Set the outline width of the given design block.
774
+ * @param id The block whose outline width should be set.
775
+ * @param width The outline width to be set.
776
+ */
777
+ setOutlineWidth(id: DesignBlockId, width: number): void;
778
+
779
+ /**
780
+ * Get the outline width of the given design block.
781
+ * @param id The block whose outline width should be queried.
782
+ * @returns The outline width.
783
+ */
784
+ getOutlineWidth(id: DesignBlockId): number;
351
785
  }