@cesdk/cesdk-js 1.4.0-alpha.5 → 1.4.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/BlockAPI.d.ts CHANGED
@@ -1,16 +1,44 @@
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'
7
7
  | 'image/x-tga'
8
8
  | 'application/octet-stream';
9
- type Size = number; // | 'auto';
10
9
  type Size2 = {
11
- width: Size;
12
- height: Size;
10
+ width: number;
11
+ height: number;
13
12
  };
13
+ type RGBA = [r: number, g: number, b: number, a: number];
14
+
15
+ export enum PositionMode {
16
+ /** Position in absolute design units. */
17
+ Absolute = 'Absolute',
18
+ /** Position in relation to the block's parent's size in percent, where 1.0 means 100%. */
19
+ Percent = 'Percent',
20
+ /** Position is automatically determined. */
21
+ Undefined = 'Auto'
22
+ }
23
+
24
+ export enum SizeMode {
25
+ /** Size in absolute design units. */
26
+ Absolute = 'Absolute',
27
+ /** Size in relation to the block's parent's size in percent, where 1.0 means 100%. */
28
+ Percent = 'Percent',
29
+ /** Size is determined by the block's content. */
30
+ Auto = 'Auto'
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
+ }
14
42
 
15
43
  export default class BlockAPI {
16
44
  /**
@@ -20,7 +48,7 @@ export default class BlockAPI {
20
48
  * @param mimeType The mime type of the output file. Defaults to 'image/png'
21
49
  * @returns A promise that resolves with the exported image or is rejected with an error.
22
50
  */
23
- export(handle: DesignElementId, mimeType?: MimeType): Promise<Blob>;
51
+ export(handle: DesignBlockId, mimeType?: MimeType): Promise<Blob>;
24
52
 
25
53
  /**
26
54
  * Loads existing blocks from the given string.
@@ -28,7 +56,7 @@ export default class BlockAPI {
28
56
  * @param content A string representing the given blocks.
29
57
  * @returns A promise that resolves with a list of handles representing the found blocks or an error.
30
58
  */
31
- loadFromString(content: string): Promise<DesignElementId[]>;
59
+ loadFromString(content: string): Promise<DesignBlockId[]>;
32
60
 
33
61
  /**
34
62
  * Saves the given blocks into a string. If given the root of a block hierarchy, e.g. a
@@ -36,14 +64,14 @@ export default class BlockAPI {
36
64
  * @param blocks
37
65
  * @returns A promise that resolves to a string representing the blocks or an error.
38
66
  */
39
- saveToString(blocks: DesignElementId[]): Promise<string>;
67
+ saveToString(blocks: DesignBlockId[]): Promise<string>;
40
68
 
41
69
  /**
42
70
  * Create a new block, fails if type is unknown.
43
71
  * @param type The type of the block that shall be created.
44
72
  * @returns The created blocks handle.
45
73
  */
46
- create(type: DesignElementType): DesignElementId;
74
+ create(type: DesignBlockType): DesignBlockId;
47
75
 
48
76
  /**
49
77
 
@@ -51,7 +79,7 @@ export default class BlockAPI {
51
79
  * @param id The block to query.
52
80
  * @returns The blocks type.
53
81
  */
54
- getType(id: DesignElementId): DesignElementType;
82
+ getType(id: DesignBlockId): DesignBlockType;
55
83
 
56
84
  /**
57
85
  * Update the selection state of a block.
@@ -59,53 +87,60 @@ export default class BlockAPI {
59
87
  * @param id The block to query.
60
88
  * @param selected Whether or not the block should be selected.
61
89
  */
62
- setSelected(id: DesignElementId, selected: boolean): void;
90
+ setSelected(id: DesignBlockId, selected: boolean): void;
63
91
 
64
92
  /**
65
93
  * Get the selected state of a block.
66
94
  * @param id The block to query.
67
95
  * @returns True if the block is selected, false otherwise.
68
96
  */
69
- isSelected(id: DesignElementId): boolean;
97
+ isSelected(id: DesignBlockId): boolean;
70
98
 
71
99
  /**
72
100
  * Get all currently selected blocks.
73
101
  * @returns An array of block ids.
74
102
  */
75
- 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;
76
111
 
77
112
  /**
78
113
  * Update a block's name.
79
114
  * @param id The block to update.
80
115
  * @param name The name to set.
81
116
  */
82
- setName(id: DesignElementId, name: string): void;
117
+ setName(id: DesignBlockId, name: string): void;
83
118
 
84
119
  /**
85
120
  * Get a block's name.
86
121
  * @param id The block to update.
87
122
  */
88
- getName(id: DesignElementId): string;
123
+ getName(id: DesignBlockId): string;
89
124
 
90
125
  /**
91
126
  * Finds all blocks with the given name.
92
127
  * @param name The name to search for.
93
128
  * @returns A list of block ids.
94
129
  */
95
- findByName(name: string): DesignElementId[];
130
+ findByName(name: string): DesignBlockId[];
96
131
 
97
132
  /**
98
133
  * Finds all blocks with the given type.
99
134
  * @param type The type to search for.
100
135
  * @returns A list of block ids.
101
136
  */
102
- findByType(type: DesignElementType): DesignElementId[];
137
+ findByType(type: DesignBlockType): DesignBlockId[];
103
138
 
104
139
  /**
105
140
  * Return all blocks currently known to the engine.
106
141
  * @returns A list of block ids.
107
142
  */
108
- findAll(): /* filterSpec?: unknown */ DesignElementId[];
143
+ findAll(): /* filterSpec?: unknown */ DesignBlockId[];
109
144
 
110
145
  // Element
111
146
 
@@ -114,113 +149,202 @@ export default class BlockAPI {
114
149
  * @param id The block to query.
115
150
  * @returns True if visible, false otherwise.
116
151
  */
117
- isVisible(id: DesignElementId): boolean;
152
+ isVisible(id: DesignBlockId): boolean;
118
153
 
119
154
  /**
120
155
  * Update a block's visibility.
121
156
  * @param id The block to update.
122
157
  * @param visible Whether the block shall be visible.
123
158
  */
124
- setVisible(id: DesignElementId, visible: boolean): void;
159
+ setVisible(id: DesignBlockId, visible: boolean): void;
160
+
161
+ /**
162
+ * Query a block's x position.
163
+ * @param id The block to query.
164
+ * @returns The value of the x position.
165
+ */
166
+ getPositionX(id: DesignBlockId): number;
167
+
168
+ /**
169
+ * Query a block's mode for its x position.
170
+ * @param id The block to query.
171
+ * @returns The current mode for the x position: absolute, percent or undefined.
172
+ */
173
+ getPositionXMode(id: DesignBlockId): PositionMode;
125
174
 
126
175
  /**
127
- * Query a block's absolute position in design units.
176
+ * Query a block's y position.
128
177
  * @param id The block to query.
129
- * @returns
178
+ * @returns The value of the y position.
179
+ */
180
+ getPositionY(id: DesignBlockId): number;
181
+
182
+ /**
183
+ * Query a block's mode for its y position.
184
+ * @param id The block to query.
185
+ * @returns The current mode for the y position: absolute, percent or undefined.
186
+ */
187
+ getPositionYMode(id: DesignBlockId): PositionMode;
188
+
189
+ /**
190
+ * Update a block's x position.
191
+ * @param id The block to update.
192
+ * @param value The value of the x position.
193
+ */
194
+ setPositionX(id: DesignBlockId, value: number): void;
195
+
196
+ /**
197
+ * Set a block's mode for its x position.
198
+ * @param id The block to update.
199
+ * @param mode The x position mode: absolute, percent or undefined.
200
+ */
201
+ setPositionXMode(id: DesignBlockId, mode: PositionMode): void;
202
+
203
+ /**
204
+ * Update a block's y position.
205
+ * @param id The block to update.
206
+ * @param value The value of the y position.
130
207
  */
131
- getPosition(id: DesignElementId): Vec2;
208
+ setPositionY(id: DesignBlockId, value: number): void;
132
209
 
133
210
  /**
134
- * Update a block's absolute position.
211
+ * Set a block's mode for its y position.
135
212
  * @param id The block to update.
136
- * @param { x, y } pos The new position in design units.
213
+ * @param mode The y position mode: absolute, percent or undefined.
137
214
  */
138
- setPosition(id: DesignElementId, { x, y }: Vec2): void;
215
+ setPositionYMode(id: DesignBlockId, mode: PositionMode): void;
139
216
 
140
217
  /**
141
218
  * Query a block's rotation in radians.
142
219
  * @param id The block to query.
143
220
  * @returns The block's rotation around its center in radians.
144
221
  */
145
- getRotation(id: DesignElementId): number;
222
+ getRotation(id: DesignBlockId): number;
146
223
 
147
224
  /**
148
225
  * Update a block's rotation.
149
226
  * @param id The block to update.
150
227
  * @param radians The new rotation in radians. Rotation is applied around the block's center.
151
228
  */
152
- setRotation(id: DesignElementId, radians: number): void;
229
+ setRotation(id: DesignBlockId, radians: number): void;
153
230
 
154
231
  /**
155
232
  * Query a block's horizontal flip state.
156
233
  * @param id The block to query.
157
234
  * @returns A boolean indicating for whether the block is flipped in the queried direction
158
235
  */
159
- getFlipHorizontal(id: DesignElementId): boolean;
236
+ getFlipHorizontal(id: DesignBlockId): boolean;
160
237
 
161
238
  /**
162
239
  * Query a block's vertical flip state.
163
240
  * @param id The block to query.
164
241
  * @returns A boolean indicating for whether the block is flipped in the queried direction
165
242
  */
166
- getFlipVertical(id: DesignElementId): boolean;
243
+ getFlipVertical(id: DesignBlockId): boolean;
167
244
 
168
245
  /**
169
246
  * Update a block's horizontal flip.
170
247
  * @param id The block to update.
171
248
  * @param horizontal Whether the block should be flipped along its x-axis.
172
- * @returns
173
249
  */
174
- setFlipHorizontal(id: DesignElementId, flip: boolean): void;
250
+ setFlipHorizontal(id: DesignBlockId, flip: boolean): void;
175
251
 
176
252
  /**
177
253
  * Update a block's vertical flip.
178
254
  * @param id The block to update.
179
255
  * @param vertical Whether the block should be flipped along its y-axis.
180
- * @returns
181
256
  */
182
- setFlipVertical(id: DesignElementId, flip: boolean): void;
257
+ setFlipVertical(id: DesignBlockId, flip: boolean): void;
258
+
259
+ /**
260
+ * Query a block's width.
261
+ * @param id The block to query.
262
+ * @returns The value of the block's width.
263
+ */
264
+ getWidth(id: DesignBlockId): number;
265
+
266
+ /**
267
+ * Query a block's mode for its width.
268
+ * @param id The block to query.
269
+ * @returns The current mode for the width: absolute, percent or auto.
270
+ */
271
+ getWidthMode(id: DesignBlockId): SizeMode;
272
+
273
+ /**
274
+ * Query a block's height.
275
+ * @param id The block to query.
276
+ * @returns The value of the block's height.
277
+ */
278
+ getHeight(id: DesignBlockId): number;
183
279
 
184
280
  /**
185
- * Query a block's absolute size in design units.
281
+ * Query a block's mode for its height.
186
282
  * @param id The block to query.
187
- * @returns A `Size2` object.
283
+ * @returns The current mode for the height: absolute, percent or auto.
284
+ */
285
+ getHeightMode(id: DesignBlockId): SizeMode;
286
+
287
+ /**
288
+ * Update a block's width.
289
+ * @param id The block to update.
290
+ * @param value The new width of the block.
291
+ */
292
+ setWidth(id: DesignBlockId, value: number): void;
293
+
294
+ /**
295
+ * Set a block's mode for its width.
296
+ * @param id The block to update.
297
+ * @param mode The width mode: absolute, percent or auto.
188
298
  */
189
- getSize(id: DesignElementId): Size2;
299
+ setWidthMode(id: DesignBlockId, mode: SizeMode): void;
190
300
 
191
301
  /**
192
- * Update a block's absolute size in design units.
302
+ * Update a block's height.
193
303
  * @param id The block to update.
194
- * @param size A size object defining width and height.
304
+ * @param value The new height of the block.
195
305
  */
196
- setSize(id: DesignElementId, size: Size2): void;
306
+ setHeight(id: DesignBlockId, value: number): void;
197
307
 
198
308
  /**
199
- * Get a block's layouted size. Requires an `engine.render()` beforehand.
309
+ * Set a block's mode for its height.
310
+ * @param id The block to update.
311
+ * @param mode The height mode: absolute, percent or auto.
312
+ */
313
+ setHeightMode(id: DesignBlockId, mode: SizeMode): void;
314
+
315
+ /**
316
+ * Get a block's layouted width. Requires an `engine.render()` beforehand.
200
317
  * @param id The block to query.
201
- * @returns A `Size2` object holding the size.
318
+ * @returns The layouted width.
202
319
  */
203
- 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;
204
328
 
205
329
  /**
206
330
  * Duplicates a block including its children.
207
331
  * @param id The block to duplicate.
208
332
  * @returns The handle of the duplicate.
209
333
  */
210
- duplicate(id: DesignElementId): DesignElementId;
334
+ duplicate(id: DesignBlockId): DesignBlockId;
211
335
 
212
336
  /**
213
337
  * Destroys a block.
214
338
  * @param id The block to destroy.
215
339
  */
216
- destroy(id: DesignElementId): void;
340
+ destroy(id: DesignBlockId): void;
217
341
 
218
342
  /**
219
343
  * Query a block's parent.
220
344
  * @param id The block to query.
221
345
  * @returns The parent's handle.
222
346
  */
223
- getParent(id: DesignElementId): DesignElementId;
347
+ getParent(id: DesignBlockId): DesignBlockId;
224
348
 
225
349
  /**
226
350
  * Get all children of the given block. Children
@@ -229,7 +353,7 @@ export default class BlockAPI {
229
353
  * @param id The block to query.
230
354
  * @returns A list of block ids.
231
355
  */
232
- getChildren(id: DesignElementId): DesignElementId[];
356
+ getChildren(id: DesignBlockId): DesignBlockId[];
233
357
 
234
358
  /**
235
359
  * Insert a new or existing child at a certain position in the parent's children.
@@ -237,16 +361,425 @@ export default class BlockAPI {
237
361
  * @param child The child to insert. Can be an existing child of `parent`.
238
362
  * @param index The index to insert or move to.
239
363
  */
240
- insertChild(
241
- parent: DesignElementId,
242
- child: DesignElementId,
243
- index: number
244
- ): void;
364
+ insertChild(parent: DesignBlockId, child: DesignBlockId, index: number): void;
245
365
 
246
366
  /**
247
367
  * Appends a new or existing child to a block's children.
248
368
  * @param parent The block whose children should be updated.
249
369
  * @param child The child to insert. Can be an existing child of `parent`.
250
370
  */
251
- 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;
252
785
  }