142365ec6Sopenharmony_ci/*
242365ec6Sopenharmony_ci * Copyright (c) 2023 Huawei Device Co., Ltd.
342365ec6Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
442365ec6Sopenharmony_ci * you may not use this file except in compliance with the License.
542365ec6Sopenharmony_ci * You may obtain a copy of the License at
642365ec6Sopenharmony_ci *
742365ec6Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
842365ec6Sopenharmony_ci *
942365ec6Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
1042365ec6Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
1142365ec6Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1242365ec6Sopenharmony_ci * See the License for the specific language governing permissions and
1342365ec6Sopenharmony_ci * limitations under the License.
1442365ec6Sopenharmony_ci */
1542365ec6Sopenharmony_ci
1642365ec6Sopenharmony_ciimport { Action } from '../redux/actions/Action'
1742365ec6Sopenharmony_ciimport { Log } from '../utils/Log'
1842365ec6Sopenharmony_ciimport { BaseFunction } from './BaseFunction'
1942365ec6Sopenharmony_ci
2042365ec6Sopenharmony_ciexport class ZoomFunction extends BaseFunction {
2142365ec6Sopenharmony_ci  private TAG = '[ZoomFunction]:'
2242365ec6Sopenharmony_ci
2342365ec6Sopenharmony_ci  private async changeZoomRatio(data) {
2442365ec6Sopenharmony_ci    Log.info(`${this.TAG} setZoomRatio ${JSON.stringify(data)}  E`)
2542365ec6Sopenharmony_ci    await this.mCameraService.setZoomRatio(data.zoomRatio)
2642365ec6Sopenharmony_ci    Log.info(`${this.TAG} setZoomRatio X`)
2742365ec6Sopenharmony_ci  }
2842365ec6Sopenharmony_ci
2942365ec6Sopenharmony_ci  load(): void {
3042365ec6Sopenharmony_ci    Log.info(`${this.TAG} load E`)
3142365ec6Sopenharmony_ci    this.mEventBus.on(Action.ACTION_CHANGE_ZOOM_RATIO, this.changeZoomRatio.bind(this))
3242365ec6Sopenharmony_ci    Log.info(`${this.TAG} load X`)
3342365ec6Sopenharmony_ci  }
3442365ec6Sopenharmony_ci
3542365ec6Sopenharmony_ci  unload(): void {
3642365ec6Sopenharmony_ci    Log.info(`${this.TAG} unload E`)
3742365ec6Sopenharmony_ci    this.mEventBus.off(Action.ACTION_CHANGE_ZOOM_RATIO, this.changeZoomRatio.bind(this))
3842365ec6Sopenharmony_ci    Log.info(`${this.TAG} unload X`)
3942365ec6Sopenharmony_ci  }
4042365ec6Sopenharmony_ci}