- Introduced `getLayerMask` utility to streamline layer mask retrieval. - Updated layer rendering logic to incorporate layer masks and opacity adjustments. - Added functionality to prevent dropping a group into its descendants. - Enhanced image texture rendering to support opacity parameters across various rendering functions. - Implemented group layer bounds application for better scaling and positioning. - Added tests to ensure correct behavior when handling layer masks and group layers. - Created new types for asset generation provenance to track generated assets more effectively.
19 lines
482 B
TypeScript
19 lines
482 B
TypeScript
import type { Layer } from "./layer";
|
|
import type { LayerMask } from "./layer-mask";
|
|
|
|
export function getLayerMask(layer: Layer | undefined): LayerMask | undefined {
|
|
if (layer.layerMask) return layer.layerMask;
|
|
if (!layer.clippingMask) return undefined;
|
|
|
|
return {
|
|
kind: "raster",
|
|
maskLayerId: layer.clippingMask.maskLayerId,
|
|
enabled: true,
|
|
inverted: false,
|
|
};
|
|
}
|
|
|
|
export function hasLayerMask(layer: Layer): boolean {
|
|
return Boolean(getLayerMask(layer));
|
|
}
|