Compare commits
2 Commits
a4a6528a36
...
dc2d4d0b26
| Author | SHA1 | Date | |
|---|---|---|---|
| dc2d4d0b26 | |||
| 5ef8998322 |
@ -4,18 +4,17 @@ import { TitleButton } from "../LayoutInterface/Interface/ButtonInterface";
|
||||
import { TitleModel } from "../LayoutInterface/Interface/ModelInterface";
|
||||
import { TitleTabData } from '../LayoutInterface/Layout/TitleTabData';
|
||||
import { mwInfo } from '../AppStorageV2Class';
|
||||
import {BaseMenu } from './Menu';
|
||||
import { BaseMenuData } from '../LayoutInterface/Interface/MenuInterface';
|
||||
|
||||
//按钮统一尺寸,该按钮为正方形,所以以主窗口宽为基准,长=高->正方形
|
||||
let ebWidth=mwInfo.mainWindowWidth*0.02;
|
||||
let ebHeigth=mwInfo.mainWindowWidth*0.02;
|
||||
//占位符的高度
|
||||
let edHeigth=mwInfo.mainWindowWidth*0.005
|
||||
|
||||
|
||||
//单一功能按钮
|
||||
//图片->文本
|
||||
//不能用于模块切换
|
||||
|
||||
@ComponentV2
|
||||
export struct EventBtn {
|
||||
//按钮动态布局类型,目前处于开发阶段两种状态.
|
||||
@ -30,7 +29,6 @@ export struct EventBtn {
|
||||
build() {
|
||||
Column({ space: 2 }) {
|
||||
//如果该类型是false表示为配普通事件按钮
|
||||
if(!this.eventBtnType){
|
||||
if (this.eventBtn != undefined) {
|
||||
Button()
|
||||
.width(ebWidth)
|
||||
@ -43,33 +41,19 @@ export struct EventBtn {
|
||||
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 = TitleTabData.mModels.get(1)
|
||||
} else if (this.eventBtn?.eEvent == 'Switch_Model_CAM') {
|
||||
this.curtModel = TitleTabData.mModels.get(2)
|
||||
} else if (this.eventBtn?.eEvent == 'Switch_Model_CAE') {
|
||||
this.curtModel = TitleTabData.mModels.get(3)
|
||||
if(!this.eventBtnType){
|
||||
ExecuteCommand(this.eventBtn as TitleButton);
|
||||
}else{
|
||||
if (this.eventBtn?.eEvent == 'Switch_Model_CAD') {
|
||||
this.curtModel = TitleTabData.mModels.get(1)
|
||||
} else if (this.eventBtn?.eEvent == 'Switch_Model_CAM') {
|
||||
this.curtModel = TitleTabData.mModels.get(2)
|
||||
} else if (this.eventBtn?.eEvent == 'Switch_Model_CAE') {
|
||||
this.curtModel = TitleTabData.mModels.get(3)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
if (this.eventBtn != undefined) {
|
||||
Text()
|
||||
.width('auto')
|
||||
@ -90,20 +74,34 @@ export struct EventBtn {
|
||||
//功能目录菜单,主要用于针对单一按钮多个功能形式
|
||||
@ComponentV2
|
||||
export struct MenuBtn {
|
||||
@Param menuBtn: Array<TitleButton> | undefined = undefined;
|
||||
@Param menus: Array<TitleButton> | undefined = undefined;
|
||||
@Local curtIndex:number=0;
|
||||
@Local argsMenu:BaseMenuData= {
|
||||
aMenus: this.menuBtn as Array<TitleButton|Array<TitleButton>>,
|
||||
aIndex: this.curtIndex
|
||||
};
|
||||
|
||||
@Builder
|
||||
BaseMenu (){
|
||||
Menu() {
|
||||
ForEach(this.menus, (item: TitleButton, index: number) => {
|
||||
//如果是功能组则
|
||||
if(!Array.isArray(item)){
|
||||
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) {
|
||||
if (this.menus != undefined) {
|
||||
Button()
|
||||
.bindMenu(BaseMenu(this.argsMenu))
|
||||
.bindMenu(this.BaseMenu)
|
||||
.width(ebWidth)
|
||||
.height(ebHeigth)
|
||||
.backgroundImage($r('app.media.' + this.menuBtn[this.curtIndex].eIcon))
|
||||
.backgroundImage($r('app.media.' + this.menus[this.curtIndex].eIcon))
|
||||
.backgroundImagePosition({ x: '5%', y: '5%' })
|
||||
.backgroundColor(Color.Transparent)
|
||||
.backgroundImageSize({
|
||||
@ -112,14 +110,14 @@ export struct MenuBtn {
|
||||
})
|
||||
Button()
|
||||
.type(ButtonType.Normal)
|
||||
.bindMenu(BaseMenu(this.argsMenu))
|
||||
.bindMenu(this.BaseMenu)
|
||||
.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)
|
||||
Text((this.menus[this.curtIndex].eName))
|
||||
.fontSize(16)
|
||||
.width('auto')
|
||||
.height(edHeigth)
|
||||
@ -130,31 +128,67 @@ export struct MenuBtn {
|
||||
}
|
||||
}
|
||||
|
||||
//Title Sub功能目录菜单
|
||||
|
||||
//图片按钮菜单功能.
|
||||
//该符合组件支持用户选择Button的Icon的Index联动
|
||||
@ComponentV2
|
||||
export struct SubColumnMenu {
|
||||
@Param menus: Array<TitleButton>| undefined = undefined;
|
||||
@Param icon:string='';
|
||||
@Param menus: Array<TitleButton|Array<TitleButton>> = [];
|
||||
@Local curtIndex:number=0;
|
||||
@Local argsMenu:BaseMenuData= {
|
||||
aMenus: this.menus as Array<TitleButton|Array<TitleButton>>,
|
||||
aIndex: this.curtIndex
|
||||
};
|
||||
@Param icon:string|undefined=undefined;
|
||||
@Param name:string|undefined=undefined;
|
||||
@Builder
|
||||
SubMenu (subMenu:Array<TitleButton>) {
|
||||
Menu() {
|
||||
ForEach(subMenu, (subItem: TitleButton, index: number) => {
|
||||
MenuItem({
|
||||
startIcon: $r('app.media.' + subItem.eIcon),
|
||||
content: subItem.eName,
|
||||
})
|
||||
.onClick(() => {
|
||||
ExecuteCommand(subItem as TitleButton);
|
||||
})
|
||||
.size({ height: ebWidth })
|
||||
})
|
||||
}.fontSize(20)
|
||||
}
|
||||
@Builder
|
||||
BaseMenu (){
|
||||
Menu() {
|
||||
ForEach(this.menus, (item: TitleButton|Array<TitleButton>, index: number) => {
|
||||
//如果是功能组则
|
||||
if(!Array.isArray(item)){
|
||||
MenuItem({ startIcon: $r('app.media.'+item.eIcon), content: item.eName })
|
||||
.onClick(()=> {
|
||||
this.curtIndex=index;
|
||||
ExecuteCommand(item as TitleButton);
|
||||
})
|
||||
.size({height: ebWidth})
|
||||
}else{
|
||||
MenuItem({
|
||||
startIcon: $r('app.media.' + item[0].eIcon),
|
||||
content: item[0].eName,
|
||||
builder: this.SubMenu(item)
|
||||
})
|
||||
}
|
||||
})
|
||||
}.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(BaseMenu(this.argsMenu))
|
||||
.type(ButtonType.Normal)
|
||||
}
|
||||
Button(){
|
||||
Row(){
|
||||
Image($r('app.media.'+(this.icon!=undefined ? this.icon:(this.menus[this.curtIndex]as TitleButton).eIcon)))
|
||||
if(this.name!=undefined){
|
||||
Text(this.name).fontSize(20)
|
||||
}
|
||||
}
|
||||
}.width(ebWidth)
|
||||
.height(ebWidth)
|
||||
.backgroundColor(Color.Transparent)
|
||||
.bindMenu(this.BaseMenu)
|
||||
.type(ButtonType.Normal)
|
||||
}.width(this.name!=undefined ?mwInfo.mainWindowWidth*0.03:ebWidth)
|
||||
}
|
||||
}
|
||||
@ -1,27 +1,43 @@
|
||||
import { mwInfo } from "../AppStorageV2Class";
|
||||
import { TitleButton } from "../LayoutInterface/Interface/ButtonInterface";
|
||||
|
||||
//按钮统一尺寸,该按钮为正方形,所以以主窗口宽为基准,长=高->正方形
|
||||
let ebWidth=mwInfo.mainWindowWidth*0.075;
|
||||
let ebHeigth=mwInfo.mainWindowHeight*0.03;
|
||||
//占位符的高度
|
||||
let edHeigth=mwInfo.mainWindowWidth*0.005
|
||||
|
||||
@ComponentV2
|
||||
export struct TextComboBox {
|
||||
@Param menu: Array<TitleButton> = new Array<TitleButton>;
|
||||
@Local selectIndex:number=0;
|
||||
@Param name:string|undefined=undefined;
|
||||
@Builder
|
||||
EventMenu() {
|
||||
Menu() {
|
||||
ForEach(this.menu, (item: TitleButton, index: number) => {
|
||||
MenuItem({ content: item.eName })
|
||||
.size({height: mwInfo.mainWindowWidth*0.02})
|
||||
.size({height: ebHeigth})
|
||||
.onClick(()=>{
|
||||
this.selectIndex=index;
|
||||
})
|
||||
})
|
||||
}
|
||||
}.fontSize(20)
|
||||
}
|
||||
build() {
|
||||
Row() {
|
||||
Text(this.name!=undefined?this.name:'')
|
||||
.fontSize(18)
|
||||
.width('auto')
|
||||
Text(this.menu[this.selectIndex].eName)
|
||||
.bindMenu(this.EventMenu)
|
||||
}
|
||||
.width('50%')
|
||||
.fontSize(18)
|
||||
.backgroundColor('#ffe6e6e3')
|
||||
.height(mwInfo.mainWindowHeight*0.022)
|
||||
.margin({ top:0, left: 5, bottom: 0, right: 0 })
|
||||
}.width(ebWidth)
|
||||
.height(ebHeigth)
|
||||
}
|
||||
}
|
||||
@ComponentV2
|
||||
@ -33,7 +49,7 @@ export struct TextInputComboBox {
|
||||
Menu() {
|
||||
ForEach(this.menu, (item: TitleButton, index: number) => {
|
||||
MenuItem({ content: item.eName })
|
||||
.size({height: mwInfo.mainWindowWidth*0.02})
|
||||
.size({height: ebHeigth})
|
||||
.onClick(()=>{
|
||||
this.selectIndex=index;
|
||||
})
|
||||
|
||||
@ -1,6 +1,10 @@
|
||||
import { mwInfo } from "../AppStorageV2Class";
|
||||
import { TitleButton } from "../LayoutInterface/Interface/ButtonInterface";
|
||||
import {SwitchView} from "../LayoutInterface/Layout/SwitchView"
|
||||
|
||||
//按钮统一尺寸,该按钮为正方形,所以以主窗口宽为基准,长=高->正方形
|
||||
let ebWidth=mwInfo.mainWindowWidth*0.02;
|
||||
let ebHeigth=mwInfo.mainWindowWidth*0.02;
|
||||
//视图切换弹窗
|
||||
@CustomDialog
|
||||
export struct ViewDialog {
|
||||
@ -11,14 +15,19 @@ export struct ViewDialog {
|
||||
ForEach(SwitchView, (item: TitleButton, index?: number | undefined) => {
|
||||
GridCol({ span: 1 }) {
|
||||
Row() {
|
||||
Image($r('app.media.' + item.eIcon))
|
||||
.width('35vp')
|
||||
.height('35vp')
|
||||
.objectFit(ImageFit.Contain)
|
||||
Button()
|
||||
.backgroundColor(Color.Transparent)
|
||||
.backgroundImage($r('app.media.' + item.eIcon))
|
||||
.backgroundImageSize({
|
||||
width: '100%', // 图片宽度占满按钮
|
||||
height: '100%' // 图片高度占满按钮
|
||||
})
|
||||
.width(ebWidth)
|
||||
.height(ebWidth)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}.margin({ top: 5, left: 1, bottom: 1, right: 1 })
|
||||
}
|
||||
}
|
||||
@ -9,8 +9,6 @@ import { BaseMenuData } from "../LayoutInterface/Interface/MenuInterface";
|
||||
let ebWidth=mwInfo.mainWindowWidth*0.02;
|
||||
let ebHeigth=mwInfo.mainWindowWidth*0.02;
|
||||
|
||||
|
||||
//不带Index的Menu
|
||||
@Builder
|
||||
export function BaseMenu(indexMenu:BaseMenuData) {
|
||||
Menu() {
|
||||
@ -25,7 +23,6 @@ export function BaseMenu(indexMenu:BaseMenuData) {
|
||||
}else{
|
||||
MenuItem({ startIcon: $r('app.media.'+item.eIcon), content: item.eName })
|
||||
.onClick(()=> {
|
||||
indexMenu.aIndex = index;
|
||||
ExecuteCommand(item as TitleButton);
|
||||
})
|
||||
.size({height: ebWidth})
|
||||
|
||||
@ -7,12 +7,11 @@ import {DisplayMode} from "../LayoutInterface/Layout/DisplayMode"
|
||||
import { LayoutSwitch } from "../LayoutInterface/Layout/LayoutSwitch";
|
||||
import { FileMenuData } from "../LayoutInterface/Layout/FileMenuData";
|
||||
import { mwInfo } from "../AppStorageV2Class";
|
||||
import { SubColumnMenu } from "../CustomStyle/Button";
|
||||
import { SubColumnMenu} from "../CustomStyle/Button";
|
||||
|
||||
|
||||
@ComponentV2
|
||||
export struct TitleColumnSub {
|
||||
|
||||
@Local layerArray: Array<TitleButton> = [];
|
||||
@Local dX:number=0;
|
||||
@Local dY:number=0;
|
||||
@ -22,8 +21,8 @@ export struct TitleColumnSub {
|
||||
private ViewDialog(): CustomDialogController {
|
||||
return new CustomDialogController({
|
||||
builder: ViewDialog(), // 确保 ViewDialog 组件已正确定义
|
||||
width: mwInfo.mainWindowWidth*0.04,
|
||||
height: mwInfo.mainWindowWidth*0.04,
|
||||
width: mwInfo.mainWindowWidth*0.06,
|
||||
height: mwInfo.mainWindowWidth*0.052,
|
||||
borderWidth: 1,
|
||||
cornerRadius: 5,
|
||||
isModal: true,
|
||||
@ -34,21 +33,16 @@ export struct TitleColumnSub {
|
||||
|
||||
build(){
|
||||
Row({space:5}){
|
||||
SubColumnMenu({menus:FileMenuData.aMenus as Array<TitleButton>,icon:'base_shortcut_menu'})
|
||||
SubColumnMenu({
|
||||
menus:FileMenuData.aMenus as Array<TitleButton>, icon:'base_shortcut_menu',name:'菜单'})
|
||||
.margin({ top:0, left: 5, bottom: 0, right: 0 })
|
||||
Text('菜单')
|
||||
.fontSize(20)
|
||||
Text('|')
|
||||
Text('拾取类型:')
|
||||
.fontSize(20)
|
||||
TextComboBox({menu:SelectionFilter})
|
||||
.borderWidth(1)
|
||||
.borderColor(Color.Grey)
|
||||
.borderRadius(5)
|
||||
TextComboBox({name:'拾取类型:',menu:SelectionFilter})
|
||||
Text('图层:')
|
||||
.fontSize(20)
|
||||
TextInputComboBox({menu:this.layerArray}).width('10%')
|
||||
SubColumnMenu({menus:LayoutSwitch,icon:LayoutSwitch[0].eIcon})
|
||||
SubColumnMenu({menus:LayoutSwitch})
|
||||
//视角弹窗
|
||||
Button().onClick((event) => {
|
||||
this.dX=event.windowX
|
||||
@ -57,15 +51,15 @@ export struct TitleColumnSub {
|
||||
this.viewDialog=this.ViewDialog();
|
||||
}
|
||||
this.viewDialog.open();
|
||||
}).width(mwInfo.mainWindowWidth*0.013)
|
||||
.height(mwInfo.mainWindowWidth*0.013)
|
||||
}).width(mwInfo.mainWindowWidth*0.014)
|
||||
.height(mwInfo.mainWindowWidth*0.014)
|
||||
.backgroundColor(Color.Transparent)
|
||||
.backgroundImage($r('app.media.' + SwitchView[0].eIcon))
|
||||
.backgroundImageSize({
|
||||
width: '100%', // 图片宽度占满按钮
|
||||
height: '100%' // 图片高度占满按钮
|
||||
})
|
||||
SubColumnMenu({menus:DisplayMode,icon:DisplayMode[0].eIcon})
|
||||
SubColumnMenu({menus:DisplayMode})
|
||||
}.margin({ top: 1, left: 1, bottom: 1, right: 1 })
|
||||
}
|
||||
}
|
||||
@ -3,8 +3,8 @@ import {TitleTabData, TitleModel} from '../LayoutInterface/Layout/TitleTabData'
|
||||
import { FileMenuData } from "../LayoutInterface/Layout/FileMenuData";
|
||||
import {TitleTabContent} from './TitleTabContent'
|
||||
import { mwInfo } from '../AppStorageV2Class';
|
||||
import { BaseMenu} from '../CustomStyle/Menu';
|
||||
import { TitleButton } from '../LayoutInterface/Interface/ButtonInterface';
|
||||
import { BaseMenu } from '../CustomStyle/Menu';
|
||||
|
||||
@Entry
|
||||
@ComponentV2
|
||||
|
||||
@ -4,7 +4,6 @@ import { TitleGroup} from '../LayoutInterface/Interface/GroupInterface';
|
||||
import {GroupTextEventMenu} from '../CustomStyle/Menu'
|
||||
import {EventBtn,MenuBtn} from '../CustomStyle/Button'
|
||||
import { TitleModel } from '../LayoutInterface/Layout/TitleTabData';
|
||||
import { mwInfo } from '../AppStorageV2Class';
|
||||
|
||||
@ComponentV2
|
||||
export struct TitleTabContent {
|
||||
@ -30,25 +29,24 @@ export struct TitleTabContent {
|
||||
ForEach(group_item.grpBtn, (btn_item: TitleButton|Array<TitleButton>, index: number) =>{
|
||||
if(this.curtLayout?.cmName=='应用模块'){
|
||||
if(Array.isArray(btn_item)){
|
||||
MenuBtn({menuBtn:btn_item})
|
||||
MenuBtn({menus:btn_item})
|
||||
}else{
|
||||
EventBtn({eventBtn:btn_item,eventBtnType:true})
|
||||
}
|
||||
}else{
|
||||
if(Array.isArray(btn_item)){
|
||||
MenuBtn({menuBtn:btn_item})
|
||||
MenuBtn({menus:btn_item})
|
||||
}else{
|
||||
EventBtn({eventBtn:btn_item})
|
||||
}
|
||||
}
|
||||
})
|
||||
}.margin({ top: 1,left:1,bottom:1,right:1})
|
||||
}.margin({ top: 1,left:10,bottom:1,right:10})
|
||||
//功能组名
|
||||
Row(){
|
||||
GroupTextEventMenu({grpEvent:group_item})
|
||||
}
|
||||
}.margin({ top: 0,left:0,bottom:-5,right:0})
|
||||
}
|
||||
|
||||
Divider().vertical(true).strokeWidth(1).lineCap(LineCapStyle.Round).height('95%').backgroundColor(Color.Gray)
|
||||
})
|
||||
}else{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user