解耦事件,把事件类型分为Page和Event.
Page主要针对Arkui侧的子窗口事件 Event主要针对Native侧的事件. 后续考虑解耦为如下: Arkui_Page(主要针对子窗口归一化调用) Arkui_Event(主要针对arkui侧的归一化动态组件操作) Native_Page(主要针对Native侧对Arkui侧的页面数据更新和回调) Native_Event(主要针对单一从Aarkui侧调用Native指令) 本次更新后btnEvent中增加了page地址和args.可以在预置功能中预置命令和参数.
This commit is contained in:
parent
ba448cd637
commit
deb0edcc0d
@ -48,6 +48,7 @@ export default class EntryAbility extends UIAbility {
|
|||||||
//InitFont->Copy Res/resfile/font to sandbox
|
//InitFont->Copy Res/resfile/font to sandbox
|
||||||
|
|
||||||
InitGlobalDisplayWindowInfo(windowStage);
|
InitGlobalDisplayWindowInfo(windowStage);
|
||||||
|
|
||||||
//Get Main Window
|
//Get Main Window
|
||||||
windowStage.getMainWindow((err, data) => {
|
windowStage.getMainWindow((err, data) => {
|
||||||
if (err.code) {
|
if (err.code) {
|
||||||
@ -76,7 +77,6 @@ export default class EntryAbility extends UIAbility {
|
|||||||
ChangeData.height);
|
ChangeData.height);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
//Load page
|
//Load page
|
||||||
windowStage.loadContent('pages/Index', (err) => {
|
windowStage.loadContent('pages/Index', (err) => {
|
||||||
if (err.code) {
|
if (err.code) {
|
||||||
|
|||||||
@ -34,7 +34,7 @@ export async function CreateAndShowSubWindow(winInfo:WinInfo) {
|
|||||||
await mwsInfo.winStage.createSubWindowWithOptions('subWindow', options).then((data) => {
|
await mwsInfo.winStage.createSubWindowWithOptions('subWindow', options).then((data) => {
|
||||||
subWindow = data;
|
subWindow = data;
|
||||||
//子窗口创建成功后,设置子窗口的位置、大小及相关属性等。
|
//子窗口创建成功后,设置子窗口的位置、大小及相关属性等。
|
||||||
subWindow.moveWindowTo(25, 25)
|
subWindow.moveWindowTo(50, 50)
|
||||||
//子窗口重置大小
|
//子窗口重置大小
|
||||||
console.info("页面路径:", winInfo.page);
|
console.info("页面路径:", winInfo.page);
|
||||||
subWindow.resize(winInfo.width,winInfo.height);
|
subWindow.resize(winInfo.width,winInfo.height);
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { hilog } from '@kit.PerformanceAnalysisKit';
|
import { hilog } from '@kit.PerformanceAnalysisKit';
|
||||||
import { edgeColors, display, AppStorageV2 } from '@kit.ArkUI';
|
import { OverlayManager } from '@kit.ArkUI';
|
||||||
import { TitleTab } from './TitleLayout/TitleTab'
|
import { TitleTab } from './TitleLayout/TitleTab'
|
||||||
import { LeftSideTab } from './LeftSideLayout/LeftSideTab'
|
import { LeftSideTab } from './LeftSideLayout/LeftSideTab'
|
||||||
import { RightSideTab } from './RightSideLayout/RightSideTab'
|
import { RightSideTab } from './RightSideLayout/RightSideTab'
|
||||||
@ -16,31 +16,35 @@ struct Index {
|
|||||||
@Local isDragging:boolean=false;
|
@Local isDragging:boolean=false;
|
||||||
@Provider('LeftSideWidth') leftSideWidth:number=mwInfo.width * 0.1;
|
@Provider('LeftSideWidth') leftSideWidth:number=mwInfo.width * 0.1;
|
||||||
@Provider('RightSideWidth') rightSideWidth:number=mwInfo.width * 0.1;
|
@Provider('RightSideWidth') rightSideWidth:number=mwInfo.width * 0.1;
|
||||||
|
private uiContext: UIContext = this.getUIContext();
|
||||||
|
private overlayManager: OverlayManager = this.uiContext.getOverlayManager();
|
||||||
|
private componentContent: ComponentContent | null = null;
|
||||||
|
|
||||||
build() {
|
build() {
|
||||||
//OpenCAX主界面整体布局,采用多行布局
|
//OpenCAX主界面整体布局,采用多行布局
|
||||||
Column() {
|
Column() {
|
||||||
//头部导航功能区
|
//头部导航功能区
|
||||||
TitleTab().height('15%')
|
TitleTab().height('15%')
|
||||||
//分割线
|
//分割线
|
||||||
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)
|
||||||
//工具栏
|
//工具栏
|
||||||
Row() {
|
Row() {
|
||||||
TitleColumnSub()
|
TitleColumnSub()
|
||||||
}.height('4%')
|
}.height('4%')
|
||||||
.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)
|
||||||
Row() {
|
Row() {
|
||||||
//左侧边导航区
|
//左侧边导航区
|
||||||
LeftSideTab()
|
LeftSideTab()
|
||||||
// 左拖拽手柄
|
// 左拖拽手柄
|
||||||
Divider().vertical(true).strokeWidth(3).lineCap(LineCapStyle.Round).height('100%').backgroundColor(Color.Grey)
|
Divider().vertical(true).strokeWidth(3).lineCap(LineCapStyle.Round).height('100%').backgroundColor(Color.Grey)
|
||||||
.onMouse((event) => {
|
.onMouse((event) => {
|
||||||
if(event.button==MouseButton.Left&&event.action==MouseAction.Press){
|
if(event.button==MouseButton.Left&&event.action==MouseAction.Press){
|
||||||
this.startX = event.screenX; // 记录起始坐标
|
this.startX = event.screenX; // 记录起始坐标
|
||||||
this.isDragging = true;
|
this.isDragging = true;
|
||||||
}else if(event.action==MouseAction.Move&&this.isDragging){
|
}else if(event.action==MouseAction.Move&&this.isDragging){
|
||||||
// 计算新的宽度
|
// 计算新的宽度
|
||||||
let newWidth = this.leftSideWidth + (event.screenX - this.startX);
|
let newWidth = this.leftSideWidth + (event.screenX - this.startX);
|
||||||
// 添加最小宽度限制
|
// 添加最小宽度限制
|
||||||
@ -48,47 +52,47 @@ struct Index {
|
|||||||
this.leftSideWidth = newWidth;
|
this.leftSideWidth = newWidth;
|
||||||
// 更新起始坐标,实现连续拖动
|
// 更新起始坐标,实现连续拖动
|
||||||
this.startX = event.screenX;
|
this.startX = event.screenX;
|
||||||
}else if(event.action==MouseAction.Release){
|
}else if(event.action==MouseAction.Release){
|
||||||
this.isDragging = false;
|
this.isDragging = false;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
//中间操作区域
|
//中间操作区域
|
||||||
Row() {
|
Row() {
|
||||||
ModelViewTab()
|
ModelViewTab()
|
||||||
}.layoutWeight(1)
|
}.layoutWeight(1)
|
||||||
.align(Alignment.Center)
|
.align(Alignment.Center)
|
||||||
//右拖拽手柄
|
//右拖拽手柄
|
||||||
Divider().vertical(true).strokeWidth(3).lineCap(LineCapStyle.Round).height('100%').backgroundColor(Color.Grey)
|
Divider().vertical(true).strokeWidth(3).lineCap(LineCapStyle.Round).height('100%').backgroundColor(Color.Grey)
|
||||||
.onMouse((event) => {
|
.onMouse((event) => {
|
||||||
if(event.button==MouseButton.Left&&event.action==MouseAction.Press){
|
if(event.button==MouseButton.Left&&event.action==MouseAction.Press){
|
||||||
this.startX = event.screenX; // 记录起始坐标
|
this.startX = event.screenX; // 记录起始坐标
|
||||||
this.isDragging = true;
|
this.isDragging = true;
|
||||||
}else if(event.action==MouseAction.Move&&this.isDragging){
|
}else if(event.action==MouseAction.Move&&this.isDragging){
|
||||||
// 计算新的宽度
|
// 计算新的宽度
|
||||||
let newWidth = this.rightSideWidth - (event.screenX - this.startX);
|
let newWidth = this.rightSideWidth - (event.screenX - this.startX);
|
||||||
// 添加最小宽度限制
|
// 添加最小宽度限制
|
||||||
newWidth = Math.max(newWidth, 0);
|
newWidth = Math.max(newWidth, 0);
|
||||||
this.rightSideWidth = newWidth;
|
this.rightSideWidth = newWidth;
|
||||||
// 更新起始坐标,实现连续拖动
|
// 更新起始坐标,实现连续拖动
|
||||||
this.startX = event.screenX;
|
this.startX = event.screenX;
|
||||||
}else if(event.action==MouseAction.Release){
|
}else if(event.action==MouseAction.Release){
|
||||||
this.isDragging = false;
|
this.isDragging = false;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
//右侧边导航区
|
//右侧边导航区
|
||||||
RightSideTab()
|
RightSideTab()
|
||||||
}.height('77%')
|
}.height('77%')
|
||||||
//分割线
|
//分割线
|
||||||
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)
|
||||||
///状态栏
|
///状态栏
|
||||||
Column() {
|
Column() {
|
||||||
Text('状态栏').fontSize(16)
|
Text('状态栏').fontSize(16)
|
||||||
|
}.width('100%')
|
||||||
|
.align(Alignment.End)
|
||||||
|
.alignItems(HorizontalAlign.Start)
|
||||||
|
.justifyContent(FlexAlign.Center)
|
||||||
|
.height('4%')
|
||||||
}.width('100%')
|
}.width('100%')
|
||||||
.align(Alignment.End)
|
.height('100%')
|
||||||
.alignItems(HorizontalAlign.Start)
|
|
||||||
.justifyContent(FlexAlign.Center)
|
|
||||||
.height('4%')
|
|
||||||
}.width('100%')
|
|
||||||
.height('100%')
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -69,6 +69,5 @@ export struct LeftSideTab {
|
|||||||
}.barHeight(0)
|
}.barHeight(0)
|
||||||
}.width(this.isExpanded?this.leftSideWidth:0)
|
}.width(this.isExpanded?this.leftSideWidth:0)
|
||||||
}.width('auto')
|
}.width('auto')
|
||||||
.backgroundColor($r('sys.color.background_secondary'))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -61,10 +61,8 @@ export struct ModelViewTab {
|
|||||||
.height('auto')
|
.height('auto')
|
||||||
.barMode(BarMode.Fixed)
|
.barMode(BarMode.Fixed)
|
||||||
.barPosition(BarPosition.Start)
|
.barPosition(BarPosition.Start)
|
||||||
.backgroundBlurStyle(BlurStyle.COMPONENT_THIN)
|
|
||||||
.fadingEdge(true)
|
.fadingEdge(true)
|
||||||
.barMode(BarMode.Scrollable)
|
.barMode(BarMode.Scrollable)
|
||||||
.backgroundColor($r('sys.color.comp_background_secondary'))
|
|
||||||
.divider({ strokeWidth: '1px', color: $r('sys.color.comp_divider') })
|
.divider({ strokeWidth: '1px', color: $r('sys.color.comp_divider') })
|
||||||
}else{
|
}else{
|
||||||
Image($r('app.media.base_background'))
|
Image($r('app.media.base_background'))
|
||||||
|
|||||||
@ -36,8 +36,6 @@ export struct RightSideTab {
|
|||||||
}).margin({ top: 2,left:1,bottom:0,right:2})
|
}).margin({ top: 2,left:1,bottom:0,right:2})
|
||||||
Blank().layoutWeight(1)
|
Blank().layoutWeight(1)
|
||||||
}.borderWidth(1)
|
}.borderWidth(1)
|
||||||
.borderColor(Color.Grey)
|
|
||||||
}.width('auto')
|
}.width('auto')
|
||||||
.backgroundColor($r('sys.color.background_secondary'))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -64,5 +64,7 @@ export struct TitleColumnSub {
|
|||||||
SubColumnMenu({menus:DisplayMode})
|
SubColumnMenu({menus:DisplayMode})
|
||||||
}.width('100%')
|
}.width('100%')
|
||||||
.height('100%')
|
.height('100%')
|
||||||
|
.backgroundBlurStyle(BlurStyle.Thin,
|
||||||
|
{ colorMode: ThemeColorMode.LIGHT, adaptiveColor: AdaptiveColor.DEFAULT, scale: 1.0 })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -87,6 +87,9 @@ export struct TitleTab {
|
|||||||
.barHeight(0)
|
.barHeight(0)
|
||||||
.barMode(BarMode.Fixed)
|
.barMode(BarMode.Fixed)
|
||||||
}.margin({ top:0, left: 0, bottom: 0, right: 0 })
|
}.margin({ top:0, left: 0, bottom: 0, right: 0 })
|
||||||
.backgroundColor($r('sys.color.background_secondary'))
|
//.backgroundColor($r('sys.color.background_secondary'))
|
||||||
|
.borderRadius(15)
|
||||||
|
.backgroundBlurStyle(BlurStyle.Thin,
|
||||||
|
{ colorMode: ThemeColorMode.LIGHT, adaptiveColor: AdaptiveColor.DEFAULT, scale: 1.0 })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user