1/* 2 * Copyright (c) 2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16import { PhotoEditMode } from '../base/PhotoEditType'; 17 18export enum ID { 19 CROP = 100, 20 CROP_ROTATE, 21 CROP_MIRROR, 22 DEFAULT 23} 24 25export interface ActionInfo { 26 src ?: Resource; 27 isActive ?: boolean; 28 actionID?: number | PhotoEditMode; 29 text ?: Resource; 30 mode ?: number; 31 height ?: Resource; 32 width ?: Resource 33 color ?: Resource; 34 uri ?: string; 35 componentKey ?: string; 36} 37 38export class ActionButtonInfo { 39 src?: Resource; 40 isActive: boolean; 41 isDoubleClicked: boolean; 42 actionID?: number; 43 text: Resource | null = null; 44 mode: number = 0; 45 height: Resource | null = null; 46 width: Resource | null = null; 47 color: Resource | null = null; 48 uri: string = ''; 49 componentKey: string; 50 51 constructor(action: ActionInfo) { 52 this.src = action.src == undefined ? undefined : action.src; 53 this.actionID = action.actionID as number; 54 this.isDoubleClicked = false; 55 this.componentKey = action.componentKey as string; 56 if (action.isActive != undefined) { 57 this.isActive = action.isActive; 58 } else { 59 this.isActive = false; 60 } 61 if (action.text != undefined) { 62 this.text = action.text; 63 } 64 if (action.mode != undefined) { 65 this.mode = action.mode; 66 } 67 if (action.height != undefined) { 68 this.height = action.height; 69 } 70 if (action.width != undefined) { 71 this.width = action.width; 72 } 73 if (action.color != undefined) { 74 this.color = action.color; 75 } 76 if (action.uri != undefined) { 77 this.uri = action.uri; 78 } 79 } 80} 81 82