Layer opacity (#312)

Closes #187

* Add layer opacity input

* Improve Rust code cleanliness
This commit is contained in:
Keavon Chambers
2021-07-27 23:15:23 -07:00
parent 12fc330952
commit 0cdd1762b8
9 changed files with 86 additions and 18 deletions

View File

@@ -244,10 +244,15 @@ function newBlendMode(input: string): BlendMode {
return blendMode;
}
function newOpacity(input: number): number {
return input * 100;
}
export interface LayerPanelEntry {
name: string;
visible: boolean;
blend_mode: BlendMode;
opacity: number;
layer_type: LayerType;
path: BigUint64Array;
layer_data: LayerData;
@@ -258,6 +263,7 @@ function newLayerPanelEntry(input: any): LayerPanelEntry {
name: input.name,
visible: input.visible,
blend_mode: newBlendMode(input.blend_mode),
opacity: newOpacity(input.opacity),
layer_type: newLayerType(input.layer_type),
layer_data: newLayerData(input.layer_data),
path: new BigUint64Array(input.path.map((n: number) => BigInt(n))),