@cesdk/node 1.10.0-preview.0 → 1.10.0-preview.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/index.d.ts CHANGED
@@ -103,7 +103,6 @@ export declare class AssetAPI {
103
103
  */
104
104
  removeAssetFromSource(sourceId: string, assetId: string): void;
105
105
 
106
-
107
106
  /**
108
107
  * Apply an asset result to the active scene.
109
108
  * The default behavior will instantiate a block and configure it according to the asset's properties.
@@ -310,10 +309,8 @@ export declare interface AssetSource {
310
309
  addAsset?(asset: AssetDefinition): void;
311
310
  /**
312
311
  * Removes the given asset from this source.
313
- *
314
- * @returns true if asset was found and removed, and false otherwise
315
312
  */
316
- removeAsset?(assetId: string): Promise<boolean>;
313
+ removeAsset?(assetId: string): void;
317
314
  /**
318
315
  * Generates a list of supported mime types for this source.
319
316
  *
@@ -649,6 +646,46 @@ export declare class BlockAPI {
649
646
  * @param mode - The y position mode: absolute, percent or undefined.
650
647
  */
651
648
  setPositionYMode(id: DesignBlockId, mode: PositionMode): void;
649
+ /**
650
+ * Update the block's always-on-top property. If true, this blocks's global sorting order is automatically
651
+ * adjusted to be higher than all other siblings
652
+ * without this property. If more than one block is set to be always-on-top, the child order decides which is on top.
653
+ *
654
+ * @param id - the block to update.
655
+ * @param enabled - whether the block shall be always-on-top.
656
+ */
657
+ setAlwaysOnTop(id: DesignBlockId, enabled: boolean): void;
658
+ /**
659
+ * Query a block's always-on-top property.
660
+ *
661
+ * @param id - the block to query.
662
+ * @returns true if the block is set to be always-on-top, false otherwise.
663
+ */
664
+ isAlwaysOnTop(id: DesignBlockId): boolean;
665
+ /**
666
+ * Updates the sorting order of this block and all of its manually created siblings
667
+ * so that the given block has the highest sorting order.
668
+ * @param id - The id of the block to be given the highest sorting order among its siblings.
669
+ */
670
+ bringToFront(id: DesignBlockId): void;
671
+ /**
672
+ * Updates the sorting order of this block and all of its manually created siblings
673
+ * so that the given block has the lowest sorting order.
674
+ * @param id - The id of the block to be given the lowest sorting order among its siblings.
675
+ */
676
+ sendToBack(id: DesignBlockId): void;
677
+ /**
678
+ * Updates the sorting order of this block and all of its superjacent siblings
679
+ * so that the given block has a higher sorting order than the next superjacent sibling.
680
+ * @param id - The id of the block to be given a higher sorting than the next superjacent sibling.
681
+ */
682
+ bringForward(id: DesignBlockId): void;
683
+ /**
684
+ * Updates the sorting order of this block and all of its manually created and subjacent siblings
685
+ * so that the given block will have a lower sorting order than the next subjacent sibling.
686
+ * @param id - The id of the block to be given a lower sorting order than the next subjacent sibling.
687
+ */
688
+ sendBackward(id: DesignBlockId): void;
652
689
  /**
653
690
  * Query a block's rotation in radians.
654
691
  * @param id - The block to query.
@@ -715,12 +752,6 @@ export declare class BlockAPI {
715
752
  * @returns The current mode for the height: absolute, percent or auto.
716
753
  */
717
754
  getHeightMode(id: DesignBlockId): SizeMode;
718
- /**
719
- * Query a block's content fill mode.
720
- * @param id - The block to query.
721
- * @returns The current mode: crop, cover or contain.
722
- */
723
- getContentFillMode(id: DesignBlockId): ContentFillMode;
724
755
  /**
725
756
  * Update a block's width.
726
757
  * @param id - The block to update.
@@ -745,12 +776,6 @@ export declare class BlockAPI {
745
776
  * @param mode - The height mode: absolute, percent or auto.
746
777
  */
747
778
  setHeightMode(id: DesignBlockId, mode: SizeMode): void;
748
- /**
749
- * Set a block's content fill mode.
750
- * @param id - The block to update.
751
- * @param mode - The content fill mode mode: crop, cover or contain.
752
- */
753
- setContentFillMode(id: DesignBlockId, mode: ContentFillMode): void;
754
779
  /**
755
780
  * Get a block's layout position on the x-axis. The position is only available after an
756
781
  * internal update loop which only occurs if the `features/implicitUpdatesEnabled` setting is set.
@@ -779,6 +804,18 @@ export declare class BlockAPI {
779
804
  * @returns The layout height.
780
805
  */
781
806
  getFrameHeight(id: DesignBlockId): number;
807
+ /**
808
+ * Set a block's content fill mode.
809
+ * @param id - The block to update.
810
+ * @param mode - The content fill mode mode: crop, cover or contain.
811
+ */
812
+ setContentFillMode(id: DesignBlockId, mode: ContentFillMode): void;
813
+ /**
814
+ * Query a block's content fill mode.
815
+ * @param id - The block to query.
816
+ * @returns The current mode: crop, cover or contain.
817
+ */
818
+ getContentFillMode(id: DesignBlockId): ContentFillMode;
782
819
  /**
783
820
  * Duplicates a block including its children.
784
821
  * @param id - The block to duplicate.
@@ -857,6 +894,12 @@ export declare class BlockAPI {
857
894
  * @returns float The height of the axis-aligned bounding box.
858
895
  */
859
896
  getGlobalBoundingBoxHeight(id: DesignBlockId): number;
897
+ /**
898
+ * Get the position and size of the axis-aligned bounding box for the given blocks in screen space.
899
+ * @param ids - The block to query.
900
+ * @returns The position and size of the bounding box.
901
+ */
902
+ getScreenSpaceBoundingBoxXYWH(ids: DesignBlockId[]): XYWH;
860
903
  /**
861
904
  * Scales the block and all of its children proportionally around the specified
862
905
  * relative anchor point.
@@ -2878,6 +2921,47 @@ export declare class SceneAPI {
2878
2921
  * @returns A promise that resolves once the zoom was set or rejects with an error otherwise.
2879
2922
  */
2880
2923
  zoomToBlock(id: DesignBlockId, paddingLeft?: number, paddingTop?: number, paddingRight?: number, paddingBottom?: number): Promise<void>;
2924
+ /**
2925
+ * Continually adjusts the zoom level to fit the width or height of a block's axis-aligned bounding box.
2926
+ * Only has an effect if the zoom level is not handled by the UI.
2927
+ * Without padding, this results in a tight view on the block.
2928
+ * No more than one block per scene can have zoom auto-fit enabled.
2929
+ * Calling `setZoomLevel` or `zoomToBlock` disables the continuous adjustment.
2930
+ *
2931
+ * @param id - The block for which the zoom is adjusted.
2932
+ * @param axis - The block axis for which the zoom is adjusted.
2933
+ * @param paddingBefore - Optional padding in screen pixels before the block.
2934
+ * @param paddingAfter - Optional padding in screen pixels after the block.
2935
+ */
2936
+ enableZoomAutoFit(id: DesignBlockId, axis: 'Horizontal' | 'Vertical', paddingBefore?: number, paddingAfter?: number): void;
2937
+ /**
2938
+ * Continually adjusts the zoom level to fit the width or height of a block's axis-aligned bounding box.
2939
+ * Only has an effect if the zoom level is not handled by the UI.
2940
+ * Without padding, this results in a tight view on the block.
2941
+ * Calling `setZoomLevel` or `zoomToBlock` disables the continuous adjustment.
2942
+ *
2943
+ * @param id - The block for which the zoom is adjusted.
2944
+ * @param axis - The block axis for which the zoom is adjusted.
2945
+ * @param paddingLeft - Optional padding in screen pixels to the left of the block.
2946
+ * @param paddingTop - Optional padding in screen pixels to the top of the block.
2947
+ * @param paddingRight - Optional padding in screen pixels to the right of the block.
2948
+ * @param paddingBottom - Optional padding in screen pixels to the bottom of the block.
2949
+ */
2950
+ enableZoomAutoFit(id: DesignBlockId, axis: 'Both', paddingLeft?: number, paddingTop?: number, paddingRight?: number, paddingBottom?: number): void;
2951
+ /**
2952
+ * Disables any previously set zoom auto-fit.
2953
+ *
2954
+ * @param blockOrScene - The scene or a block in the scene for which to disable a zoom auto-fit.
2955
+ */
2956
+ disableZoomAutoFit(blockOrScene: DesignBlockId): void;
2957
+ /**
2958
+ * Queries whether zoom auto-fit is enabled.
2959
+ *
2960
+ * @param blockOrScene - The scene or a block in the scene for which to disable a zoom auto-fit.
2961
+ * @returns True if the given block has auto-fit set or the scene contains a block for which auto-fit is set, false
2962
+ * otherwise.
2963
+ */
2964
+ isZoomAutoFitEnabled(blockOrScene: DesignBlockId): boolean;
2881
2965
  /**
2882
2966
  * Subscribe to changes to the zoom level.
2883
2967
  * @param callback - This function is called at the end of the engine update, if the zoom level has changed.
@@ -3031,4 +3115,15 @@ export declare interface Vec4 {
3031
3115
  w: number;
3032
3116
  }
3033
3117
 
3118
+ /**
3119
+ * Describes a rectangle on the screen
3120
+ * - `x` and `y` indicate the position
3121
+ * - `w` and `h` indicate the width and height
3122
+ * @public
3123
+ */
3124
+ export declare type XYWH = [x: number, y: number, w: number, h: number];
3125
+
3126
+ /** @public */
3127
+ export declare type ZoomAutoFitAxis = 'Horizontal' | 'Vertical' | 'Both';
3128
+
3034
3129
  export { }