Signed-off-by: jiangtao92 <jiangtao57@huawei.com>
This commit is contained in:
jiangtao92 2022-05-23 16:46:05 +08:00
parent 4258baeb1d
commit 5980352b1e
6 changed files with 32 additions and 8 deletions

View File

@ -48,7 +48,7 @@ export default class PresetStyleConstants {
/**
* desktop indicator height
*/
static readonly DEFAULT_PHONE_INDICATOR_HEIGHT = 48;
static readonly DEFAULT_PHONE_INDICATOR_HEIGHT = 32;
/**
* columns of screen with phone

View File

@ -82,8 +82,13 @@ export default class LayoutViewModel {
this.mSysUITopHeight = this.mLauncherLayoutStyleConfig.mSysTopHeight;
this.mNavigationBarStatus = navigationBarStatus === '0' ? true : false;
Log.showInfo(TAG, `initScreen navigationBarStatus: ${this.mNavigationBarStatus}`);
if (!this.mNavigationBarStatus) {
this.mSysUIBottomHeight = this.mLauncherLayoutStyleConfig.mSysBottomHeight;
if (this.mScreenWidth > this.mScreenHeight) {
this.mSysUIBottomHeight = this.mLauncherLayoutStyleConfig.mSysBottomHeight * this.mScreenWidth / 1280;
} else {
this.mSysUIBottomHeight = this.mLauncherLayoutStyleConfig.mSysBottomHeight * this.mScreenWidth / 360;
}
} else {
this.mSysUIBottomHeight = 0;
}
@ -199,6 +204,20 @@ export default class LayoutViewModel {
let row = ~~((realHeight + gutter) / (itemSize + gutter));
let marginTop = ((realHeight + gutter - (itemSize + gutter) * row) / 2);
Log.showInfo(TAG, `calculateDesktop gutter: ${gutter}, marginTop: ${marginTop}`);
if (!this.mIsPad) {
if (row > 6) {
row = 6;
}
if (this.mNavigationBarStatus) {
realHeight = realHeight + this.mLauncherLayoutStyleConfig.mSysBottomHeight;
}
let remainHeight = (realHeight + gutter - (itemSize + gutter) * row)
realHeight -= remainHeight
marginTop = remainHeight / 2 + this.mSysUITopHeight
Log.showInfo(TAG, `realHeight = ${realHeight} marginTop = ${marginTop}`)
}
Log.showInfo(TAG, `desktop marginTop ${marginTop}`);
//set desktop icon
let ratio = this.mLauncherLayoutStyleConfig.mIconRatio;
let lines = this.mLauncherLayoutStyleConfig.mNameLines;

View File

@ -63,8 +63,8 @@ export default class PageDesktopDragHandler extends BaseDragHandler {
}
private updateGridParam(effectArea) {
const gridWidth = effectArea.right - effectArea.left;
const gridHeight = effectArea.bottom - effectArea.top;
const gridWidth = this.mPageDesktopViewModel.getPageDesktopStyleConfig().mGridWidth;
const gridHeight = this.mPageDesktopViewModel.getPageDesktopStyleConfig().mGridHeight;
Log.showInfo(TAG, `updateGridParam gridWidth: ${gridWidth}, gridHeight: ${gridHeight}`);
this.mGridConfig = this.mPageDesktopViewModel.getGridConfig();
const column = this.mGridConfig.column;

View File

@ -26,6 +26,7 @@ const TAG = "SwiperPage";
@Component
export default struct SwiperPage {
@StorageLink('workSpaceWidth') workSpaceWidth: number = 0;
@StorageLink('NavigationBarStatusValue') navigationBarStatusValue: boolean = false;
@State ColumnsTemplate: string = '';
@State RowsTemplate: string = ''
@Prop @Watch('changeColumnAndRow') gridConfig: string;
@ -117,6 +118,10 @@ export default struct SwiperPage {
.rowsGap(this.mRowsGap)
.width(this.mGridWidth)
.height(this.mGridHeight)
.margin({ right: this.mMargin, left: this.mMargin, top: this.mMarginTop})
.margin({
right: this.mMargin,
left: this.mMargin,
top: this.navigationBarStatusValue ? this.mPageDesktopStyleConfig.mDesktopMarginTop : this.mPageDesktopStyleConfig.mDesktopMarginTop + 0
})
}
}

View File

@ -24,12 +24,12 @@ export default class PhonePresetStyleConstants {
/**
* systemUI top height
*/
static readonly DEFAULT_SYS_TOP_HEIGHT = 48;
static readonly DEFAULT_SYS_TOP_HEIGHT = 44;
/**
* systemUI bottom height
*/
static readonly DEFAULT_SYS_BOTTOM_HEIGHT = 72;
static readonly DEFAULT_SYS_BOTTOM_HEIGHT = 36;
/**
* desktop item size

View File

@ -141,7 +141,7 @@ struct EntryView {
build() {
Stack() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Start }) {
if (this.mAppPageStartConfig === 'Grid') {
Column() {
PageDesktopLayout({