简化全局窗口尺寸变量名

This commit is contained in:
JackLee 2026-03-28 16:23:52 +08:00
parent 050403d971
commit 3153a0f43f
15 changed files with 97 additions and 81 deletions

View File

@ -229,9 +229,22 @@ void NativeManager::OnMouseEvent(OH_NativeXComponent *comp, void *win) {
} }
auto renderThread = it->second; auto renderThread = it->second;
float curtX,curtY; float curtX,curtY;
//HILOG_WARN(NATIVE_TAG, "ALLButton:%{public}d",mouseEvent.button); //开发测试模拟器输出鼠标按钮和时间类型,时间戳
//HILOG_WARN(NATIVE_TAG, "ALLAction:%{public}d",mouseEvent.action); bool _log=true;
//HILOG_WARN(NATIVE_TAG, "ALLTimestamp:%{public}d",mouseEvent.timestamp); if(_log){
HILOG_INFO(NATIVE_TAG, "ALLButton:%{public}d",mouseEvent.button);
HILOG_INFO(NATIVE_TAG, "ALLAction:%{public}d",mouseEvent.action);
HILOG_INFO(NATIVE_TAG, "ALLTimestamp:%{public}d",mouseEvent.timestamp);
}
//以下代码为采用按住鼠标右键不放进行Move改变Carmera的旋转视角
//旋转视角分为三种模式:
//自由模式.基于世界坐标系0,0,0
//模型中心.通过边界盒计算模型的中心点,进行旋转
//基于鼠标按下右键点进行旋转
//按住Ctrl不放同时按住鼠标左键不放进行Carmera的移动
//移动模式:均为鼠标点按下后记录坐标增量移动
//鼠标按下并且事件为鼠标中键 //鼠标按下并且事件为鼠标中键

View File

