归一化部分组件复用
This commit is contained in:
parent
1f696d8a87
commit
ec59d56a27
@ -1,4 +1,7 @@
|
||||
import { window} from '@kit.ArkUI';
|
||||
import { AppStorageV2, window} from '@kit.ArkUI';
|
||||
|
||||
//该文档主要储存屏幕信息,主窗口信息,窗口管理信息
|
||||
//底部有全局信息变量,已导出,其他page只需要import该文件即可调用let变量
|
||||
@ObservedV2
|
||||
export class MainScreenDisplayInfo {
|
||||
@Trace public mainScreenDisplayId: number;
|
||||
@ -31,4 +34,9 @@ export class MainWindowStageInfo {
|
||||
this.ws = _ws ?? undefined;
|
||||
}
|
||||
}
|
||||
//全局保存主窗口信息,屏幕信息.窗口管理器信息
|
||||
export let mwInfo: MainWindowInfo = AppStorageV2.connect<MainWindowInfo>(MainWindowInfo, () => new MainWindowInfo())!;
|
||||
export let msdInfo: MainScreenDisplayInfo = AppStorageV2.connect<MainScreenDisplayInfo>(MainScreenDisplayInfo, () => new MainScreenDisplayInfo())!;
|
||||
export let mwsInfo: MainWindowStageInfo = AppStorageV2.connect<MainWindowStageInfo>(MainWindowStageInfo, () => new MainWindowStageInfo())!;
|
||||
|
||||
|
||||
|
||||
@ -3,85 +3,170 @@ import { ExecuteCommand } from '../EventSubWindow/ExecuteCommand';
|
||||
import { TitleButton } from "../LayoutInterface/Interface/ButtonInterface";
|
||||
import { TitleModel } from "../LayoutInterface/Interface/ModelInterface";
|
||||
import { TitleData } from '../LayoutInterface/Layout/TabContent';
|
||||
import { AppStorageV2 } from '@kit.ArkUI';
|
||||
import { MainWindowInfo } from '../AppStorageV2Class';
|
||||
import { mwInfo } from '../AppStorageV2Class';
|
||||
|
||||
//按钮统一尺寸,该按钮为正方形,所以以主窗口宽为基准,长=高->正方形
|
||||
let ebWidth=mwInfo.mainWindowWidth*0.02;
|
||||
let ebHeigth=mwInfo.mainWindowWidth*0.02;
|
||||
//占位符的高度
|
||||
let edHeigth=mwInfo.mainWindowWidth*0.005
|
||||
//单一功能按钮
|
||||
//图片->文本
|
||||
//不能用于模块切换
|
||||
|
||||
@ComponentV2
|
||||
export struct EventBtn {
|
||||
@Local mwInfo: MainWindowInfo = AppStorageV2.connect<MainWindowInfo>(MainWindowInfo, () => new MainWindowInfo())!;
|
||||
@Param eventBtn: TitleButton | undefined = undefined;
|
||||
build() {
|
||||
Column({ space: 0 }) {
|
||||
if (this.eventBtn != undefined) {
|
||||
Button()
|
||||
.width(this.mwInfo.mainWindowWidth*0.02)
|
||||
.height(this.mwInfo.mainWindowWidth*0.02)
|
||||
.backgroundImage($r('app.media.' + this.eventBtn.eIcon))
|
||||
.backgroundImagePosition({ x: '5%', y: '5%' })
|
||||
.backgroundColor(Color.Transparent)
|
||||
.backgroundImageSize({
|
||||
width: '90%', // 图片宽度占满按钮
|
||||
height: '90%' // 图片高度占满按钮
|
||||
})
|
||||
.onClick(()=>{
|
||||
ExecuteCommand(this.eventBtn as TitleButton);
|
||||
})
|
||||
Text()
|
||||
.width('auto')
|
||||
.height(this.mwInfo.mainWindowWidth*0.005)
|
||||
.backgroundColor(Color.Transparent)
|
||||
Text(this.eventBtn.eName)
|
||||
.fontSize(16)
|
||||
.width('auto')
|
||||
.height(this.mwInfo.mainWindowWidth*0.005)
|
||||
.textAlign(TextAlign.Center)
|
||||
.backgroundColor(Color.Transparent)
|
||||
}
|
||||
}.padding(1)
|
||||
}
|
||||
}
|
||||
|
||||
//仅仅用于模块切换
|
||||
@ComponentV2
|
||||
export struct SwitchModelBtn {
|
||||
@Local mwInfo: MainWindowInfo = AppStorageV2.connect<MainWindowInfo>(MainWindowInfo, () => new MainWindowInfo())!;
|
||||
//按钮动态布局类型,目前处于开发阶段两种状态.
|
||||
//1-eventBtn==false为普通按钮,支持所有功能
|
||||
//2-eventBtn==true为模块切换模块独立的功能
|
||||
@Param eventBtnType?:boolean=false;
|
||||
//普通功能按钮调用的数据
|
||||
@Param eventBtn: TitleButton | undefined = undefined;
|
||||
//模块切换模块按钮数据
|
||||
@Consumer('curtModel') curtModel: Array<TitleModel> | undefined = TitleData.mModels.get(0)
|
||||
|
||||
build() {
|
||||
Column({ space: 2 }) {
|
||||
//如果该类型是false表示为配普通事件按钮
|
||||
if(!this.eventBtnType){
|
||||
if (this.eventBtn != undefined) {
|
||||
Button()
|
||||
.width(ebWidth)
|
||||
.height(ebHeigth)
|
||||
.backgroundImage($r('app.media.' + this.eventBtn.eIcon))
|
||||
.backgroundImagePosition({ x: '5%', y: '5%' })
|
||||
.backgroundColor(Color.Transparent)
|
||||
.backgroundImageSize({
|
||||
width: '90%', // 图片宽度占满按钮
|
||||
height: '90%' // 图片高度占满按钮
|
||||
})
|
||||
.onClick(()=>{
|
||||
ExecuteCommand(this.eventBtn as TitleButton);
|
||||
})
|
||||
}
|
||||
}else {
|
||||
//判断类型为true,属于模块切换事件
|
||||
if (this.eventBtn != undefined) {
|
||||
Button()
|
||||
.width(ebWidth)
|
||||
.height(ebHeigth)
|
||||
.backgroundImage($r('app.media.' + this.eventBtn.eIcon))
|
||||
.backgroundImagePosition({ x: '5%', y: '5%' })
|
||||
.backgroundColor(Color.Transparent)
|
||||
.backgroundImageSize({
|
||||
width: '90%', // 图片宽度占满按钮
|
||||
height: '90%' // 图片高度占满按钮
|
||||
})
|
||||
.onClick(() => {
|
||||
if (this.eventBtn?.eEvent == 'Switch_Model_CAD') {
|
||||
this.curtModel = TitleData.mModels.get(1)
|
||||
} else if (this.eventBtn?.eEvent == 'Switch_Model_CAM') {
|
||||
this.curtModel = TitleData.mModels.get(2)
|
||||
} else if (this.eventBtn?.eEvent == 'Switch_Model_CAE') {
|
||||
this.curtModel = TitleData.mModels.get(3)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
if (this.eventBtn != undefined) {
|
||||
Button()
|
||||
.width(this.mwInfo.mainWindowWidth*0.02)
|
||||
.height(this.mwInfo.mainWindowWidth*0.02)
|
||||
.backgroundImage($r('app.media.' + this.eventBtn.eIcon))
|
||||
.backgroundImagePosition({ x: '5%', y: '5%' })
|
||||
.backgroundColor(Color.Transparent)
|
||||
.backgroundImageSize({
|
||||
width: '90%', // 图片宽度占满按钮
|
||||
height: '90%' // 图片高度占满按钮
|
||||
}).onClick(() => {
|
||||
if (this.eventBtn?.eEvent == 'Switch_Model_CAD') {
|
||||
this.curtModel = TitleData.mModels.get(1)
|
||||
} else if (this.eventBtn?.eEvent == 'Switch_Model_CAM') {
|
||||
this.curtModel = TitleData.mModels.get(2)
|
||||
} else if (this.eventBtn?.eEvent == 'Switch_Model_CAE') {
|
||||
this.curtModel = TitleData.mModels.get(3)
|
||||
}
|
||||
})
|
||||
Text()
|
||||
.width('auto')
|
||||
.height(this.mwInfo.mainWindowWidth*0.005)
|
||||
.height(edHeigth)
|
||||
.backgroundColor(Color.Transparent)
|
||||
Text(this.eventBtn.eName)
|
||||
.fontSize(16)
|
||||
.width('auto')
|
||||
.height(this.mwInfo.mainWindowWidth*0.005)
|
||||
.height(edHeigth)
|
||||
.textAlign(TextAlign.Center)
|
||||
.backgroundColor(Color.Transparent)
|
||||
}
|
||||
}.padding(1)
|
||||
}
|
||||
}
|
||||
|
||||
//菜单目录按钮
|
||||
//功能目录菜单,主要用于针对单一按钮多个功能形式
|
||||
@ComponentV2
|
||||
export struct MenuBtn {
|
||||
@Param menuBtn: Array<TitleButton> | undefined = undefined;
|
||||
@Local curtIndex:number=0;
|
||||
@Builder
|
||||
EventMenu() {
|
||||
Menu() {
|
||||
ForEach(this.menuBtn, (item: TitleButton, index: number) => {
|
||||
MenuItem({ startIcon: $r('app.media.' + item.eIcon), content: item.eName })
|
||||
.onClick(()=>{
|
||||
this.curtIndex=index;
|
||||
ExecuteCommand(item as TitleButton);
|
||||
}).size({height: ebWidth})
|
||||
})
|
||||
}.fontSize(20)
|
||||
}
|
||||
|
||||
build() {
|
||||
Column({ space: 0 }) {
|
||||
if (this.menuBtn != undefined) {
|
||||
Button()
|
||||
.bindMenu(this.EventMenu)
|
||||
.width(ebWidth)
|
||||
.height(ebHeigth)
|
||||
.backgroundImage($r('app.media.' + this.menuBtn[this.curtIndex].eIcon))
|
||||
.backgroundImagePosition({ x: '5%', y: '5%' })
|
||||
.backgroundColor(Color.Transparent)
|
||||
.backgroundImageSize({
|
||||
width: '90%', // 图片宽度占满按钮
|
||||
height: '90%' // 图片高度占满按钮
|
||||
})
|
||||
Button()
|
||||
.type(ButtonType.Normal)
|
||||
.bindMenu(this.EventMenu)
|
||||
.width(ebWidth)
|
||||
.height(edHeigth)
|
||||
.backgroundImage($r('app.media.base_chevron_down'))
|
||||
.backgroundImagePosition({ x: '35%', y: '0%' })
|
||||
.backgroundColor(Color.Transparent)
|
||||
|
||||
Text(this.menuBtn[this.curtIndex].eName)
|
||||
.fontSize(16)
|
||||
.width('auto')
|
||||
.height(edHeigth)
|
||||
.textAlign(TextAlign.Center)
|
||||
}
|
||||
}
|
||||
.padding(1)
|
||||
}
|
||||
}
|
||||
|
||||
//Title Sub功能目录菜单
|
||||
@ComponentV2
|
||||
export struct SubColumnMenu {
|
||||
@Param menus: Array<TitleButton>| undefined = undefined;
|
||||
@Param icon:string='';
|
||||
@Builder
|
||||
EventMenu() {
|
||||
Menu() {
|
||||
ForEach(this.menus, (item: TitleButton, index: number) => {
|
||||
MenuItem({ startIcon: $r('app.media.'+item.eIcon), content: item.eName })
|
||||
.width('150')
|
||||
.size({height: mwInfo.mainWindowWidth*0.02})
|
||||
})
|
||||
}.fontSize(20)
|
||||
}
|
||||
build(){
|
||||
Row(){
|
||||
Button()
|
||||
.padding(1)
|
||||
.width(mwInfo.mainWindowWidth*0.013)
|
||||
.height(mwInfo.mainWindowWidth*0.013)
|
||||
.backgroundColor(Color.Transparent)
|
||||
.backgroundImage($r('app.media.'+this.icon))
|
||||
.backgroundImagePosition({ x: '5%', y: '5%' })
|
||||
.backgroundImageSize({
|
||||
width: '90%', // 图片宽度占满按钮
|
||||
height: '90%' // 图片高度占满按钮
|
||||
})
|
||||
.bindMenu(this.EventMenu())
|
||||
.type(ButtonType.Normal)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,3 +1,4 @@
|
||||
import { mwInfo } from "../AppStorageV2Class";
|
||||
import { TitleButton } from "../LayoutInterface/Interface/ButtonInterface";
|
||||
|
||||
@ComponentV2
|
||||
@ -9,12 +10,10 @@ export struct TextComboBox {
|
||||
Menu() {
|
||||
ForEach(this.menu, (item: TitleButton, index: number) => {
|
||||
MenuItem({ content: item.eName })
|
||||
.labelFont({ size: 20})
|
||||
.width('auto')
|
||||
.size({height: mwInfo.mainWindowWidth*0.02})
|
||||
.onClick(()=>{
|
||||
this.selectIndex=index;
|
||||
})
|
||||
.backgroundColor('#f3f3f0')
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -34,12 +33,10 @@ export struct TextInputComboBox {
|
||||
Menu() {
|
||||
ForEach(this.menu, (item: TitleButton, index: number) => {
|
||||
MenuItem({ content: item.eName })
|
||||
.labelFont({ size: 20})
|
||||
.width('auto')
|
||||
.size({height: mwInfo.mainWindowWidth*0.02})
|
||||
.onClick(()=>{
|
||||
this.selectIndex=index;
|
||||
})
|
||||
.backgroundColor('#f3f3f0')
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,28 +1,25 @@
|
||||
import { TitleMenu } from "../LayoutInterface/Interface/MenuInterface";
|
||||
import { TitleGroup } from "../LayoutInterface/Interface/GroupInterface";
|
||||
import { TitleButton } from "../LayoutInterface/Interface/ButtonInterface";
|
||||
import { EventBtn } from "./Button";
|
||||
import { ExecuteCommand } from "../EventSubWindow/ExecuteCommand";
|
||||
import { AppStorageV2 } from "@kit.ArkUI";
|
||||
import { MainWindowInfo } from "../AppStorageV2Class";
|
||||
import { mwInfo } from "../AppStorageV2Class";
|
||||
|
||||
|
||||
//菜单按钮
|
||||
//主要用于功能组操作菜单.文件下拉菜单等.
|
||||
@ComponentV2
|
||||
export struct GroupTextEventMenu {
|
||||
@Local mwInfo: MainWindowInfo = AppStorageV2.connect<MainWindowInfo>(MainWindowInfo, () => new MainWindowInfo())!;
|
||||
@Param grpEvent: TitleGroup | undefined = undefined;
|
||||
|
||||
@Builder
|
||||
GroupMenu(menus: Array<TitleMenu>) {
|
||||
ForEach(menus, (item: TitleMenu, index: number) => {
|
||||
MenuItem({ startIcon: $r('app.media.' + item.mIcon), content: item.mName })
|
||||
.labelFont({ size: 20})
|
||||
.width('auto')
|
||||
})
|
||||
Menu() {
|
||||
ForEach(menus, (item: TitleMenu, index: number) => {
|
||||
MenuItem({ startIcon: $r('app.media.' + item.mIcon), content: item.mName })
|
||||
.size({height: mwInfo.mainWindowWidth*0.02})
|
||||
})
|
||||
}.fontSize(20)
|
||||
}
|
||||
|
||||
build() {
|
||||
Row() {
|
||||
if (this.grpEvent != undefined) {
|
||||
@ -33,8 +30,8 @@ export struct GroupTextEventMenu {
|
||||
.fontColor(Color.Gray)
|
||||
Blank().width('auto')
|
||||
Button()
|
||||
.height(this.mwInfo.mainWindowWidth*0.01)
|
||||
.width(this.mwInfo.mainWindowWidth*0.01)
|
||||
.height(mwInfo.mainWindowWidth*0.005)
|
||||
.width(mwInfo.mainWindowWidth*0.005)
|
||||
.padding(1)
|
||||
.backgroundImage($r('app.media.base_seetings'))
|
||||
.backgroundImagePosition({ x: '5%', y: '5%' })
|
||||
@ -49,59 +46,5 @@ export struct GroupTextEventMenu {
|
||||
}
|
||||
}
|
||||
|
||||
//菜单目录按钮
|
||||
//功能目录菜单,主要用于针对单一按钮多个功能形式
|
||||
@ComponentV2
|
||||
export struct MenuBtn {
|
||||
@Local mwInfo: MainWindowInfo = AppStorageV2.connect<MainWindowInfo>(MainWindowInfo, () => new MainWindowInfo())!;
|
||||
@Param menuBtn: Array<TitleButton> | undefined = undefined;
|
||||
@Param iconState: boolean = false;
|
||||
@Local curtIndex:number=0;
|
||||
@Builder
|
||||
EventMenu() {
|
||||
Menu() {
|
||||
ForEach(this.menuBtn, (item: TitleButton, index: number) => {
|
||||
MenuItem({ startIcon: $r('app.media.' + item.eIcon), content: item.eName })
|
||||
.labelFont({ size: 20})
|
||||
.onClick(()=>{
|
||||
this.curtIndex=index;
|
||||
ExecuteCommand(item as TitleButton);
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
build() {
|
||||
Column({ space: 0 }) {
|
||||
if (this.menuBtn != undefined) {
|
||||
Button()
|
||||
.bindMenu(this.EventMenu)
|
||||
.width(this.mwInfo.mainWindowWidth*0.02)
|
||||
.height(this.mwInfo.mainWindowWidth*0.02)
|
||||
.backgroundImage($r('app.media.' + this.menuBtn[this.curtIndex].eIcon))
|
||||
.backgroundImagePosition({ x: '5%', y: '5%' })
|
||||
.backgroundColor(Color.Transparent)
|
||||
.backgroundImageSize({
|
||||
width: '90%', // 图片宽度占满按钮
|
||||
height: '90%' // 图片高度占满按钮
|
||||
})
|
||||
Button()
|
||||
.type(ButtonType.Normal)
|
||||
.bindMenu(this.EventMenu)
|
||||
.width(this.mwInfo.mainWindowWidth*0.02)
|
||||
.height(this.mwInfo.mainWindowWidth*0.005)
|
||||
.backgroundImage($r('app.media.base_chevron_down'))
|
||||
.backgroundImagePosition({ x: '40%', y: '0%' })
|
||||
.backgroundColor(Color.Transparent)
|
||||
|
||||
Text(this.menuBtn[this.curtIndex].eName)
|
||||
.fontSize(16)
|
||||
.width('auto')
|
||||
.height(this.mwInfo.mainWindowWidth*0.005)
|
||||
.textAlign(TextAlign.Center)
|
||||
}
|
||||
}
|
||||
.padding(1)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,15 +1,12 @@
|
||||
import { BusinessError } from '@kit.BasicServicesKit';
|
||||
import { window,UIContext, AppStorageV2} from '@kit.ArkUI';
|
||||
import { MainWindowInfo, MainWindowStageInfo } from '../AppStorageV2Class';
|
||||
import { window} from '@kit.ArkUI';
|
||||
import { mwInfo, mwsInfo } from '../AppStorageV2Class';
|
||||
|
||||
let subWindow: window.Window | undefined = undefined;
|
||||
|
||||
export async function CreateAndShowSubWindow(name:string,pages:string) {
|
||||
try {
|
||||
const appws=AppStorageV2.connect<MainWindowStageInfo>(MainWindowStageInfo, () => new MainWindowStageInfo())!;
|
||||
const mwInfo = AppStorageV2.connect<MainWindowInfo>(MainWindowInfo, () => new MainWindowInfo())!;
|
||||
const windowStage = appws.ws;
|
||||
if(windowStage==null){
|
||||
if(mwsInfo.ws==null){
|
||||
console.error('Failed to create the subwindow. Cause: windowStage is null');
|
||||
return;
|
||||
}
|
||||
@ -22,7 +19,7 @@ export async function CreateAndShowSubWindow(name:string,pages:string) {
|
||||
outlineEnabled:true,
|
||||
};
|
||||
|
||||
await windowStage.createSubWindowWithOptions('subWindow', options).then((data) => {
|
||||
await mwsInfo.ws.createSubWindowWithOptions('subWindow', options).then((data) => {
|
||||
subWindow = data;
|
||||
subWindow.setResizeByDragEnabled(true, (err: BusinessError) => {
|
||||
console.log("设置拖拽缩放", `报错信息:${err.code}, ${err.message}`)
|
||||
|
||||
@ -1,11 +1,9 @@
|
||||
import { MainWindowInfo } from '../AppStorageV2Class';
|
||||
import { mwInfo } from '../AppStorageV2Class';
|
||||
import { Expandable } from '../CustomStyle/Expandable';
|
||||
import { AppStorageV2 } from '@kit.ArkUI';
|
||||
|
||||
@Entry
|
||||
@ComponentV2
|
||||
struct SWExtrude {
|
||||
@Local mwInfo: MainWindowInfo = AppStorageV2.connect<MainWindowInfo>(MainWindowInfo, () => new MainWindowInfo())!;
|
||||
// 控制内容区域显示与隐藏的状态
|
||||
@Provider('isSubExpanded') isExpanded:boolean=true;
|
||||
build() {
|
||||
|
||||
@ -4,24 +4,22 @@ import { TitleTab } from './TitleLayout/TitleTab'
|
||||
import { LeftSideTab } from './LeftSideLayout/LeftSideTab'
|
||||
import { ModelViewTab } from './modelViewTab'
|
||||
import { TitleColumnSub } from './TitleLayout/TitleColumnSub'
|
||||
import { MainWindowInfo } from './AppStorageV2Class'
|
||||
import { mwInfo } from './AppStorageV2Class'
|
||||
|
||||
const DOMAIN = 0x0000;
|
||||
|
||||
@Entry
|
||||
@ComponentV2
|
||||
struct Index {
|
||||
@Local mwInfo: MainWindowInfo = AppStorageV2.connect<MainWindowInfo>(MainWindowInfo, () => new MainWindowInfo())!;
|
||||
@Local startX:number=0;
|
||||
@Local isDragging:boolean=false;
|
||||
@Provider('panelWidth') panelWidth:number=this.mwInfo.mainWindowWidth * 0.15;
|
||||
@Provider('panelWidth') panelWidth:number=mwInfo.mainWindowWidth * 0.15;
|
||||
build() {
|
||||
//OpenCAX主界面整体布局,采用多行布局
|
||||
Column({ space: 0 }) {
|
||||
//头部导航功能区
|
||||
TitleTab()
|
||||
.height(this.mwInfo.mainWindowHeight * 0.1)
|
||||
.borderRadius(5)
|
||||
.height(mwInfo.mainWindowHeight * 0.08)
|
||||
//分割线
|
||||
Divider().vertical(false).strokeWidth(1).lineCap(LineCapStyle.Round).width('100%').backgroundColor(Color.Grey)
|
||||
//工具栏
|
||||
@ -29,7 +27,7 @@ struct Index {
|
||||
TitleColumnSub();
|
||||
}
|
||||
.width('100%')
|
||||
.height(this.mwInfo.mainWindowHeight * 0.03)
|
||||
.height(mwInfo.mainWindowHeight * 0.03)
|
||||
.align(Alignment.Start)
|
||||
//分割线
|
||||
Divider().vertical(false).strokeWidth(1).lineCap(LineCapStyle.Round).width('100%').backgroundColor(Color.Grey)
|
||||
@ -60,7 +58,7 @@ struct Index {
|
||||
}.layoutWeight(1)
|
||||
.align(Alignment.Center)
|
||||
}.width('100%')
|
||||
.height(this.mwInfo.mainWindowHeight * 0.36)
|
||||
.height(mwInfo.mainWindowHeight * 0.36)
|
||||
//分割线
|
||||
Divider().vertical(false).strokeWidth(1).lineCap(LineCapStyle.Round).width('100%').backgroundColor(Color.Grey)
|
||||
///状态栏
|
||||
@ -69,7 +67,7 @@ struct Index {
|
||||
}.width('100%')
|
||||
.align(Alignment.End)
|
||||
.alignItems(HorizontalAlign.Start)
|
||||
.height(this.mwInfo.mainWindowHeight * 0.05)
|
||||
.height(mwInfo.mainWindowHeight * 0.05)
|
||||
}.backgroundColor('#f3f3f0')
|
||||
.width('100%')
|
||||
.height('100%')
|
||||
|
||||
@ -1,15 +1,13 @@
|
||||
import { TitleButton } from '../LayoutInterface/Interface/ButtonInterface';
|
||||
import {LeftSideBars} from '../LayoutInterface/Layout/LeftSideBar'
|
||||
import { AppStorageV2 } from '@kit.ArkUI';
|
||||
import { MainWindowInfo } from '../AppStorageV2Class';
|
||||
import { mwInfo } from '../AppStorageV2Class';
|
||||
import {LeftSideComponent} from './LeftSideComponent'
|
||||
@ComponentV2
|
||||
export struct LeftSideTab {
|
||||
@Local mwInfo: MainWindowInfo = AppStorageV2.connect<MainWindowInfo>(MainWindowInfo, () => new MainWindowInfo())!;
|
||||
private leftSideBarTabs: TabsController = new TabsController();
|
||||
@Local leftSideBarFocusIndex: number = 0;
|
||||
@Local isExpanded:boolean=true;
|
||||
@Consumer('panelWidth') panelWidth:number=this.mwInfo.mainWindowWidth * 0.1;
|
||||
@Consumer('panelWidth') panelWidth:number=mwInfo.mainWindowWidth * 0.1;
|
||||
|
||||
build() {
|
||||
Row() {
|
||||
@ -26,12 +24,12 @@ export struct LeftSideTab {
|
||||
})
|
||||
.backgroundImage(this.isExpanded ? $r('app.media.base_expand_on'):$r('app.media.base_expand_off'))
|
||||
.type(ButtonType.Normal)
|
||||
.width(this.mwInfo.mainWindowWidth*0.013)
|
||||
.height(this.mwInfo.mainWindowWidth*0.013)
|
||||
.width(mwInfo.mainWindowWidth*0.013)
|
||||
.height(mwInfo.mainWindowWidth*0.013)
|
||||
.onClick(()=>{
|
||||
this.isExpanded = !this.isExpanded;
|
||||
if(this.isExpanded){
|
||||
this.panelWidth=this.mwInfo.mainWindowWidth * 0.1;
|
||||
this.panelWidth=mwInfo.mainWindowWidth * 0.1;
|
||||
}else{
|
||||
this.panelWidth=0;
|
||||
}
|
||||
@ -52,8 +50,8 @@ export struct LeftSideTab {
|
||||
})
|
||||
.backgroundImage($r('app.media.'+item.eIcon))
|
||||
.fontWeight(index === this.leftSideBarFocusIndex ? FontWeight.Bold : FontWeight.Normal)
|
||||
.width(this.mwInfo.mainWindowWidth*0.013)
|
||||
.height(this.mwInfo.mainWindowWidth*0.013)
|
||||
.width(mwInfo.mainWindowWidth*0.013)
|
||||
.height(mwInfo.mainWindowWidth*0.013)
|
||||
.type(ButtonType.Normal)
|
||||
.onClick(() => {
|
||||
this.leftSideBarTabs.changeIndex(index);
|
||||
@ -67,8 +65,8 @@ export struct LeftSideTab {
|
||||
.align(Alignment.Start)
|
||||
.scrollable(ScrollDirection.Vertical)
|
||||
.scrollBar(BarState.Off)
|
||||
.width(this.mwInfo.mainWindowWidth*0.013)
|
||||
.height(this.mwInfo.mainWindowWidth*0.013)
|
||||
.width(mwInfo.mainWindowWidth*0.013)
|
||||
.height(mwInfo.mainWindowWidth*0.013)
|
||||
.height('100%')
|
||||
}.borderWidth(1)
|
||||
.borderColor(Color.Grey)
|
||||
|
||||
@ -4,36 +4,25 @@ import { ViewDialog } from "../CustomStyle/Dialog"
|
||||
import { SwitchView } from "../LayoutInterface/Layout/SwitchView";
|
||||
import {SelectionMode} from "../LayoutInterface/Layout/SelectionMode"
|
||||
import {DisplayMode} from "../LayoutInterface/Layout/DisplayMode"
|
||||
import { MenuBtn } from "../CustomStyle/Menu";
|
||||
import { LayoutOption } from "../LayoutInterface/Layout/LayoutOption";
|
||||
import { TitleData } from "../LayoutInterface/Layout/TabContent";
|
||||
import { MainWindowInfo } from "../AppStorageV2Class";
|
||||
import { AppStorageV2, font, Font } from "@kit.ArkUI";
|
||||
import { mwInfo } from "../AppStorageV2Class";
|
||||
import { SubColumnMenu } from "../CustomStyle/Button";
|
||||
|
||||
|
||||
@ComponentV2
|
||||
export struct TitleColumnSub {
|
||||
@Local mwInfo: MainWindowInfo = AppStorageV2.connect<MainWindowInfo>(MainWindowInfo, () => new MainWindowInfo())!;
|
||||
|
||||
@Local layerArray: Array<TitleButton> = [];
|
||||
@Local dX:number=0;
|
||||
@Local dY:number=0;
|
||||
@Local viewDialog:CustomDialogController|undefined=undefined;
|
||||
|
||||
@Builder
|
||||
DisplayModeMenu(menus: Array<TitleButton>) {
|
||||
Menu() {
|
||||
ForEach(menus, (item: TitleButton, index: number) => {
|
||||
MenuItem({ startIcon: $r('app.media.'+item.eIcon), content: item.eName })
|
||||
.width('150')
|
||||
.labelFont({size: 20})
|
||||
})
|
||||
}
|
||||
}
|
||||
private ViewDialog(): CustomDialogController {
|
||||
return new CustomDialogController({
|
||||
builder: ViewDialog(), // 确保 ViewDialog 组件已正确定义
|
||||
width: this.mwInfo.mainWindowWidth*0.04,
|
||||
height: this.mwInfo.mainWindowWidth*0.04,
|
||||
width: mwInfo.mainWindowWidth*0.04,
|
||||
height: mwInfo.mainWindowWidth*0.04,
|
||||
borderWidth: 1,
|
||||
cornerRadius: 5,
|
||||
isModal: true,
|
||||
@ -44,23 +33,10 @@ export struct TitleColumnSub {
|
||||
|
||||
build(){
|
||||
Row({space:5}){
|
||||
Button()
|
||||
.padding(1)
|
||||
.width(this.mwInfo.mainWindowWidth*0.013)
|
||||
.height(this.mwInfo.mainWindowWidth*0.013)
|
||||
.backgroundColor(Color.Transparent)
|
||||
.backgroundImage($r('app.media.base_shortcut_menu'))
|
||||
.backgroundImagePosition({ x: '5%', y: '5%' })
|
||||
.backgroundImageSize({
|
||||
width: '90%', // 图片宽度占满按钮
|
||||
height: '90%' // 图片高度占满按钮
|
||||
})
|
||||
.bindMenu(this.DisplayModeMenu(TitleData.mFileModel.cmEvents as Array<TitleButton>))
|
||||
.type(ButtonType.Normal)
|
||||
SubColumnMenu({menus:TitleData.mFileModel.cmEvents as Array<TitleButton>,icon:'base_shortcut_menu'})
|
||||
.margin({ top:0, left: 5, bottom: 0, right: 0 })
|
||||
Text('菜单')
|
||||
.fontSize(20)
|
||||
.bindMenu(this.DisplayModeMenu(TitleData.mFileModel.cmEvents as Array<TitleButton>))
|
||||
Text('|')
|
||||
Text('拾取类型:')
|
||||
.fontSize(20)
|
||||
@ -71,14 +47,7 @@ export struct TitleColumnSub {
|
||||
Text('图层:')
|
||||
.fontSize(20)
|
||||
TextInputComboBox({menu:this.layerArray}).width('10%')
|
||||
Button()
|
||||
.width(this.mwInfo.mainWindowWidth*0.013)
|
||||
.height(this.mwInfo.mainWindowWidth*0.013)
|
||||
.padding(1)
|
||||
.backgroundColor(Color.Transparent)
|
||||
.backgroundImage($r('app.media.'+LayoutOption[0].eIcon))
|
||||
.backgroundImageSize({ width: '100%', height: '100%' })
|
||||
.bindMenu(this.DisplayModeMenu(LayoutOption))
|
||||
SubColumnMenu({menus:LayoutOption,icon:LayoutOption[0].eIcon})
|
||||
//视角弹窗
|
||||
Button().onClick((event) => {
|
||||
this.dX=event.windowX
|
||||
@ -87,24 +56,15 @@ export struct TitleColumnSub {
|
||||
this.viewDialog=this.ViewDialog();
|
||||
}
|
||||
this.viewDialog.open();
|
||||
}).width(this.mwInfo.mainWindowWidth*0.013)
|
||||
.height(this.mwInfo.mainWindowWidth*0.013)
|
||||
}).width(mwInfo.mainWindowWidth*0.013)
|
||||
.height(mwInfo.mainWindowWidth*0.013)
|
||||
.backgroundColor(Color.Transparent)
|
||||
.backgroundImage($r('app.media.' + SwitchView[0].eIcon))
|
||||
.backgroundImageSize({
|
||||
width: '100%', // 图片宽度占满按钮
|
||||
height: '100%' // 图片高度占满按钮
|
||||
})
|
||||
|
||||
Button()
|
||||
.width(this.mwInfo.mainWindowWidth*0.013)
|
||||
.height(this.mwInfo.mainWindowWidth*0.013)
|
||||
.padding(1)
|
||||
.backgroundColor(Color.Transparent)
|
||||
.backgroundImage($r('app.media.'+DisplayMode[0].eIcon))
|
||||
.backgroundImageSize({ width: '100%', height: '100%' })
|
||||
.bindMenu(this.DisplayModeMenu(DisplayMode))
|
||||
|
||||
SubColumnMenu({menus:DisplayMode,icon:DisplayMode[0].eIcon})
|
||||
}.margin({ top: 1, left: 1, bottom: 1, right: 1 })
|
||||
}
|
||||
}
|
||||
@ -8,13 +8,11 @@ import {TitleData, TitleModel} from '../LayoutInterface/Layout/TabContent'
|
||||
import { TitleButton } from '../LayoutInterface/Interface/ButtonInterface'
|
||||
import { TitleGroup } from '../LayoutInterface/Interface/GroupInterface'
|
||||
import {TitleTabContent} from './TitleTabContent'
|
||||
import { MainWindowInfo } from '../AppStorageV2Class';
|
||||
import { AppStorageV2, CommonModifier, TabTitleBar } from '@kit.ArkUI';
|
||||
import { mwInfo } from '../AppStorageV2Class';
|
||||
|
||||
@Entry
|
||||
@ComponentV2
|
||||
export struct TitleTab {
|
||||
@Local mwInfo: MainWindowInfo = AppStorageV2.connect<MainWindowInfo>(MainWindowInfo, () => new MainWindowInfo())!;
|
||||
//顶部导航组件
|
||||
private titleBarTabs: TabsController = new TabsController();
|
||||
//当前的顶部导航选择页
|
||||
@ -29,11 +27,9 @@ export struct TitleTab {
|
||||
Menu() {
|
||||
ForEach(menus, (item: TitleButton, index: number) => {
|
||||
MenuItem({ startIcon: $r('app.media.'+item.eIcon), content: item.eName })
|
||||
.width('auto')
|
||||
.height('auto')
|
||||
.labelFont({size: 20})
|
||||
.size({height: mwInfo.mainWindowWidth*0.02})
|
||||
})
|
||||
}
|
||||
}.fontSize(20)
|
||||
}
|
||||
|
||||
build() {
|
||||
@ -43,8 +39,8 @@ export struct TitleTab {
|
||||
Button(TitleData.mFileModel.cmName)
|
||||
.fontSize(16)
|
||||
.fontColor(Color.Black)
|
||||
.height(this.mwInfo.mainWindowHeight*0.025)
|
||||
.width(this.mwInfo.mainWindowWidth*0.035)
|
||||
.height(mwInfo.mainWindowHeight*0.025)
|
||||
.width(mwInfo.mainWindowWidth*0.035)
|
||||
.bindMenu(this.FileMenu(TitleData.mFileModel.cmEvents as Array<TitleButton>))
|
||||
.type(ButtonType.Normal)
|
||||
.backgroundColor('#f3f3f0')
|
||||
@ -54,8 +50,8 @@ export struct TitleTab {
|
||||
.fontSize(16)
|
||||
.fontColor(Color.Black)
|
||||
.fontWeight(index === this.titleBarFocusIndex ? FontWeight.Bold : FontWeight.Normal)
|
||||
.height(this.mwInfo.mainWindowHeight*0.025)
|
||||
.width(this.mwInfo.mainWindowWidth*0.035)
|
||||
.height(mwInfo.mainWindowHeight*0.025)
|
||||
.width(mwInfo.mainWindowWidth*0.035)
|
||||
.type(ButtonType.Normal)
|
||||
.backgroundColor('#f3f3f0')
|
||||
.onClick(() => {
|
||||
@ -88,11 +84,11 @@ export struct TitleTab {
|
||||
ForEach(this.curtModel,(item:TitleModel, index: number)=>{
|
||||
TabContent() {
|
||||
TitleTabContent({curtLayout:item})
|
||||
}.align(Alignment.Start)
|
||||
}
|
||||
})
|
||||
}.scrollable(true)
|
||||
.barHeight(0)
|
||||
.barMode(BarMode.Fixed)
|
||||
}.width(this.mwInfo.mainWindowWidth)
|
||||
}.width(mwInfo.mainWindowWidth)
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,15 +1,13 @@
|
||||
import { hilog } from '@kit.PerformanceAnalysisKit';
|
||||
import { TitleButton} from '../LayoutInterface/Interface/ButtonInterface';
|
||||
import { TitleGroup} from '../LayoutInterface/Interface/GroupInterface';
|
||||
import {GroupTextEventMenu,MenuBtn} from '../CustomStyle/Menu'
|
||||
import {EventBtn,SwitchModelBtn} from '../CustomStyle/Button'
|
||||
import {GroupTextEventMenu} from '../CustomStyle/Menu'
|
||||
import {EventBtn,MenuBtn} from '../CustomStyle/Button'
|
||||
import { TitleModel } from '../LayoutInterface/Layout/TabContent';
|
||||
import { MainWindowInfo } from '../AppStorageV2Class';
|
||||
import { AppStorageV2 } from '@kit.ArkUI';
|
||||
import { mwInfo } from '../AppStorageV2Class';
|
||||
|
||||
@ComponentV2
|
||||
export struct TitleTabContent {
|
||||
@Local mwInfo: MainWindowInfo = AppStorageV2.connect<MainWindowInfo>(MainWindowInfo, () => new MainWindowInfo())!;
|
||||
|
||||
@Param curtLayout:TitleModel|undefined=undefined;
|
||||
|
||||
@ -27,14 +25,14 @@ export struct TitleTabContent {
|
||||
}else if(row_item instanceof Array<TitleGroup>){ //Array<TitleGroup>
|
||||
//功能组,迭代多个功能组
|
||||
ForEach(row_item, (group_item: TitleGroup, index: number) =>{
|
||||
Column({ space: 7 }){
|
||||
Column({ space:10 }){
|
||||
Row({ space: 1 }){
|
||||
ForEach(group_item.grpBtn, (btn_item: TitleButton|Array<TitleButton>, index: number) =>{
|
||||
if(this.curtLayout?.cmName=='应用模块'){
|
||||
if(Array.isArray(btn_item)){
|
||||
MenuBtn({menuBtn:btn_item})
|
||||
}else{
|
||||
SwitchModelBtn({eventBtn:btn_item})
|
||||
EventBtn({eventBtn:btn_item,eventBtnType:true})
|
||||
}
|
||||
}else{
|
||||
if(Array.isArray(btn_item)){
|
||||
@ -46,8 +44,11 @@ export struct TitleTabContent {
|
||||
})
|
||||
}.margin({ top: 1,left:1,bottom:1,right:1})
|
||||
//功能组名
|
||||
GroupTextEventMenu({grpEvent:group_item})
|
||||
}.height(this.mwInfo.mainWindowHeight*0.073)
|
||||
Row(){
|
||||
GroupTextEventMenu({grpEvent:group_item})
|
||||
}
|
||||
}
|
||||
|
||||
Divider().vertical(true).strokeWidth(1).lineCap(LineCapStyle.Round).height('95%').backgroundColor(Color.Gray)
|
||||
})
|
||||
}else{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user