mirror of
https://gitee.com/openharmony/applications_photos
synced 2024-11-27 01:01:06 +00:00
!573 【master】修复告警,使用字面量风格的声明与使用T[]表示数组类型
Merge pull request !573 from liujuan/master
This commit is contained in:
commit
6cc88c47c5
@ -221,21 +221,21 @@ export class HistogramManager {
|
||||
private drawSingleHistogram(array: Uint32Array, color: string): void {
|
||||
let width = this.width;
|
||||
let height = this.height;
|
||||
const start_axis: number = 0;
|
||||
const startAxis: number = 0;
|
||||
let peakPoint: number = Math.max(...array);
|
||||
if (peakPoint === 0) {
|
||||
Log.warn(TAG, 'peakPoint is zero');
|
||||
return;
|
||||
}
|
||||
let x_step = width / Constants.PIXEL_NUMBER;
|
||||
let y_step = height / peakPoint;
|
||||
let xStep = width / Constants.PIXEL_NUMBER;
|
||||
let yStep = height / peakPoint;
|
||||
let region = new Path2D();
|
||||
// 移动到起始位置
|
||||
region.moveTo(start_axis, height);
|
||||
let last = 0;
|
||||
for (let pixelValue = 0; pixelValue < array.length; pixelValue++) {
|
||||
let v1 = pixelValue * x_step;
|
||||
let v2 = y_step * array[pixelValue];
|
||||
let v1 = pixelValue * xStep;
|
||||
let v2 = yStep * array[pixelValue];
|
||||
let value = height - v2;
|
||||
region.lineTo(v1, value);
|
||||
last = v1;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -28,7 +28,7 @@ export enum DeviceType {
|
||||
PC_LIKE
|
||||
}
|
||||
|
||||
const TabMap = [
|
||||
const tabMap = [
|
||||
BigDataConstants.PHOTO_TAB,
|
||||
BigDataConstants.ALBUM_TAB
|
||||
]
|
||||
@ -168,7 +168,7 @@ export struct TabBar {
|
||||
tab.isSelected = false;
|
||||
}
|
||||
})
|
||||
let currentTab: string = TabMap[this.currentIndex] ? TabMap[this.currentIndex] : BigDataConstants.PHOTO_TAB;
|
||||
let currentTab: string = tabMap[this.currentIndex] ? tabMap[this.currentIndex] : BigDataConstants.PHOTO_TAB;
|
||||
interface Msg {
|
||||
switchTab: string;
|
||||
current: string;
|
||||
@ -355,18 +355,18 @@ export struct TabBarForAlbumSet {
|
||||
struct TabWithText {
|
||||
@Consume isAlbumSetSelectedMode: boolean;
|
||||
@ObjectLink tabItemWithText: TabItemWithText;
|
||||
@State TabWidth: number = 0;
|
||||
@State tabWidth: number = 0;
|
||||
index: number = 0;
|
||||
onTabSelected?: Function;
|
||||
|
||||
aboutToAppear(): void {
|
||||
// Determine the length of the underline based on the font length
|
||||
if (this.index == 0) {
|
||||
this.TabWidth = px2vp(fp2px(Constants.TEXT_SIZE_SUB_TITLE2)) * 2;
|
||||
this.tabWidth = px2vp(fp2px(Constants.TEXT_SIZE_SUB_TITLE2)) * 2;
|
||||
} else {
|
||||
this.TabWidth = px2vp(fp2px(Constants.TEXT_SIZE_SUB_TITLE2)) * 4;
|
||||
this.tabWidth = px2vp(fp2px(Constants.TEXT_SIZE_SUB_TITLE2)) * 4;
|
||||
}
|
||||
Log.info(TAG, `index is ${this.index} and TabWidth is ${this.TabWidth}`);
|
||||
Log.info(TAG, `index is ${this.index} and tabWidth is ${this.tabWidth}`);
|
||||
}
|
||||
|
||||
build() {
|
||||
@ -385,7 +385,7 @@ struct TabWithText {
|
||||
right: $r('app.float.single_tab_margin'),
|
||||
bottom: $r('app.float.tab_bar_line_margin_top') })
|
||||
Column()
|
||||
.width(this.TabWidth)
|
||||
.width(this.tabWidth)
|
||||
.height($r('app.float.tab_bar_line_height'))
|
||||
.borderRadius($r('app.float.tab_bar_line_radius'))
|
||||
.backgroundColor(this.tabItemWithText.getTextColor())
|
||||
|
@ -36,7 +36,7 @@ export struct ThirdSelectPhotoBrowserActionBar {
|
||||
@Link isShowBar: boolean;
|
||||
@Provide('selectedCount') selectedCount: number = 0;
|
||||
@Link @Watch('onSelectedCountChanged') totalSelectedCount: number;
|
||||
@Provide moreMenuList: Action[] = new Array<Action>();
|
||||
@Provide moreMenuList: Action[] = [];
|
||||
@Provide hidePopup: boolean = false;
|
||||
private title: string | Resource = '';
|
||||
private isThird: boolean = false;
|
||||
@ -76,7 +76,7 @@ export struct ThirdSelectPhotoBrowserActionBar {
|
||||
private createActionBar(): void {
|
||||
let actionBarProp: ActionBarProp = new ActionBarProp();
|
||||
|
||||
let menuList: Array<Action> = new Array<Action>();
|
||||
let menuList: Action[] = [];
|
||||
if (this.canEdit) {
|
||||
menuList.push(Action.EDIT);
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ export struct ActionBar {
|
||||
@Prop isNeedPlaceholder: boolean = false;
|
||||
|
||||
createArray(): ActionBarProp[] {
|
||||
let actionBarProps = new Array<ActionBarProp>();
|
||||
let actionBarProps: ActionBarProp[] = [];
|
||||
actionBarProps.push(this.actionBarProp);
|
||||
return actionBarProps;
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ export struct MediaOperationActionBar {
|
||||
ScreenManager.getInstance().isHorizontal();
|
||||
@State actionBarProp: ActionBarProp = new ActionBarProp();
|
||||
@StorageLink('statusBarHeight') statusBarHeight: number = 0;
|
||||
@Provide moreMenuList: Action[] = new Array<Action>();
|
||||
@Provide moreMenuList: Action[] = [];
|
||||
@Provide hidePopup: boolean = false;
|
||||
|
||||
aboutToAppear(): void {
|
||||
@ -54,7 +54,7 @@ export struct MediaOperationActionBar {
|
||||
}
|
||||
|
||||
private createActionBar(): void {
|
||||
let menuList: Array<Action> = new Array<Action>();
|
||||
let menuList: Action[] = [];
|
||||
let actionBarProp: ActionBarProp = new ActionBarProp();
|
||||
if (this.loadingFinish) {
|
||||
menuList.push(Action.NEW);
|
||||
|
@ -258,7 +258,7 @@ export struct AlbumGridItemNewStyle {
|
||||
}
|
||||
|
||||
initCurrentRightClickMenuList() {
|
||||
this.currentRightClickMenuList = new Array<Action>();
|
||||
this.currentRightClickMenuList = [];
|
||||
if (!this.isAlbumSetSelectedMode) {
|
||||
this.currentRightClickMenuList.push(Action.MULTISELECT);
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ export struct AlbumSelectActionBar {
|
||||
|
||||
private createActionBar(): void {
|
||||
this.selectedCount = this.totalSelectedCount;
|
||||
let menuList: Array<Action> = new Array<Action>();
|
||||
let menuList: Action[] = [];
|
||||
let actionBarProp: ActionBarProp = new ActionBarProp();
|
||||
menuList.push(Boolean(this.totalSelectedCount) ? Action.OK : Action.OK_DISABLE);
|
||||
actionBarProp
|
||||
|
@ -71,7 +71,7 @@ export struct AlbumSetPage {
|
||||
isDataFreeze: boolean = false;
|
||||
// the switch of distributed page
|
||||
@Provide isTabBarShow: boolean = false;
|
||||
@Provide rightClickMenuList: Array<Action> = new Array<Action>();
|
||||
@Provide rightClickMenuList: Action[] = [];
|
||||
@StorageLink('isHorizontal') isHorizontal: boolean = ScreenManager.getInstance().isHorizontal();
|
||||
@StorageLink('statusBarHeight') statusBarHeight: number = 0;
|
||||
@StorageLink('deviceType') deviceType: string | undefined = AppStorage.get<string>('deviceType');
|
||||
@ -254,7 +254,7 @@ export struct AlbumSetPage {
|
||||
|
||||
updateRightClickMenuList() {
|
||||
if (this.isAlbumSetSelectedMode) {
|
||||
this.rightClickMenuList = new Array<Action>();
|
||||
this.rightClickMenuList = [];
|
||||
if (!this.isDisableRename && this.selectedAlbumsCount == 1) {
|
||||
this.rightClickMenuList.push(Action.RENAME);
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ export struct AlbumSetPageActionBar {
|
||||
@StorageLink('statusBarHeight') statusBarHeight: number = 0;
|
||||
onMenuClicked: Function = (): void => {};
|
||||
@State isNeedPlaceholder: boolean = true;
|
||||
@Provide moreMenuList: Action[] = new Array<Action>();
|
||||
@Provide moreMenuList: Action[] = [];
|
||||
@Provide hidePopup: boolean = false;
|
||||
private deviceType: string = '';
|
||||
private actionBarPaddingTop: number | Resource = 0;
|
||||
@ -90,7 +90,7 @@ export struct AlbumSetPageActionBar {
|
||||
private createHorizontalActionBar(): ActionBarProp {
|
||||
Log.info(TAG, `createHorizontalActionBar, isAlbumSetSelectedMode: ${this.isAlbumSetSelectedMode}`);
|
||||
|
||||
let menuList: Array<Action> = new Array<Action>();
|
||||
let menuList: Action[] = [];
|
||||
let actionBarProp: ActionBarProp = new ActionBarProp();
|
||||
|
||||
actionBarProp
|
||||
@ -125,7 +125,7 @@ export struct AlbumSetPageActionBar {
|
||||
private createActionBar(): ActionBarProp {
|
||||
Log.info(TAG, `createActionBar, isAlbumSetSelectedMode: ${this.isAlbumSetSelectedMode}`);
|
||||
|
||||
let menuList: Array<Action> = new Array<Action>();
|
||||
let menuList: Action[] = [];
|
||||
let actionBarProp: ActionBarProp = new ActionBarProp();
|
||||
|
||||
menuList.push(Action.NEW);
|
||||
|
@ -21,8 +21,8 @@ const TAG: string = 'browser_AlbumSetPageToolBar';
|
||||
@Component
|
||||
export struct AlbumSetPageToolBar {
|
||||
@Provide isShowBar: boolean = true;
|
||||
@Provide toolMenuList: Array<Action> = new Array<Action>();
|
||||
@Provide moreMenuList: Action[] = new Array<Action>();
|
||||
@Provide toolMenuList: Action[] = [];
|
||||
@Provide moreMenuList: Action[] = [];
|
||||
@Consume @Watch('updateToolbar') isAlbumSetSelectedMode: boolean;
|
||||
@Consume('selectedCount') @Watch('updateToolbar') selectedAlbumsCount: number;
|
||||
@Consume isDisableRename: boolean;
|
||||
|
@ -32,7 +32,7 @@ export struct NewAlbumPageActionBar {
|
||||
@StorageLink('isHorizontal') @Watch('createActionBar') isHorizontal: boolean = ScreenManager.getInstance()
|
||||
.isHorizontal();
|
||||
@State actionBarProp: ActionBarProp = new ActionBarProp();
|
||||
@Provide moreMenuList: Action[] = new Array<Action>();
|
||||
@Provide moreMenuList: Action[] = [];
|
||||
@Provide hidePopup: boolean = false;
|
||||
|
||||
aboutToAppear(): void {
|
||||
|
@ -85,8 +85,8 @@ export class BatchRecoverMenuOperation extends ProcessMenuOperation {
|
||||
let endIndex = this.currentBatch * this.BATCH_SIZE;
|
||||
endIndex = Math.min(endIndex, this.uris.length);
|
||||
let operationImpl = BrowserOperationFactory.getFeature(BrowserOperationFactory.TYPE_PHOTO);
|
||||
let fileAssets = new Array<FileAsset>();
|
||||
let uris: Array<string> = new Array();
|
||||
let fileAssets: FileAsset[] = [];
|
||||
let uris: string[] = [];
|
||||
for (let index = startIndex; index < endIndex; index++) {
|
||||
uris.push(this.uris[index]);
|
||||
|
||||
|
@ -73,7 +73,7 @@ export struct PhotoGridPageActionBar {
|
||||
}
|
||||
|
||||
private createHorizontalActionBar(): ActionBarProp {
|
||||
let menuList: Array<Action> = new Array<Action>();
|
||||
let menuList: Action[] = [];
|
||||
let actionBarProp: ActionBarProp = new ActionBarProp();
|
||||
|
||||
actionBarProp
|
||||
@ -116,7 +116,7 @@ export struct PhotoGridPageActionBar {
|
||||
}
|
||||
|
||||
private createActionBar(): ActionBarProp {
|
||||
let menuList: Array<Action> = new Array<Action>();
|
||||
let menuList: Action[] = [];
|
||||
let actionBarProp: ActionBarProp = new ActionBarProp();
|
||||
|
||||
if (!this.isSystemAlbum && this.isDistributedAlbum == false) {
|
||||
|
@ -28,7 +28,7 @@ export struct PhotoGridPageToolBar {
|
||||
isRecycleAlbum: boolean = false;
|
||||
onMenuClicked: Function = (): void => {};
|
||||
isDistributedAlbum: boolean = false;
|
||||
@Provide toolMenuList: Array<Action> = new Array<Action>();
|
||||
@Provide toolMenuList: Action[] = [];
|
||||
@Consume hidePopup: boolean;
|
||||
|
||||
aboutToAppear(): void {
|
||||
|
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/**
|
||||
* Copyright (c) 2022-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -33,7 +33,7 @@ export struct CropRulerBar {
|
||||
@State rulerWidth: number = Constants.NUMBER_0;
|
||||
@Consume('verticalScreen') isVerticalScreen: boolean;
|
||||
private screenManager = ScreenManager.getInstance();
|
||||
private current_def: number = Constants.NUMBER_0;
|
||||
private currentDef: number = Constants.NUMBER_0;
|
||||
private startPos: number = Constants.NUMBER_0;
|
||||
private setting: RenderingContextSettings = new RenderingContextSettings(true);
|
||||
private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.setting);
|
||||
@ -73,30 +73,30 @@ export struct CropRulerBar {
|
||||
}
|
||||
|
||||
drawMidLine(): void {
|
||||
const mid_x = Math.floor(this.rulerLength / Constants.NUMBER_2);
|
||||
const midX= Math.floor(this.rulerLength / Constants.NUMBER_2);
|
||||
this.context.beginPath();
|
||||
this.context.fillStyle = Constants.RULER_FILL_STYLE_100;
|
||||
if (this.isVerticalScreen) {
|
||||
this.context.fillRect(mid_x - Constants.MID_LINE_WIDTH / Constants.NUMBER_2,
|
||||
this.context.fillRect(midX- Constants.MID_LINE_WIDTH / Constants.NUMBER_2,
|
||||
this.rulerWidth * Constants.NUMBER_8 / Constants.NUMBER_15,
|
||||
Constants.MID_LINE_WIDTH, Constants.MID_LINE_HEIGHT);
|
||||
} else {
|
||||
this.context.fillRect(this.rulerWidth * Constants.NUMBER_8_5 / Constants.NUMBER_15,
|
||||
mid_x - Constants.MID_LINE_WIDTH / Constants.NUMBER_2, Constants.MID_LINE_HEIGHT,
|
||||
midX- Constants.MID_LINE_WIDTH / Constants.NUMBER_2, Constants.MID_LINE_HEIGHT,
|
||||
Constants.MID_LINE_WIDTH);
|
||||
}
|
||||
this.context.stroke();
|
||||
this.context.closePath();
|
||||
}
|
||||
|
||||
drawIntegerLine(cur_x: number, cur_num: number): void {
|
||||
drawIntegerLine(curX: number, curNum: number): void {
|
||||
if (!this.isVerticalScreen) {
|
||||
this.context.moveTo((this.rulerWidth * 8.5) / 15, cur_x);
|
||||
this.context.moveTo((this.rulerWidth * 8.5) / 15, curX);
|
||||
} else {
|
||||
this.context.moveTo(cur_x, (this.rulerWidth * 8.5) / 15);
|
||||
this.context.moveTo(curX, (this.rulerWidth * 8.5) / 15);
|
||||
}
|
||||
|
||||
if (Math.abs(cur_num) > Constants.EDGE_ANGLE) {
|
||||
if (Math.abs(curNum) > Constants.EDGE_ANGLE) {
|
||||
this.context.strokeStyle = Constants.RULER_FILL_STYLE_40;
|
||||
this.context.shadowColor = Constants.RULER_FILL_STYLE_40;
|
||||
} else {
|
||||
@ -104,38 +104,38 @@ export struct CropRulerBar {
|
||||
this.context.shadowColor = Constants.RULER_FILL_STYLE_90;
|
||||
}
|
||||
this.context.shadowBlur = Constants.RULER_LINE_WIDTH
|
||||
if (Math.round(cur_num) == Math.round(this.current_def)) {
|
||||
if (Math.round(curNum) == Math.round(this.currentDef)) {
|
||||
if (!this.isVerticalScreen) {
|
||||
this.context.fillText(this.integerAngleToString(Math.round(cur_num)) as string,
|
||||
(this.rulerWidth * 6) / 15, cur_x);
|
||||
this.context.fillText(this.integerAngleToString(Math.round(curNum)) as string,
|
||||
(this.rulerWidth * 6) / 15, curX);
|
||||
} else {
|
||||
this.context.fillText(this.integerAngleToString(Math.round(cur_num)) as string, cur_x,
|
||||
this.context.fillText(this.integerAngleToString(Math.round(curNum)) as string, curX,
|
||||
(this.rulerWidth * 6) / 15);
|
||||
}
|
||||
} else {
|
||||
if (!this.isVerticalScreen) {
|
||||
this.context.fillText((-cur_num).toString(),
|
||||
(this.rulerWidth * 6) / 15, cur_x);
|
||||
this.context.fillText((-curNum).toString(),
|
||||
(this.rulerWidth * 6) / 15, curX);
|
||||
} else {
|
||||
this.context.fillText(cur_num.toString(), cur_x,
|
||||
this.context.fillText(curNum.toString(), curX,
|
||||
(this.rulerWidth * 6) / 15);
|
||||
}
|
||||
|
||||
}
|
||||
if (!this.isVerticalScreen) {
|
||||
this.context.lineTo(this.rulerWidth * 10.5 / 15, cur_x);
|
||||
this.context.lineTo(this.rulerWidth * 10.5 / 15, curX);
|
||||
} else {
|
||||
this.context.lineTo(cur_x, this.rulerWidth * 10.5 / 15);
|
||||
this.context.lineTo(curX, this.rulerWidth * 10.5 / 15);
|
||||
}
|
||||
}
|
||||
|
||||
drawLine(): void {
|
||||
let begin_num = this.current_def - (this.rulerLength / Constants.NUMBER_2) / Constants.NUMBER_5;
|
||||
let cur_x = 0;
|
||||
let cur_num = 0;
|
||||
const scale_len = Math.ceil((this.rulerLength) / Constants.NUMBER_5) + Constants.NUMBER_1;
|
||||
for (let i = 0; i < scale_len; i++) {
|
||||
cur_num = begin_num + i;
|
||||
let beginNum = this.currentDef - (this.rulerLength / Constants.NUMBER_2) / Constants.NUMBER_5;
|
||||
let curX = 0;
|
||||
let curNum = 0;
|
||||
const scaleLen = Math.ceil((this.rulerLength) / Constants.NUMBER_5) + Constants.NUMBER_1;
|
||||
for (let i = 0; i < scaleLen; i++) {
|
||||
curNum = beginNum + i;
|
||||
this.context.beginPath();
|
||||
this.multiScreenAdaptation();
|
||||
this.context.textAlign = 'center';
|
||||
@ -143,7 +143,7 @@ export struct CropRulerBar {
|
||||
this.context.textAlign = 'end';
|
||||
this.context.textBaseline = 'middle';
|
||||
}
|
||||
if (Math.abs(cur_num) > Constants.EDGE_ANGLE) {
|
||||
if (Math.abs(curNum) > Constants.EDGE_ANGLE) {
|
||||
this.context.strokeStyle = Constants.RULER_FILL_STYLE_40;
|
||||
this.context.fillStyle = Constants.RULER_FILL_STYLE_40;
|
||||
} else {
|
||||
@ -151,24 +151,24 @@ export struct CropRulerBar {
|
||||
this.context.fillStyle = Constants.RULER_FILL_STYLE_90;
|
||||
}
|
||||
this.context.shadowBlur = 0;
|
||||
cur_x = i * Constants.NUMBER_5;
|
||||
if (cur_x == 0 || cur_x == this.rulerLength) {
|
||||
curX = i * Constants.NUMBER_5;
|
||||
if (curX == 0 || curX == this.rulerLength) {
|
||||
this.context.lineWidth = (Constants.RULER_LINE_WIDTH / Constants.NUMBER_2);
|
||||
if (cur_x < 0) {
|
||||
cur_x = 0;
|
||||
if (curX < 0) {
|
||||
curX = 0;
|
||||
}
|
||||
} else {
|
||||
this.context.lineWidth = Constants.RULER_LINE_WIDTH;
|
||||
}
|
||||
if (Math.round(Math.abs(cur_num)) % Constants.NUMBER_10 == 0) {
|
||||
this.drawIntegerLine(cur_x, cur_num);
|
||||
if (Math.round(Math.abs(curNum)) % Constants.NUMBER_10 == 0) {
|
||||
this.drawIntegerLine(curX, curNum);
|
||||
} else {
|
||||
if (!this.isVerticalScreen) {
|
||||
this.context.moveTo((this.rulerWidth * Constants.NUMBER_9_5) / Constants.NUMBER_15, cur_x);
|
||||
this.context.lineTo(this.rulerWidth * Constants.NUMBER_10_5 / Constants.NUMBER_15, cur_x);
|
||||
this.context.moveTo((this.rulerWidth * Constants.NUMBER_9_5) / Constants.NUMBER_15, curX);
|
||||
this.context.lineTo(this.rulerWidth * Constants.NUMBER_10_5 / Constants.NUMBER_15, curX);
|
||||
} else {
|
||||
this.context.moveTo(cur_x, (this.rulerWidth * Constants.NUMBER_9_5) / Constants.NUMBER_15);
|
||||
this.context.lineTo(cur_x, this.rulerWidth * Constants.NUMBER_10_5 / Constants.NUMBER_15);
|
||||
this.context.moveTo(curX, (this.rulerWidth * Constants.NUMBER_9_5) / Constants.NUMBER_15);
|
||||
this.context.lineTo(curX, this.rulerWidth * Constants.NUMBER_10_5 / Constants.NUMBER_15);
|
||||
}
|
||||
}
|
||||
this.context.stroke();
|
||||
@ -194,17 +194,17 @@ export struct CropRulerBar {
|
||||
if (Math.abs(dir / 5) < 1) {
|
||||
return;
|
||||
}
|
||||
this.current_def += Number.parseInt((dir / 5).toFixed(0));
|
||||
this.currentDef += Number.parseInt((dir / 5).toFixed(0));
|
||||
this.startPos = event.touches[0][axis];
|
||||
if (Math.abs(this.current_def) > Constants.EDGE_ANGLE) {
|
||||
this.current_def = this.current_def > Constants.EDGE_ANGLE ? Constants.EDGE_ANGLE : -Constants.EDGE_ANGLE;
|
||||
if (Math.abs(this.currentDef) > Constants.EDGE_ANGLE) {
|
||||
this.currentDef = this.currentDef > Constants.EDGE_ANGLE ? Constants.EDGE_ANGLE : -Constants.EDGE_ANGLE;
|
||||
}
|
||||
this.drawRuler();
|
||||
this.broadCast.emit(Constants.RULER_CHANGED, [this.current_def]);
|
||||
this.broadCast.emit(Constants.RULER_CHANGED, [this.currentDef]);
|
||||
}
|
||||
|
||||
onResetClicked(): void {
|
||||
this.current_def = Constants.NUMBER_0;
|
||||
this.currentDef = Constants.NUMBER_0;
|
||||
this.drawRuler();
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/**
|
||||
* Copyright (c) 2022-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -25,7 +25,7 @@ export struct PcCropRulerBar {
|
||||
@Consume broadCast: BroadCast;
|
||||
@State cWidth: number = 250;
|
||||
@State cHeight: number = 57;
|
||||
private current_def: number = 0;
|
||||
private currentDef: number = 0;
|
||||
private startPos: number = 0;
|
||||
private setting: RenderingContextSettings = new RenderingContextSettings(true);
|
||||
private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.setting);
|
||||
@ -55,42 +55,42 @@ export struct PcCropRulerBar {
|
||||
|
||||
drawMidLine() {
|
||||
// 中点
|
||||
const mid_x = Math.floor(this.rulerLength / Constants.NUMBER_2);
|
||||
const midX= Math.floor(this.rulerLength / Constants.NUMBER_2);
|
||||
this.context.beginPath();
|
||||
this.context.fillStyle = Constants.RULER_FILL_STYLE_100;
|
||||
this.context.strokeStyle = Constants.RULER_FILL_STYLE_100;
|
||||
this.context.lineCap = 'round';
|
||||
|
||||
this.context.lineWidth = Constants.MID_LINE_WIDTH;
|
||||
this.context.moveTo(mid_x, this.rulerDrawHeight - Constants.EDITOR_LARGE_TICK_LINE_HEIGHT);
|
||||
this.context.lineTo(mid_x, this.rulerDrawHeight - Constants.NUMBER_1);
|
||||
this.context.moveTo(midX, this.rulerDrawHeight - Constants.EDITOR_LARGE_TICK_LINE_HEIGHT);
|
||||
this.context.lineTo(midX, this.rulerDrawHeight - Constants.NUMBER_1);
|
||||
|
||||
this.context.stroke();
|
||||
this.context.closePath();
|
||||
}
|
||||
|
||||
drawIntegerLine(cur_x: number, cur_num: number) {
|
||||
this.context.moveTo(cur_x, this.rulerDrawHeight - Constants.EDITOR_MIDDLE_TICK_LINE_HEIGHT);
|
||||
drawIntegerLine(curX: number, curNum: number) {
|
||||
this.context.moveTo(curX, this.rulerDrawHeight - Constants.EDITOR_MIDDLE_TICK_LINE_HEIGHT);
|
||||
this.context.shadowBlur = Constants.RULER_LINE_WIDTH
|
||||
this.context.lineCap = 'round';
|
||||
if (Math.round(cur_num) != Math.round(this.current_def) && Math.round(cur_num) == 0) {
|
||||
if (Math.round(curNum) != Math.round(this.currentDef) && Math.round(curNum) == 0) {
|
||||
this.context.textBaseline = 'bottom'
|
||||
this.context.font = Constants.RULER_CONTEXT_FONT_25PX;
|
||||
this.context.fillText(cur_num.toString(), cur_x, this.rulerDrawHeight - Constants.EDITOR_MIDDLE_TICK_LINE_HEIGHT);
|
||||
this.context.fillText(curNum.toString(), curX, this.rulerDrawHeight - Constants.EDITOR_MIDDLE_TICK_LINE_HEIGHT);
|
||||
}
|
||||
this.context.lineTo(cur_x, this.rulerDrawHeight);
|
||||
this.context.lineTo(curX, this.rulerDrawHeight);
|
||||
|
||||
}
|
||||
|
||||
drawLine() {
|
||||
// 起始绘制位置
|
||||
let begin_num = this.current_def - (this.rulerLength / Constants.NUMBER_2) / Constants.NUMBER_5;
|
||||
let end_num = this.current_def + (this.rulerLength / Constants.NUMBER_2) / Constants.NUMBER_5;
|
||||
let cur_x = 0;
|
||||
let cur_num = 0;
|
||||
const scale_len = Math.ceil((this.rulerLength) / Constants.NUMBER_5) + Constants.NUMBER_1;
|
||||
for (let i = 0; i < scale_len; i++) {
|
||||
cur_num = begin_num + i;
|
||||
let beginNum: number = this.currentDef - (this.rulerLength / Constants.NUMBER_2) / Constants.NUMBER_5;
|
||||
let endNum: number = this.currentDef + (this.rulerLength / Constants.NUMBER_2) / Constants.NUMBER_5;
|
||||
let curX = 0;
|
||||
let curNum = 0;
|
||||
const scaleLen = Math.ceil((this.rulerLength) / Constants.NUMBER_5) + Constants.NUMBER_1;
|
||||
for (let i = 0; i < scaleLen; i++) {
|
||||
curNum = beginNum + i;
|
||||
this.context.beginPath();
|
||||
this.multiScreenAdaptation();
|
||||
this.context.textAlign = 'center';
|
||||
@ -100,24 +100,24 @@ export struct PcCropRulerBar {
|
||||
this.context.fillStyle = Constants.RULER_FILL_STYLE_40;
|
||||
|
||||
// 边缘第三根线
|
||||
if (cur_num <= (begin_num + Constants.NUMBER_3) || cur_num >= (end_num - Constants.NUMBER_3)) {
|
||||
if (curNum <= (beginNum + Constants.NUMBER_3) || curNum >= (endNum - Constants.NUMBER_3)) {
|
||||
this.context.strokeStyle = Constants.RULER_FILL_STYLE_30;
|
||||
this.context.fillStyle = Constants.RULER_FILL_STYLE_30;
|
||||
}
|
||||
|
||||
// 次边缘的线
|
||||
if (cur_num <= (begin_num + Constants.NUMBER_2) || cur_num >= (end_num - Constants.NUMBER_2)) {
|
||||
if (curNum <= (beginNum + Constants.NUMBER_2) || curNum >= (endNum - Constants.NUMBER_2)) {
|
||||
this.context.strokeStyle = Constants.RULER_FILL_STYLE_20;
|
||||
this.context.fillStyle = Constants.RULER_FILL_STYLE_20;
|
||||
}
|
||||
// 最边缘的线
|
||||
if (cur_num <= (begin_num + Constants.NUMBER_2) || cur_num >= (end_num - Constants.NUMBER_2)) {
|
||||
if (curNum <= (beginNum + Constants.NUMBER_2) || curNum >= (endNum - Constants.NUMBER_2)) {
|
||||
this.context.strokeStyle = Constants.RULER_FILL_STYLE_10;
|
||||
this.context.fillStyle = Constants.RULER_FILL_STYLE_10;
|
||||
}
|
||||
|
||||
// 标尺0与当前数值之间的白色竖线
|
||||
if ((cur_num < this.current_def && cur_num >= 0) || (cur_num > this.current_def && cur_num <= 0)) {
|
||||
if ((curNum < this.currentDef && curNum >= 0) || (curNum > this.currentDef && curNum <= 0)) {
|
||||
this.context.strokeStyle = Constants.RULER_FILL_STYLE_100;
|
||||
this.context.fillStyle = Constants.RULER_FILL_STYLE_100;
|
||||
}
|
||||
@ -125,29 +125,29 @@ export struct PcCropRulerBar {
|
||||
// 设置线宽
|
||||
this.context.shadowBlur = 0;
|
||||
this.context.lineCap = 'round';
|
||||
cur_x = i * Constants.NUMBER_5
|
||||
if (cur_x == 0 || cur_x == this.rulerLength) {
|
||||
curX = i * Constants.NUMBER_5
|
||||
if (curX == 0 || curX == this.rulerLength) {
|
||||
// 边界位置刻度线宽度为一半
|
||||
this.context.lineWidth = (Constants.RULER_LINE_WIDTH / Constants.NUMBER_2);
|
||||
if (cur_x < 0) {
|
||||
cur_x = 0;
|
||||
if (curX < 0) {
|
||||
curX = 0;
|
||||
}
|
||||
} else {
|
||||
this.context.lineWidth = Constants.RULER_LINE_WIDTH;
|
||||
}
|
||||
|
||||
// 绘制刻度线
|
||||
if (Math.abs(cur_num) % Constants.NUMBER_10 === 0) {
|
||||
if (Math.abs(curNum) % Constants.NUMBER_10 === 0) {
|
||||
// 每隔10个刻度绘制一个中刻度线
|
||||
this.drawIntegerLine(cur_x, cur_num)
|
||||
} else if ((cur_num < this.current_def && cur_num >= 0) || (cur_num > this.current_def && cur_num <= 0)) {
|
||||
this.drawIntegerLine(curX, curNum)
|
||||
} else if ((curNum < this.currentDef && curNum >= 0) || (curNum > this.currentDef && curNum <= 0)) {
|
||||
// 0和当前刻度之间的线
|
||||
this.context.moveTo(cur_x, this.rulerDrawHeight - Constants.EDITOR_MIDDLE_TICK_LINE_HEIGHT);
|
||||
this.context.lineTo(cur_x, this.rulerDrawHeight);
|
||||
this.context.moveTo(curX, this.rulerDrawHeight - Constants.EDITOR_MIDDLE_TICK_LINE_HEIGHT);
|
||||
this.context.lineTo(curX, this.rulerDrawHeight);
|
||||
} else {
|
||||
// 其他短刻度线
|
||||
this.context.moveTo(cur_x, this.rulerDrawHeight - Constants.EDITOR_SMALL_TICK_LINE_HEIGHT);
|
||||
this.context.lineTo(cur_x, this.rulerDrawHeight);
|
||||
this.context.moveTo(curX, this.rulerDrawHeight - Constants.EDITOR_SMALL_TICK_LINE_HEIGHT);
|
||||
this.context.lineTo(curX, this.rulerDrawHeight);
|
||||
}
|
||||
this.context.stroke();
|
||||
this.context.closePath();
|
||||
@ -172,17 +172,17 @@ export struct PcCropRulerBar {
|
||||
if (Math.abs(dir / 5) < 1) {
|
||||
return;
|
||||
}
|
||||
this.current_def += Number.parseInt((dir / 5).toFixed(0));
|
||||
this.currentDef += Number.parseInt((dir / 5).toFixed(0));
|
||||
this.startPos = event.touches[0][axis];
|
||||
if (Math.abs(this.current_def) > Constants.EDGE_ANGLE) {
|
||||
this.current_def = this.current_def > Constants.EDGE_ANGLE ? Constants.EDGE_ANGLE : -Constants.EDGE_ANGLE;
|
||||
if (Math.abs(this.currentDef) > Constants.EDGE_ANGLE) {
|
||||
this.currentDef = this.currentDef > Constants.EDGE_ANGLE ? Constants.EDGE_ANGLE : -Constants.EDGE_ANGLE;
|
||||
}
|
||||
this.drawRuler();
|
||||
this.broadCast.emit(Constants.RULER_CHANGED, [this.current_def]);
|
||||
this.broadCast.emit(Constants.RULER_CHANGED, [this.currentDef]);
|
||||
}
|
||||
|
||||
onResetClicked() {
|
||||
this.current_def = 0;
|
||||
this.currentDef = 0;
|
||||
this.drawRuler();
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,7 @@ import { PhotoEditorManager } from '../PhotoEditorManager';
|
||||
|
||||
const TAG: string = 'editor_ToolBar';
|
||||
|
||||
const COMPONENT_KEY_Edit_CROP: string = 'EditToolBarCrop';
|
||||
const ComPonentKeyEditCrop: string = 'EditToolBarCrop';
|
||||
|
||||
@Component
|
||||
export struct ToolBar {
|
||||
@ -48,7 +48,7 @@ export struct ToolBar {
|
||||
actionID: undefined,
|
||||
text: $r('app.string.crop_text'),
|
||||
isActive: true,
|
||||
componentKey: COMPONENT_KEY_Edit_CROP
|
||||
componentKey: ComPonentKeyEditCrop
|
||||
})
|
||||
];
|
||||
/**
|
||||
|
@ -60,7 +60,7 @@ export struct ThirdSelectAlbumPageBase {
|
||||
@Provide broadCast: BroadCast = new BroadCast();
|
||||
private albums: AlbumSetDataSource = new AlbumSetDataSource(this.broadCast);
|
||||
@Provide isSelectedMode: boolean = true;
|
||||
@Provide moreMenuList: Array<Action> = new Array<Action>();
|
||||
@Provide moreMenuList: Action[] = [];
|
||||
selectManager?: ThirdSelectManager;
|
||||
@Provide gridColumnsCount: number = 3;
|
||||
isActive = false;
|
||||
|
@ -848,7 +848,7 @@ export struct ThirdSelectPhotoBrowserBase {
|
||||
}
|
||||
return;
|
||||
}
|
||||
let uriArray: Array<string>;
|
||||
let uriArray: string[] = [];
|
||||
let mediaType: number;
|
||||
if (this.isMultiPick) {
|
||||
if (this.selectManager === null) {
|
||||
@ -947,7 +947,7 @@ export struct ThirdSelectPhotoBrowserBase {
|
||||
*/
|
||||
class ThirdBrowserDataSource extends PhotoDataSource {
|
||||
private isSelectMode = false;
|
||||
private selectedItems: MediaItem[] = new Array<MediaItem>();
|
||||
private selectedItems: MediaItem[] = [];
|
||||
|
||||
totalCount() {
|
||||
if (this.isSelectMode) {
|
||||
|
@ -77,8 +77,8 @@ let localStorage = LocalStorage.getShared();
|
||||
export struct ThirdSelectPhotoGridBase {
|
||||
@State selectedCount: number = 0;
|
||||
@Provide isSelectedMode: boolean = true;
|
||||
@Provide moreMenuList: Array<Action> = new Array<Action>();
|
||||
@Provide rightClickMenuList: Array<Action> = new Array<Action>();
|
||||
@Provide moreMenuList: Action[] = [];
|
||||
@Provide rightClickMenuList: Action[] = [];
|
||||
photoDataImpl: PhotoDataImpl | undefined =
|
||||
BrowserDataFactory.getFeature(BrowserDataFactory.TYPE_PHOTO) as PhotoDataImpl;
|
||||
smartPickerDataImpl: SmartPickerDataImpl | undefined;
|
||||
@ -165,7 +165,7 @@ export struct ThirdSelectPhotoGridBase {
|
||||
} else if (action.actionID === Action.CANCEL.actionID) {
|
||||
this.setPickResult();
|
||||
} else if (action.actionID === Action.OK.actionID) {
|
||||
let uriArray: Array<string> = new Array<string>();
|
||||
let uriArray: string[] = [];
|
||||
if (this.selectManager !== null) {
|
||||
uriArray = SelectUtil.getUriArray(this.selectManager.clickedSet);
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ import { IS_HORIZONTAL, SelectParams } from '../utils/ThirdSelectConstants';
|
||||
export struct ThirdSelectedPageActionBar {
|
||||
@StorageLink(IS_HORIZONTAL) @Watch('createActionBar') isHorizontal: boolean = ScreenManager.getInstance()
|
||||
.isHorizontal();
|
||||
@State menuList: Array<Action> = new Array<Action>();
|
||||
@State menuList: Action[] = [];
|
||||
selectParams: SelectParams = SelectParams.defaultParam();
|
||||
@Provide selectedCount: number = 0;
|
||||
@Link @Watch('onSelectedCountChanged') totalSelectedCount: number;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/**
|
||||
* Copyright (c) 2022-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -54,7 +54,7 @@ import { TimelineDataSourceManager } from '../model/TimelineDataSourceManager';
|
||||
import { TimelineScrollBar } from './TimelineScrollBar';
|
||||
|
||||
const TAG: string = 'TimelinePage';
|
||||
AppStorage.setOrCreate('TimelinePageIndex', Constants.INVALID);
|
||||
AppStorage.setOrCreate('timelinePageIndex', Constants.INVALID);
|
||||
|
||||
interface Params {
|
||||
albumName: string;
|
||||
@ -76,7 +76,7 @@ export struct TimelinePage {
|
||||
@State totalSelectedCount: number = 0;
|
||||
@Provide broadCast: BroadCast = TimelineDataSourceManager.getInstance().getBroadCast();
|
||||
@Consume @Watch('onIndexPageShow') isShow: boolean;
|
||||
@StorageLink('TimelinePageIndex') @Watch('onIndexChange') TimelinePageIndex: number = Constants.INVALID;
|
||||
@StorageLink('timelinePageIndex') @Watch('onIndexChange') timelinePageIndex: number = Constants.INVALID;
|
||||
@StorageLink('isSplitMode') isSplitMode: boolean = ScreenManager.getInstance().isSplitMode();
|
||||
@StorageLink('leftBlank') leftBlank: number[] =
|
||||
[0, ScreenManager.getInstance().getStatusBarHeight(), 0, ScreenManager.getInstance().getNaviBarHeight()];
|
||||
@ -89,8 +89,8 @@ export struct TimelinePage {
|
||||
deleteMode = false; // Is delete mode
|
||||
isActive = false; // Is the page active
|
||||
routerStart = false; // Is move or copy router page
|
||||
@Provide moreMenuList: Action[] = new Array<Action>();
|
||||
@Provide rightClickMenuList: Array<Action> = new Array<Action>();
|
||||
@Provide moreMenuList: Action[] = [];
|
||||
@Provide rightClickMenuList: Action[] = [];
|
||||
@State groupSelectMode: boolean[] = [];
|
||||
@Provide yearData: TimelineData[] = [];
|
||||
@Provide dateText: string = '';
|
||||
@ -441,9 +441,9 @@ export struct TimelinePage {
|
||||
}
|
||||
|
||||
onIndexChange(): void {
|
||||
Log.info(TAG, `onIndexChange ${this.TimelinePageIndex}`);
|
||||
if (this.TimelinePageIndex != Constants.INVALID && this.dataSource != null) {
|
||||
this.scroller.scrollToIndex(this.dataSource.getPositionByIndex(this.TimelinePageIndex));
|
||||
Log.info(TAG, `onIndexChange ${this.timelinePageIndex}`);
|
||||
if (this.timelinePageIndex != Constants.INVALID && this.dataSource != null) {
|
||||
this.scroller.scrollToIndex(this.dataSource.getPositionByIndex(this.timelinePageIndex));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,7 @@ export struct TimelinePageActionBar {
|
||||
}
|
||||
|
||||
private createHorizontalActionBar(): ActionBarProp {
|
||||
let menuList: Array<Action> = new Array<Action>();
|
||||
let menuList: Action[] = [];
|
||||
let actionBarProp: ActionBarProp = new ActionBarProp();
|
||||
if (!this.isEmpty && this.deviceType === Constants.PC_DEVICE_TYPE) {
|
||||
menuList.push(Action.MULTISELECT);
|
||||
@ -102,7 +102,7 @@ export struct TimelinePageActionBar {
|
||||
.setMode(ActionBarMode.STANDARD_MODE);
|
||||
Log.info(TAG, `createActionBar, isSelectedMode: ${this.isSelectedMode}`);
|
||||
if (this.isSelectedMode) {
|
||||
menuList = new Array<Action>();
|
||||
menuList = [];
|
||||
menuList.push((this.isAllSelected ? Action.DESELECT_ALL : Action.SELECT_ALL),
|
||||
Boolean(this.selectedCount) ? Action.DELETE : Action.DELETE_INVALID, Action.MORE);
|
||||
actionBarProp
|
||||
@ -115,7 +115,7 @@ export struct TimelinePageActionBar {
|
||||
}
|
||||
|
||||
private createActionBar(): ActionBarProp {
|
||||
let menuList: Array<Action> = new Array<Action>();
|
||||
let menuList: Action[] = [];
|
||||
let actionBarProp: ActionBarProp = new ActionBarProp();
|
||||
actionBarProp
|
||||
.setHasTabBar(this.isSidebar)
|
||||
|
@ -25,7 +25,7 @@ export struct TimelinePageToolBar {
|
||||
@Link @Watch('updateToolbar') totalSelectedCount: number;
|
||||
@Provide selectedCount: number = 0;
|
||||
onMenuClicked: Function = (): void => {};
|
||||
@Provide toolMenuList: Array<Action> = new Array<Action>();
|
||||
@Provide toolMenuList: Action[] = [];
|
||||
@Consume moreMenuList: Action[];
|
||||
@Consume hidePopup: boolean;
|
||||
|
||||
|
@ -42,7 +42,7 @@ export struct DefaultPhotoPage {
|
||||
@Provide pageFrom: number = Constants.ENTRY_FROM.NORMAL;
|
||||
@State broadCast: BroadCast = new BroadCast();
|
||||
@Provide('transitionIndex') currentIndex: number = Constants.NUMBER_0;
|
||||
@Provide moreMenuList: Array<Action> = new Array<Action>();
|
||||
@Provide moreMenuList: Action[] = [];
|
||||
@State actionBarProp: ActionBarProp = new ActionBarProp();
|
||||
@StorageLink('isSplitMode') isSplitMode: boolean = ScreenManager.getInstance().isSplitMode();
|
||||
@StorageLink('isHorizontal') isHorizontal: boolean = ScreenManager.getInstance().isHorizontal();
|
||||
|
@ -56,7 +56,7 @@ export struct EditMain {
|
||||
@Provide mainBottomSize: number = Constants.BOTTOM_TOOL_BAR_SIZE;
|
||||
@Provide titleSize: number = Constants.TOP_BAR_SIZE;
|
||||
@Provide filterBottomSize: number = Constants.FILTER_BOTTOM_TOOL_BAR_SIZE;
|
||||
@Provide moreMenuList: Array<Action> = new Array<Action>();
|
||||
@Provide moreMenuList: Action[] = [];
|
||||
@StorageLink('leftBlank') leftBlank: number[] =
|
||||
[
|
||||
Constants.NUMBER_0,
|
||||
|
@ -69,7 +69,7 @@ struct FormEditorPage {
|
||||
|
||||
async getItems(albumUri?: string, startIndex?: number, count?: number, filterMediaType?: string):
|
||||
Promise<Array<userFileManager.FileAsset>> {
|
||||
let result: Array<userFileManager.FileAsset> = [];
|
||||
let result: userFileManager.FileAsset[] = [];
|
||||
|
||||
// Get from target album if albumUri is not undefined, otherwise getAllObject
|
||||
if (albumUri) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/**
|
||||
* Copyright (c) 2022-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -44,7 +44,7 @@ import { PhotoBrowserComponent } from '../view/PhotoBrowserComponent';
|
||||
import { SelectPhotoBrowserView } from '../view/SelectPhotoBrowserView';
|
||||
|
||||
const TAG: string = 'NewAlbumPage';
|
||||
AppStorage.setOrCreate('PhotoGridPageIndex', Constants.INVALID);
|
||||
AppStorage.setOrCreate('photoGridPageIndex', Constants.INVALID);
|
||||
|
||||
interface Params {
|
||||
item: string;
|
||||
@ -63,10 +63,10 @@ export struct NewAlbumPage {
|
||||
@Provide broadCast: BroadCast = new BroadCast();
|
||||
@Provide isShow: boolean = true;
|
||||
@Provide isShowBar: boolean = true;
|
||||
@State moreMenuList: Array<Action> = new Array<Action>();
|
||||
@Provide rightClickMenuList: Array<Action> = new Array<Action>();
|
||||
@State moreMenuList: Action[] = [];
|
||||
@Provide rightClickMenuList: Action[] = [];
|
||||
@State isClickScrollBar: boolean = false;
|
||||
@StorageLink('PhotoGridPageIndex') @Watch('onIndexChange') PhotoGridPageIndex: number = Constants.INVALID;
|
||||
@StorageLink('photoGridPageIndex') @Watch('onIndexChange') photoGridPageIndex: number = Constants.INVALID;
|
||||
@StorageLink('isSplitMode') isSplitMode: boolean = ScreenManager.getInstance().isSplitMode();
|
||||
@StorageLink('leftBlank') leftBlank: number[] =
|
||||
[0, ScreenManager.getInstance().getStatusBarHeight(), 0, ScreenManager.getInstance().getNaviBarHeight()];
|
||||
@ -159,9 +159,9 @@ export struct NewAlbumPage {
|
||||
}
|
||||
|
||||
onIndexChange() {
|
||||
Log.info(TAG, `onIndexChange ${this.PhotoGridPageIndex}`)
|
||||
if (this.PhotoGridPageIndex != Constants.INVALID) {
|
||||
this.scroller.scrollToIndex(this.PhotoGridPageIndex);
|
||||
Log.info(TAG, `onIndexChange ${this.photoGridPageIndex}`)
|
||||
if (this.photoGridPageIndex != Constants.INVALID) {
|
||||
this.scroller.scrollToIndex(this.photoGridPageIndex);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,7 @@ import { SelectPhotoBrowserView } from '../view/SelectPhotoBrowserView';
|
||||
import { LEFT_BLANK } from '@ohos/thirdselect/src/main/ets/default/utils/ThirdSelectConstants';
|
||||
|
||||
const TAG: string = 'PhotoGridPage';
|
||||
AppStorage.setOrCreate('PhotoGridPageIndex', Constants.INVALID);
|
||||
AppStorage.setOrCreate('photoGridPageIndex', Constants.INVALID);
|
||||
|
||||
// Album Page
|
||||
@Entry
|
||||
|
@ -44,8 +44,8 @@ struct VideoBrowser {
|
||||
@Provide('dateTitle') photoDate: string = '';
|
||||
@Provide('timeLocationTitle') timeAndLocation: string = '';
|
||||
@Provide isShowBar: boolean = false;
|
||||
@Provide menuList: Array<Action> = new Array<Action>();
|
||||
@Provide moreMenuList: Array<Action> = new Array<Action>();
|
||||
@Provide menuList: Action[] = [];
|
||||
@Provide moreMenuList: Action[] = [];
|
||||
@Provide hidePopup: boolean = false;
|
||||
private broadCast: BroadCast = new BroadCast();
|
||||
private myVideoController: VideoController = new VideoController();
|
||||
|
@ -378,7 +378,7 @@ struct IndexPage {
|
||||
}
|
||||
Log.info(TAG, `Has permission been requested? ${isRequested}`);
|
||||
if (!isRequested) {
|
||||
let permissionList: Array<string> = [
|
||||
let permissionList: string[] = [
|
||||
'ohos.permission.READ_IMAGEVIDEO',
|
||||
'ohos.permission.WRITE_IMAGEVIDEO',
|
||||
'ohos.permission.MEDIA_LOCATION'
|
||||
|
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/**
|
||||
* Copyright (c) 2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -111,10 +111,10 @@ export struct PhotoBrowserComponent {
|
||||
@Provide backgroundColorResource: Resource = $r('app.color.default_background_color');
|
||||
@Provide('dateTitle') photoDate: string = '';
|
||||
@Provide('timeLocationTitle') timeAndLocation: string = '';
|
||||
@Provide menuList: Array<Action> = new Array<Action>();
|
||||
@Provide toolMenuList: Array<Action> = new Array<Action>();
|
||||
@Provide topMenuList: Array<Action> = new Array<Action>();
|
||||
@Provide moreMenuList: Array<Action> = new Array<Action>();
|
||||
@Provide menuList: Action[] = [];
|
||||
@Provide toolMenuList: Action[] = [];
|
||||
@Provide topMenuList: Action[] = [];
|
||||
@Provide moreMenuList: Action[] = [];
|
||||
@Provide broadCast: BroadCast = new BroadCast();
|
||||
@Provide isShowBar: boolean = true;
|
||||
@Provide onlyChangeBgColor: boolean = false;
|
||||
@ -123,8 +123,8 @@ export struct PhotoBrowserComponent {
|
||||
@State @Watch('updateMoreMenu') currentShow: boolean = true;
|
||||
@StorageLink('isHorizontal') @Watch('updateIsHorizontal') isHorizontal: boolean = ScreenManager.getInstance()
|
||||
.isHorizontal();
|
||||
@StorageLink('TimelinePageIndex') TimelinePageIndex: number = Constants.INVALID;
|
||||
@StorageLink('PhotoGridPageIndex') PhotoGridPageIndex: number = Constants.INVALID;
|
||||
@StorageLink('timelinePageIndex') timelinePageIndex: number = Constants.INVALID;
|
||||
@StorageLink('photoGridPageIndex') photoGridPageIndex: number = Constants.INVALID;
|
||||
@StorageLink('isSplitMode') isSplitMode: boolean = ScreenManager.getInstance().isSplitMode();
|
||||
@StorageLink('leftBlank') leftBlank: number[] =
|
||||
[0, ScreenManager.getInstance().getStatusBarHeight(), 0, ScreenManager.getInstance().getNaviBarHeight()];
|
||||
@ -471,7 +471,7 @@ export struct PhotoBrowserComponent {
|
||||
|
||||
Log.info(TAG, `updateMenu album[${this.albumUri}]`);
|
||||
|
||||
let menuTemp: Array<Action> = new Array<Action>();
|
||||
let menuTemp: Action[] = [];
|
||||
if (this.pageFrom == Constants.ENTRY_FROM.CAMERA ||
|
||||
this.pageFrom == Constants.ENTRY_FROM.CARD ||
|
||||
(this.isFromViewDataWithMediaUri == true &&
|
||||
@ -487,7 +487,7 @@ export struct PhotoBrowserComponent {
|
||||
this.menuList = menuTemp;
|
||||
}
|
||||
|
||||
let list: Array<Action> = new Array<Action>();
|
||||
let list: Action[] = [];
|
||||
if (pageFrom === Constants.ENTRY_FROM.NORMAL || pageFrom === Constants.ENTRY_FROM.CAMERA) {
|
||||
list.push(currentPhoto.isFavor ? Action.FAVORITE : Action.NOT_FAVORITE,
|
||||
((currentPhoto.mediaType == UserFileManagerAccess.MEDIA_TYPE_IMAGE))
|
||||
@ -516,7 +516,7 @@ export struct PhotoBrowserComponent {
|
||||
this.toolMenuList = [];
|
||||
}
|
||||
}
|
||||
let menuTempList: Array<Action>;
|
||||
let menuTempList: Action[] = [];
|
||||
if (!this.albumInfo) {
|
||||
// 照片页
|
||||
menuTempList = [Action.ADD, Action.RENAME];
|
||||
@ -610,12 +610,12 @@ export struct PhotoBrowserComponent {
|
||||
this.dataSource.release();
|
||||
if (this.checkedTransition === Constants.PHOTO_TRANSITION_TIMELINE) {
|
||||
Log.info(TAG, 'onBackPress TimelinePage');
|
||||
this.TimelinePageIndex = this.currentIndex; // call scrollTo
|
||||
this.TimelinePageIndex = Constants.INVALID;
|
||||
this.timelinePageIndex = this.currentIndex; // call scrollTo
|
||||
this.timelinePageIndex = Constants.INVALID;
|
||||
} else if (this.checkedTransition === Constants.PHOTO_TRANSITION_ALBUM) {
|
||||
Log.info(TAG, 'onBackPress PhotoGridPage');
|
||||
this.PhotoGridPageIndex = this.currentIndex; // call scrollTo
|
||||
this.PhotoGridPageIndex = Constants.INVALID;
|
||||
this.photoGridPageIndex = this.currentIndex; // call scrollTo
|
||||
this.photoGridPageIndex = Constants.INVALID;
|
||||
|
||||
if (this.isFromFACard) {
|
||||
if (this.isPullDown) {
|
||||
@ -1138,11 +1138,11 @@ export struct PhotoBrowserComponent {
|
||||
Log.info(TAG, `data reloaded move to ${index}`);
|
||||
this.currentIndex = index;
|
||||
if (this.checkedTransition == Constants.PHOTO_TRANSITION_TIMELINE) {
|
||||
this.TimelinePageIndex = this.currentIndex; // call scrollTo
|
||||
this.TimelinePageIndex = Constants.INVALID;
|
||||
this.timelinePageIndex = this.currentIndex; // call scrollTo
|
||||
this.timelinePageIndex = Constants.INVALID;
|
||||
} else if (this.checkedTransition == Constants.PHOTO_TRANSITION_ALBUM) {
|
||||
this.PhotoGridPageIndex = this.currentIndex; // call scrollTo
|
||||
this.PhotoGridPageIndex = Constants.INVALID;
|
||||
this.photoGridPageIndex = this.currentIndex; // call scrollTo
|
||||
this.photoGridPageIndex = Constants.INVALID;
|
||||
}
|
||||
this.dataSource.enableGetData(true);
|
||||
this.dataSource.getData(this.currentIndex);
|
||||
@ -1361,12 +1361,12 @@ export struct PhotoBrowserComponent {
|
||||
}
|
||||
interface Msg {
|
||||
clickThumbnailTime: number;
|
||||
ShowSinglePhoto: number;
|
||||
FileName?: string;
|
||||
showSinglePhoto: number;
|
||||
fileName?: string;
|
||||
}
|
||||
let msg: Msg = {
|
||||
clickThumbnailTime: this.clickThumbnailTime,
|
||||
ShowSinglePhoto: Date.now()
|
||||
showSinglePhoto: Date.now()
|
||||
}
|
||||
let fileName = ReportToBigDataUtil.getFileNameOfPhotoTakenByCamera(this.getPhotoByIndex(0));
|
||||
ReportToBigDataUtil.setFileNameProperty(msg, fileName);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/**
|
||||
* Copyright (c) 2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -67,7 +67,7 @@ import {
|
||||
|
||||
|
||||
const TAG: string = 'PhotoGridView';
|
||||
AppStorage.setOrCreate('PhotoGridPageIndex', Constants.INVALID);
|
||||
AppStorage.setOrCreate('photoGridPageIndex', Constants.INVALID);
|
||||
|
||||
// Album View
|
||||
@Component
|
||||
@ -82,9 +82,9 @@ export struct PhotoGridView {
|
||||
@Provide broadCast: BroadCast = new BroadCast();
|
||||
@Consume isShow: boolean;
|
||||
@Provide isShowBar: boolean = true;
|
||||
@Provide moreMenuList: Array<Action> = new Array<Action>();
|
||||
@Provide rightClickMenuList: Array<Action> = new Array<Action>();
|
||||
@StorageLink('PhotoGridPageIndex') @Watch('onIndexChange') PhotoGridPageIndex: number = Constants.INVALID;
|
||||
@Provide moreMenuList: Action[] = [];
|
||||
@Provide rightClickMenuList: Action[] = [];
|
||||
@StorageLink('photoGridPageIndex') @Watch('onIndexChange') photoGridPageIndex: number = Constants.INVALID;
|
||||
@StorageLink('isSplitMode') isSplitMode: boolean = ScreenManager.getInstance().isSplitMode();
|
||||
@StorageLink('leftBlank') leftBlank: number[] =
|
||||
[0, ScreenManager.getInstance().getStatusBarHeight(), 0, ScreenManager.getInstance().getNaviBarHeight()];
|
||||
@ -144,9 +144,9 @@ export struct PhotoGridView {
|
||||
}
|
||||
|
||||
onIndexChange(): void {
|
||||
Log.info(TAG, `onIndexChange ${this.PhotoGridPageIndex}`)
|
||||
if (this.PhotoGridPageIndex != Constants.INVALID) {
|
||||
this.scroller.scrollToIndex(this.PhotoGridPageIndex);
|
||||
Log.info(TAG, `onIndexChange ${this.photoGridPageIndex}`)
|
||||
if (this.photoGridPageIndex != Constants.INVALID) {
|
||||
this.scroller.scrollToIndex(this.photoGridPageIndex);
|
||||
}
|
||||
}
|
||||
|
||||
@ -519,7 +519,7 @@ export struct PhotoGridView {
|
||||
if (!this.isSelectedMode) {
|
||||
this.onModeChange();
|
||||
}
|
||||
this.rightClickMenuList = new Array<Action>();
|
||||
this.rightClickMenuList = [];
|
||||
if (this.albumInfo) {
|
||||
let isRecycleAlbum: boolean = this.albumInfo.isTrashAlbum;
|
||||
if (isRecycleAlbum) {
|
||||
|
Loading…
Reference in New Issue
Block a user