@ -34,17 +34,17 @@ export default class EntryAbility extends UIAbility {
const mainWindowHeight: number = screenHeight - 200; const mainWindowHeight: number = screenHeight - 200;
console.error(`main window Width: mainWindowWidth, Height: mainWindowHeight`); console.error(`main window Width: mainWindowWidth, Height: mainWindowHeight`);
//Init&&Save AppStorageV2 //Init&&Save AppStorageV2
const mainDisplayInfo = const mDispInfo =
AppStorageV2.connect<MainScreenDisplayInfo>(MainScreenDisplayInfo, () => new MainScreenDisplayInfo())!; AppStorageV2.connect<MainScreenDisplayInfo>(MainScreenDisplayInfo, () => new MainScreenDisplayInfo())!;
const mainWinInfo = AppStorageV2.connect<MainWindowInfo>(MainWindowInfo, () => new MainWindowInfo())!; const mWinInfo = AppStorageV2.connect<MainWindowInfo>(MainWindowInfo, () => new MainWindowInfo())!;
const mainWinStage = const mWinStage =
AppStorageV2.connect<MainWindowStageInfo>(MainWindowStageInfo, () => new MainWindowStageInfo())!; AppStorageV2.connect<MainWindowStageInfo>(MainWindowStageInfo, () => new MainWindowStageInfo())!;
mainDisplayInfo.mainScreenDisplayId = screenDisplayId; mDispInfo.mSDispId = screenDisplayId;
mainDisplayInfo.mainScreenWidth = screenWidth; mDispInfo.mSDispWidth = screenWidth;
mainDisplayInfo.mainScreenHeight = screenHeight; mDispInfo.mSDispHeight = screenHeight;
mainWinInfo.mainWindowWidth = mainWindowWidth; mWinInfo.mWinWidth = mainWindowWidth;
mainWinInfo.mainWindowHeight = mainWindowHeight; mWinInfo.mWinHeight = mainWindowHeight;
mainWinStage.ws = windowStage; mWinStage.mWinStage = windowStage;
//Get Main Window //Get Main Window
windowStage.getMainWindow((err, data) => { windowStage.getMainWindow((err, data) => {
@ -53,6 +53,7 @@ export default class EntryAbility extends UIAbility {
return; return;
} }
this.mainWindow = data; this.mainWindow = data;
mWinInfo.mWinId = this.mainWindow.getWindowProperties().id;
//moveWindowTo //moveWindowTo
this.mainWindow.moveWindowTo(50, 50) this.mainWindow.moveWindowTo(50, 50)
//resize mainWindow Size //resize mainWindow Size
@ -67,8 +68,8 @@ export default class EntryAbility extends UIAbility {
// windowSizeChangeListener to Change mainWindowWidth&&mainWindowHeight in AppStorage // windowSizeChangeListener to Change mainWindowWidth&&mainWindowHeight in AppStorage
this.mainWindow.on('windowSizeChange', (ListenerData) => { this.mainWindow.on('windowSizeChange', (ListenerData) => {
// if Size Change save to AppStorage // if Size Change save to AppStorage
mainWinInfo.mainWindowWidth = ListenerData.width; mWinInfo.mWinWidth = ListenerData.width;
mainWinInfo.mainWindowHeight = ListenerData.height; mWinInfo.mWinHeight = ListenerData.height;
console.info('Succeeded in enabling the listener for window size changes. Data:' + ListenerData.width, console.info('Succeeded in enabling the listener for window size changes. Data:' + ListenerData.width,
ListenerData.height); ListenerData.height);
}); });

View File

@ -4,34 +4,37 @@ import { AppStorageV2, window} from '@kit.ArkUI';
//底部有全局信息变量,已导出,其他page只需要import该文件即可调用let变量 //底部有全局信息变量,已导出,其他page只需要import该文件即可调用let变量
@ObservedV2 @ObservedV2
export class MainScreenDisplayInfo { export class MainScreenDisplayInfo {
@Trace public mainScreenDisplayId: number; @Trace public mSDispId: number;
@Trace public mainScreenWidth: number; @Trace public mSDispWidth: number;
@Trace public mainScreenHeight: number; @Trace public mSDispHeight: number;
constructor(_id?: number, _width?: number,_height?: number) { constructor(_id?: number, _width?: number,_height?: number) {
this.mainScreenDisplayId = _id ?? 0; this.mSDispId = _id ?? 0;
this.mainScreenWidth = _width ?? 0; this.mSDispWidth = _width ?? 0;
this.mainScreenHeight = _height ?? 0; this.mSDispHeight = _height ?? 0;
} }
} }
@ObservedV2 @ObservedV2
export class MainWindowInfo { export class MainWindowInfo {
@Trace public mainWindowWidth: number; @Trace public mWinId: number;
@Trace public mainWindowHeight: number; @Trace public mWinWidth: number;
@Trace public mWinHeight: number;
constructor(_width?: number, _height?: number) {
this.mainWindowWidth = _width ?? 0; constructor(_id?:number,_width?: number, _height?: number) {
this.mainWindowHeight = _height ?? 0; this.mWinWidth = _width ?? 0;
this.mWinHeight = _height ?? 0;
this.mWinId=_id?? 0;
} }
} }
@ObservedV2 @ObservedV2
export class MainWindowStageInfo { export class MainWindowStageInfo {
@Trace public ws: window.WindowStage| undefined; @Trace public mWinStage: window.WindowStage| undefined;
constructor(_ws?: window.WindowStage) { constructor(_ws?: window.WindowStage) {
this.ws = _ws ?? undefined; this.mWinStage = _ws ?? undefined;
} }
} }
//全局保存主窗口信息,屏幕信息.窗口管理器信息 //全局保存主窗口信息,屏幕信息.窗口管理器信息

View File

@ -6,10 +6,10 @@ import { TitleTabData } from '../LayoutInterface/Layout/TitleTabData';
import { mwInfo } from '../AppStorageV2Class'; import { mwInfo } from '../AppStorageV2Class';
//按钮统一尺寸,该按钮为正方形,所以以主窗口宽为基准,长=高->正方形 //按钮统一尺寸,该按钮为正方形,所以以主窗口宽为基准,长=高->正方形
let ebWidth=mwInfo.mainWindowWidth*0.02; let ebWidth=mwInfo.mWinWidth*0.02;
let ebHeigth=mwInfo.mainWindowWidth*0.02; let ebHeigth=mwInfo.mWinWidth*0.02;
//占位符的高度 //占位符的高度
let edHeigth=mwInfo.mainWindowWidth*0.005 let edHeigth=mwInfo.mWinWidth*0.005
//单一功能按钮 //单一功能按钮
@ -180,15 +180,15 @@ export struct SubColumnMenu {
Button(){ Button(){
Row(){ Row(){
Image($r('app.media.'+(this.icon!=undefined ? this.icon:(this.menus[this.curtIndex]as TitleButton).eIcon))) Image($r('app.media.'+(this.icon!=undefined ? this.icon:(this.menus[this.curtIndex]as TitleButton).eIcon)))
.height(mwInfo.mainWindowWidth*0.01) .height(mwInfo.mWinWidth*0.01)
if(this.name!=undefined){ if(this.name!=undefined){
Text(this.name).fontSize(16) Text(this.name).fontSize(16)
} }
} }
}.height(mwInfo.mainWindowWidth*0.01) }.height(mwInfo.mWinWidth*0.01)
.backgroundColor(Color.Transparent) .backgroundColor(Color.Transparent)
.bindMenu(this.BaseMenu) .bindMenu(this.BaseMenu)
.type(ButtonType.Normal) .type(ButtonType.Normal)
}.width(this.name!=undefined ?mwInfo.mainWindowWidth*0.02:mwInfo.mainWindowWidth*0.01) }.width(this.name!=undefined ?mwInfo.mWinWidth*0.02:mwInfo.mWinWidth*0.01)
} }
} }

View File

@ -2,10 +2,10 @@ import { mwInfo } from "../AppStorageV2Class";
import { TitleButton } from "../LayoutInterface/Interface/ButtonInterface"; import { TitleButton } from "../LayoutInterface/Interface/ButtonInterface";
//按钮统一尺寸,该按钮为正方形,所以以主窗口宽为基准,长=高->正方形 //按钮统一尺寸,该按钮为正方形,所以以主窗口宽为基准,长=高->正方形
let ebWidth=mwInfo.mainWindowWidth*0.075; let ebWidth=mwInfo.mWinWidth*0.075;
let ebHeigth=mwInfo.mainWindowHeight*0.03; let ebHeigth=mwInfo.mWinHeight*0.03;
//占位符的高度 //占位符的高度
let edHeigth=mwInfo.mainWindowWidth*0.005 let edHeigth=mwInfo.mWinWidth*0.005
@ComponentV2 @ComponentV2
export struct TextComboBox { export struct TextComboBox {
@ -34,10 +34,10 @@ export struct TextComboBox {
.width('50%') .width('50%')
.fontSize(16) .fontSize(16)
.backgroundColor('#ffe6e6e3') .backgroundColor('#ffe6e6e3')
.height(mwInfo.mainWindowHeight*0.02) .height(mwInfo.mWinHeight*0.02)
.margin({ top:0, left: 5, bottom: 0, right: 0 }) .margin({ top:0, left: 5, bottom: 0, right: 0 })
}.width(ebWidth) }.width(ebWidth)
.height(mwInfo.mainWindowWidth*0.01) .height(mwInfo.mWinWidth*0.01)
} }
} }
@ComponentV2 @ComponentV2
@ -61,6 +61,6 @@ export struct TextInputComboBox {
TextInput({placeholder:this.selectIndex.toString()}) TextInput({placeholder:this.selectIndex.toString()})
.bindMenu(this.EventMenu) .bindMenu(this.EventMenu)
.type(InputType.Number) .type(InputType.Number)
}.height(mwInfo.mainWindowWidth*0.01) }.height(mwInfo.mWinWidth*0.01)
} }
} }

View File

@ -4,8 +4,8 @@ import { TitleButton } from "../LayoutInterface/Interface/ButtonInterface";
import {SwitchView} from "../LayoutInterface/Layout/SwitchView" import {SwitchView} from "../LayoutInterface/Layout/SwitchView"
//按钮统一尺寸,该按钮为正方形,所以以主窗口宽为基准,长=高->正方形 //按钮统一尺寸,该按钮为正方形,所以以主窗口宽为基准,长=高->正方形
let ebWidth=mwInfo.mainWindowWidth*0.02; let ebWidth=mwInfo.mWinWidth*0.02;
let ebHeigth=mwInfo.mainWindowWidth*0.02; let ebHeigth=mwInfo.mWinWidth*0.02;
//视图切换弹窗 //视图切换弹窗
@CustomDialog @CustomDialog
export struct ViewDialog { export struct ViewDialog {

View File

@ -6,8 +6,8 @@ import { BaseMenuData } from "../LayoutInterface/Interface/MenuInterface";
//按钮统一尺寸,该按钮为正方形,所以以主窗口宽为基准,长=高->正方形 //按钮统一尺寸,该按钮为正方形,所以以主窗口宽为基准,长=高->正方形
let ebWidth=mwInfo.mainWindowWidth*0.02; let ebWidth=mwInfo.mWinWidth*0.02;
let ebHeigth=mwInfo.mainWindowWidth*0.02; let ebHeigth=mwInfo.mWinWidth*0.02;
@Builder @Builder
export function BaseMenu(indexMenu:BaseMenuData) { export function BaseMenu(indexMenu:BaseMenuData) {
@ -66,8 +66,8 @@ export struct GroupTextEventMenu {
.fontColor(Color.Gray) .fontColor(Color.Gray)
Blank().width('auto') Blank().width('auto')
Button() Button()
.height(mwInfo.mainWindowWidth*0.005) .height(mwInfo.mWinWidth*0.005)
.width(mwInfo.mainWindowWidth*0.005) .width(mwInfo.mWinWidth*0.005)
.padding(1) .padding(1)
.backgroundImage($r('app.media.base_seetings')) .backgroundImage($r('app.media.base_seetings'))
.backgroundImagePosition({ x: '5%', y: '5%' }) .backgroundImagePosition({ x: '5%', y: '5%' })

View File

@ -5,18 +5,20 @@ import NativeOpenCAX from 'libopencax.so';
import { mwInfo } from '../AppStorageV2Class'; import { mwInfo } from '../AppStorageV2Class';
export function ExecuteCommand(event:TitleButton){ export function ExecuteCommand(event:TitleButton){
//事件处理 //事件处理
if(event?.eEvent=='Execute_LoadModel'){ if(event?.eEvent=='Execute_LoadModel'){
OCCTLoadModel(undefined,undefined) OCCTLoadModel(undefined,undefined)
} }
//窗体打开 //窗体打开
if(event?.eEvent=='Execute_CreateSubWindow'){ if(event?.eEvent=='Execute_CreateSubWindow'){
const winInfo:WinInfo=new WinInfo(event.eName,event.ePage,mwInfo.mainWindowWidth*0.3,mwInfo.mainWindowHeight*0.9); const winInfo:WinInfo=new WinInfo(event.eName,event.ePage,mwInfo.mWinWidth*0.3,mwInfo.mWinHeight*0.9);
CreateAndShowSubWindow(winInfo); //CreateAndShowSubWindow(winInfo);
}else if(event?.eEvent=='Execute_ExitSubWindow'){ }else if(event?.eEvent=='Execute_ExitSubWindow'){
CloseSubWindow(); CloseSubWindow();
} else if(event?.eEvent=='Execute_CreateSubWindow_Options'){ } else if(event?.eEvent=='Execute_CreateSubWindow_Options'){
const winInfo:WinInfo=new WinInfo(event.eName,event.ePage,mwInfo.mainWindowWidth*0.6,mwInfo.mainWindowHeight*0.9); const winInfo:WinInfo=new WinInfo(event.eName,event.ePage,mwInfo.mWinWidth*0.6,mwInfo.mWinHeight*0.9);
CreateAndShowSubWindow(winInfo); CreateAndShowSubWindow(winInfo);
}else if(event?.eEvent=='Execute_ExitSubWindow_Options'){ }else if(event?.eEvent=='Execute_ExitSubWindow_Options'){
CloseSubWindow(); CloseSubWindow();

View File

@ -19,7 +19,7 @@ export class WinInfo{
export async function CreateAndShowSubWindow(winInfo:WinInfo) { export async function CreateAndShowSubWindow(winInfo:WinInfo) {
try { try {
if(mwsInfo.ws==null){ if(mwsInfo.mWinStage==null){
console.error('Failed to create the subwindow. Cause: windowStage is null'); console.error('Failed to create the subwindow. Cause: windowStage is null');
return; return;
} }
@ -28,15 +28,11 @@ export async function CreateAndShowSubWindow(winInfo:WinInfo) {
decorEnabled: true, decorEnabled: true,
isModal: false, isModal: false,
maximizeSupported: false, maximizeSupported: false,
zLevel:-1,
outlineEnabled:true, outlineEnabled:true,
}; };
await mwsInfo.ws.createSubWindowWithOptions('subWindow', options).then((data) => { await mwsInfo.mWinStage.createSubWindowWithOptions('subWindow', options).then((data) => {
subWindow = data; subWindow = data;
subWindow.setResizeByDragEnabled(true, (err: BusinessError) => {
console.log("设置拖拽缩放", `报错信息:${err.code}, ${err.message}`)
})
//子窗口创建成功后,设置子窗口的位置、大小及相关属性等。 //子窗口创建成功后,设置子窗口的位置、大小及相关属性等。
subWindow.moveWindowTo(25, 25) subWindow.moveWindowTo(25, 25)
//子窗口重置大小 //子窗口重置大小

View File

@ -24,7 +24,7 @@ let Fonts: Array<string> = [
struct Index { struct Index {
@Local startX:number=0; @Local startX:number=0;
@Local isDragging:boolean=false; @Local isDragging:boolean=false;
@Provider('panelWidth') panelWidth:number=mwInfo.mainWindowWidth * 0.15; @Provider('panelWidth') panelWidth:number=mwInfo.mWinWidth * 0.15;
//列出资源管理器指定目录下的所有问题件 //列出资源管理器指定目录下的所有问题件
HilogToDirFile(){ HilogToDirFile(){
@ -108,7 +108,7 @@ struct Index {
Column({ space: 0 }) { Column({ space: 0 }) {
//头部导航功能区 //头部导航功能区
TitleTab() TitleTab()
.height(mwInfo.mainWindowHeight * 0.08) .height(mwInfo.mWinHeight * 0.08)
//分割线 //分割线
Divider().vertical(false).strokeWidth(1).lineCap(LineCapStyle.Round).width('100%').backgroundColor(Color.Grey) Divider().vertical(false).strokeWidth(1).lineCap(LineCapStyle.Round).width('100%').backgroundColor(Color.Grey)
//工具栏 //工具栏
@ -116,7 +116,7 @@ struct Index {
TitleColumnSub(); TitleColumnSub();
} }
.width('100%') .width('100%')
.height(mwInfo.mainWindowHeight * 0.02) .height(mwInfo.mWinHeight * 0.02)
.align(Alignment.Start) .align(Alignment.Start)
//分割线 //分割线
Divider().vertical(false).strokeWidth(1).lineCap(LineCapStyle.Round).width('100%').backgroundColor(Color.Grey) Divider().vertical(false).strokeWidth(1).lineCap(LineCapStyle.Round).width('100%').backgroundColor(Color.Grey)
@ -147,7 +147,7 @@ struct Index {
}.layoutWeight(1) }.layoutWeight(1)
.align(Alignment.Center) .align(Alignment.Center)
}.width('100%') }.width('100%')
.height(mwInfo.mainWindowHeight * 0.39) .height(mwInfo.mWinHeight * 0.39)
//分割线 //分割线
Divider().vertical(false).strokeWidth(1).lineCap(LineCapStyle.Round).width('100%').backgroundColor(Color.Grey) Divider().vertical(false).strokeWidth(1).lineCap(LineCapStyle.Round).width('100%').backgroundColor(Color.Grey)
///状态栏 ///状态栏
@ -156,7 +156,7 @@ struct Index {
}.width('100%') }.width('100%')
.align(Alignment.End) .align(Alignment.End)
.alignItems(HorizontalAlign.Start) .alignItems(HorizontalAlign.Start)
.height(mwInfo.mainWindowHeight * 0.01) .height(mwInfo.mWinHeight * 0.01)
}.backgroundColor('#f3f3f0') }.backgroundColor('#f3f3f0')
.width('100%') .width('100%')
.height('100%') .height('100%')

View File

@ -7,7 +7,7 @@ export struct LeftSideTab {
private leftSideBarTabs: TabsController = new TabsController(); private leftSideBarTabs: TabsController = new TabsController();
@Local leftSideBarFocusIndex: number = 0; @Local leftSideBarFocusIndex: number = 0;
@Local isExpanded:boolean=true; @Local isExpanded:boolean=true;
@Consumer('panelWidth') panelWidth:number=mwInfo.mainWindowWidth * 0.1; @Consumer('panelWidth') panelWidth:number=mwInfo.mWinWidth * 0.1;
build() { build() {
Row() { Row() {
@ -24,12 +24,12 @@ export struct LeftSideTab {
}) })
.backgroundImage(this.isExpanded ? $r('app.media.base_expand_on'):$r('app.media.base_expand_off')) .backgroundImage(this.isExpanded ? $r('app.media.base_expand_on'):$r('app.media.base_expand_off'))
.type(ButtonType.Normal) .type(ButtonType.Normal)
.width(mwInfo.mainWindowWidth*0.013) .width(mwInfo.mWinWidth*0.013)
.height(mwInfo.mainWindowWidth*0.013) .height(mwInfo.mWinWidth*0.013)
.onClick(()=>{ .onClick(()=>{
this.isExpanded = !this.isExpanded; this.isExpanded = !this.isExpanded;
if(this.isExpanded){ if(this.isExpanded){
this.panelWidth=mwInfo.mainWindowWidth * 0.1; this.panelWidth=mwInfo.mWinWidth * 0.1;
}else{ }else{
this.panelWidth=0; this.panelWidth=0;
} }
@ -50,8 +50,8 @@ export struct LeftSideTab {
}) })
.backgroundImage($r('app.media.'+item.eIcon)) .backgroundImage($r('app.media.'+item.eIcon))
.fontWeight(index === this.leftSideBarFocusIndex ? FontWeight.Bold : FontWeight.Normal) .fontWeight(index === this.leftSideBarFocusIndex ? FontWeight.Bold : FontWeight.Normal)
.width(mwInfo.mainWindowWidth*0.013) .width(mwInfo.mWinWidth*0.013)
.height(mwInfo.mainWindowWidth*0.013) .height(mwInfo.mWinWidth*0.013)
.type(ButtonType.Normal) .type(ButtonType.Normal)
.onClick(() => { .onClick(() => {
this.leftSideBarTabs.changeIndex(index); this.leftSideBarTabs.changeIndex(index);
@ -64,8 +64,8 @@ export struct LeftSideTab {
.align(Alignment.Start) .align(Alignment.Start)
.scrollable(ScrollDirection.Vertical) .scrollable(ScrollDirection.Vertical)
.scrollBar(BarState.Off) .scrollBar(BarState.Off)
.width(mwInfo.mainWindowWidth*0.013) .width(mwInfo.mWinWidth*0.013)
.height(mwInfo.mainWindowWidth*0.013) .height(mwInfo.mWinWidth*0.013)
.height('100%') .height('100%')
}.borderWidth(1) }.borderWidth(1)
.borderColor(Color.Grey) .borderColor(Color.Grey)

View File

@ -22,8 +22,8 @@ export struct TitleColumnSub {
private ViewDialog(): CustomDialogController { private ViewDialog(): CustomDialogController {
return new CustomDialogController({ return new CustomDialogController({
builder: ViewDialog(), // 确保 ViewDialog 组件已正确定义 builder: ViewDialog(), // 确保 ViewDialog 组件已正确定义
width: mwInfo.mainWindowWidth*0.06, width: mwInfo.mWinWidth*0.06,
height: mwInfo.mainWindowWidth*0.052, height: mwInfo.mWinWidth*0.052,
borderWidth: 1, borderWidth: 1,
cornerRadius: 5, cornerRadius: 5,
isModal: true, isModal: true,
@ -52,8 +52,8 @@ export struct TitleColumnSub {
this.viewDialog=this.ViewDialog(); this.viewDialog=this.ViewDialog();
} }
this.viewDialog.open(); this.viewDialog.open();
}).width(mwInfo.mainWindowWidth*0.01) }).width(mwInfo.mWinWidth*0.01)
.height(mwInfo.mainWindowWidth*0.01) .height(mwInfo.mWinWidth*0.01)
.backgroundColor(Color.Transparent) .backgroundColor(Color.Transparent)
.backgroundImage($r('app.media.' + SwitchView[0].eIcon)) .backgroundImage($r('app.media.' + SwitchView[0].eIcon))
.backgroundImageSize({ .backgroundImageSize({

View File

@ -25,8 +25,8 @@ export struct TitleTab {
Button((FileMenuData.aMenus[0] as TitleButton).eName) Button((FileMenuData.aMenus[0] as TitleButton).eName)
.fontSize(16) .fontSize(16)
.fontColor(Color.Black) .fontColor(Color.Black)
.height(mwInfo.mainWindowHeight*0.025) .height(mwInfo.mWinHeight*0.025)
.width(mwInfo.mainWindowWidth*0.035) .width(mwInfo.mWinWidth*0.035)
.bindMenu(BaseMenu(FileMenuData)) .bindMenu(BaseMenu(FileMenuData))
.type(ButtonType.Normal) .type(ButtonType.Normal)
.backgroundColor('#f3f3f0') .backgroundColor('#f3f3f0')
@ -36,8 +36,8 @@ export struct TitleTab {
.fontSize(16) .fontSize(16)
.fontColor(Color.Black) .fontColor(Color.Black)
.fontWeight(index === this.titleBarFocusIndex ? FontWeight.Bold : FontWeight.Normal) .fontWeight(index === this.titleBarFocusIndex ? FontWeight.Bold : FontWeight.Normal)
.height(mwInfo.mainWindowHeight*0.025) .height(mwInfo.mWinHeight*0.025)
.width(mwInfo.mainWindowWidth*0.035) .width(mwInfo.mWinWidth*0.035)
.type(ButtonType.Normal) .type(ButtonType.Normal)
.backgroundColor('#f3f3f0') .backgroundColor('#f3f3f0')
.onClick(() => { .onClick(() => {
@ -69,6 +69,6 @@ export struct TitleTab {
}.scrollable(true) }.scrollable(true)
.barHeight(0) .barHeight(0)
.barMode(BarMode.Fixed) .barMode(BarMode.Fixed)
}.width(mwInfo.mainWindowWidth) }.width(mwInfo.mWinWidth)
} }
} }

View File

@ -28,18 +28,18 @@ export struct ModelViewTab {
ForEach(dTab, (item: TaskTab, index: number) => { ForEach(dTab, (item: TaskTab, index: number) => {
Row({ space: 0 }) { Row({ space: 0 }) {
Image($r('app.media.startIcon')) Image($r('app.media.startIcon'))
.width(this.mwInfo.mainWindowWidth*0.012) .width(this.mwInfo.mWinWidth*0.012)
.height(this.mwInfo.mainWindowWidth*0.012) .height(this.mwInfo.mWinWidth*0.012)
.objectFit(ImageFit.Contain) .objectFit(ImageFit.Contain)
Button(item.str) Button(item.str)
.fontWeight(index === this.modelViewBarFocusIndex ? FontWeight.Bold : FontWeight.Normal) .fontWeight(index === this.modelViewBarFocusIndex ? FontWeight.Bold : FontWeight.Normal)
.width('auto') .width('auto')
.height(this.mwInfo.mainWindowWidth*0.012) .height(this.mwInfo.mWinWidth*0.012)
.type(ButtonType.Normal) .type(ButtonType.Normal)
Button('X') Button('X')
.fontSize(12) .fontSize(12)
.width(this.mwInfo.mainWindowWidth*0.012) .width(this.mwInfo.mWinWidth*0.012)
.height(this.mwInfo.mainWindowWidth*0.012) .height(this.mwInfo.mWinWidth*0.012)
.type(ButtonType.Normal) .type(ButtonType.Normal)
.align(Alignment.Center) .align(Alignment.Center)
}.onClick(() => { }.onClick(() => {

View File

@ -27,6 +27,7 @@
"minWindowWidth": 1200, // 设置最小宽度 "minWindowWidth": 1200, // 设置最小宽度
"minWindowHeight": 800, // 设置最小高度 "minWindowHeight": 800, // 设置最小高度
"exported": true, "exported": true,
"launchType":"multiton",
"skills": [ "skills": [
{ {
"entities": [ "entities": [