From 3d897e7acec2c45fde1ddae7ca3113ca2b732703 Mon Sep 17 00:00:00 2001 From: Knight4Lancelot <320062713@qq.com> Date: Sat, 22 Feb 2025 14:42:34 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E5=85=83=E6=9C=8D=E5=8A=A1Navigation?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E6=96=B0=E5=A2=9E=E5=AE=BD=E5=B1=8F=E8=87=AA?= =?UTF-8?q?=E5=AE=9A=E4=B9=89=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Knight4Lancelot --- .../interfaces/atomicservicenavigation.js | 59 +++++++++++++------ .../source/atomicservicenavigation.ets | 43 ++++++++++++-- 2 files changed, 81 insertions(+), 21 deletions(-) diff --git a/atomicservicenavigation/interfaces/atomicservicenavigation.js b/atomicservicenavigation/interfaces/atomicservicenavigation.js index a3e73c5..b702bf3 100644 --- a/atomicservicenavigation/interfaces/atomicservicenavigation.js +++ b/atomicservicenavigation/interfaces/atomicservicenavigation.js @@ -21,6 +21,7 @@ const LengthMetrics = requireNapi('arkui.node').LengthMetrics; const SymbolGlyphModifier = requireNapi('arkui.modifier').SymbolGlyphModifier; const bundleManager = requireNapi('bundle.bundleManager'); const hilog = requireNapi('hilog'); +const i18n = requireNapi('i18n'); /** * 背景渐变色相关数据 */ @@ -50,6 +51,12 @@ const SIDE_BAR_OVERLAY_WIDTH = 304; const SIDE_BAR_COMMON_WIDTH = 360; const CONTENT_MIN_WIDTH = 600; const ATOMIC_SERVICE_CAPSULE_WIDTH = 81.5; +/** + * 抽屉模式适应不同设备尺寸下menubar的宽度 + */ +const BREAK_POINT_SM_MENUBAR_WIDTH = 16; +const BREAK_POINT_MD_MENUBAR_WIDTH = 24; +const BREAK_POINT_LG_MENUBAR_WIDTH = 32; /** * 背景颜色的不透明度的枚举类型 * @@ -538,6 +545,25 @@ export class AtomicServiceNavigation extends ViewPU { } } } + /** + * 返回抽屉模式下需要避让menubar的宽度 + */ + getMenuBarAvoidAreaWidth() { + switch (this.currentBreakPoint) { + case BREAK_POINT_SM: { + return BREAK_POINT_SM_MENUBAR_WIDTH; + } + case BREAK_POINT_MD: { + return BREAK_POINT_MD_MENUBAR_WIDTH; + } + case BREAK_POINT_LG: { + return BREAK_POINT_LG_MENUBAR_WIDTH; + } + default: { + return BREAK_POINT_SM_MENUBAR_WIDTH; + } + } + } drawerTitleBuilder(parent = null) { this.observeComponentCreation2((elmtId, isInitialRender) => { If.create(); @@ -551,11 +577,11 @@ export class AtomicServiceNavigation extends ViewPU { top: LengthMetrics.vp(10), bottom: LengthMetrics.vp(10), // 在Stack模式,或者非分栏模式下右侧需要有一定padding值,避免超长文本时不能避让menuBar - end: ((this.currentBreakPoint === BREAK_POINT_SM && (this.mode === NavigationMode.Auto || !this.mode)) || - this.mode === NavigationMode.Stack) ? LengthMetrics.vp(ATOMIC_SERVICE_CAPSULE_WIDTH + 16) : - LengthMetrics.vp(0) + end: ((this.currentBreakPoint === BREAK_POINT_SM && + (this.mode === NavigationMode.Auto || !this.mode)) || this.mode === NavigationMode.Stack) ? + LengthMetrics.vp(ATOMIC_SERVICE_CAPSULE_WIDTH + this.getMenuBarAvoidAreaWidth()) : LengthMetrics.vp(0) }); - Row.width('100%'); + Row.width('50%'); }, Row); this.observeComponentCreation2((elmtId, isInitialRender) => { Text.create(this.title); @@ -563,12 +589,14 @@ export class AtomicServiceNavigation extends ViewPU { Text.minFontSize(14); Text.maxFontSize(26); Text.height(36); - Text.fontColor({ 'id': -1, 'type': 10001, params: ['sys.color.font_primary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); + Text.fontColor({ 'id': -1, 'type': 10001, params: ['sys.color.font_primary'], + 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); Text.textOverflow({ overflow: TextOverflow.Ellipsis }); Text.fontWeight(FontWeight.Bold); Text.width(0); Text.layoutWeight(1); Text.clip(true); + Text.textAlign(i18n.isRTL(i18n.System.getSystemLocale()) ? TextAlign.End : TextAlign.Start); }, Text); Text.pop(); Row.pop(); @@ -951,9 +979,15 @@ export class AtomicServiceNavigation extends ViewPU { }, If); If.pop(); } + /** + * 根据当前屏幕尺寸判断是否要显示用户插入的布局 + */ isShowMenus() { return this.mode === NavigationMode.Stack && this.currentBreakPoint !== BREAK_POINT_SM; } + /** + * 根据用户传入的类型和当前屏幕尺寸判断是否要显示NavigationMenuItem列表 + */ getMenuItemArray() { return this.isShowMenus() && this.menus instanceof Array ? this.menus : undefined; } @@ -962,18 +996,9 @@ export class AtomicServiceNavigation extends ViewPU { Stack.create(); Stack.width('100%'); Stack.height('100%'); - Stack.background(this.gradientBackground === undefined ? undefined : { - builder: () => { - this.BackgroundBuilder.call(this, - makeBuilderParameterProxy('BackgroundBuilder', { - primaryColor: () => this.gradientBackground.primaryColor, - secondaryColor: () => this.gradientBackground.secondaryColor, - backgroundTheme: () => this.gradientBackground.backgroundTheme, - mixMode: () => this.gradientBackground.mixMode, - alpha: () => this.gradientBackground.alpha - }) - ); - }}); + Stack.background(this.gradientBackground === undefined ? undefined : { builder: () => { + this.BackgroundBuilder.call(this, makeBuilderParameterProxy('BackgroundBuilder', { primaryColor: () => this.gradientBackground.primaryColor, secondaryColor: () => this.gradientBackground.secondaryColor, backgroundTheme: () => this.gradientBackground.backgroundTheme, mixMode: () => this.gradientBackground.mixMode, alpha: () => this.gradientBackground.alpha })); + } }); Stack.onSizeChange((oldValue, newValue) => { this.navigationWidth = newValue.width; this.navigationHeight = newValue.height; diff --git a/atomicservicenavigation/source/atomicservicenavigation.ets b/atomicservicenavigation/source/atomicservicenavigation.ets index 95650eb..df2c279 100644 --- a/atomicservicenavigation/source/atomicservicenavigation.ets +++ b/atomicservicenavigation/source/atomicservicenavigation.ets @@ -17,6 +17,7 @@ import { BusinessError, Callback } from '@ohos.base'; import { curves, LengthMetrics, SymbolGlyphModifier, window } from '@kit.ArkUI'; import { bundleManager, common } from '@kit.AbilityKit'; import { hilog } from '@kit.PerformanceAnalysisKit'; +import { i18n } from '@kit.LocalizationKit'; /** * 背景渐变色相关数据 @@ -49,6 +50,13 @@ const SIDE_BAR_COMMON_WIDTH = 360; const CONTENT_MIN_WIDTH = 600; const ATOMIC_SERVICE_CAPSULE_WIDTH = 81.5; +/** + * 抽屉模式适应不同设备尺寸下menubar的宽度 + */ +const BREAK_POINT_SM_MENUBAR_WIDTH: number = 16; +const BREAK_POINT_MD_MENUBAR_WIDTH: number = 24; +const BREAK_POINT_LG_MENUBAR_WIDTH: number = 32; + /** * 背景颜色的不透明度的枚举类型 * @@ -338,6 +346,26 @@ export struct AtomicServiceNavigation { } } + /** + * 返回抽屉模式下需要避让menubar的宽度 + */ + private getMenuBarAvoidAreaWidth(): number { + switch (this.currentBreakPoint) { + case BREAK_POINT_SM: { + return BREAK_POINT_SM_MENUBAR_WIDTH; + } + case BREAK_POINT_MD: { + return BREAK_POINT_MD_MENUBAR_WIDTH; + } + case BREAK_POINT_LG: { + return BREAK_POINT_LG_MENUBAR_WIDTH; + } + default: { + return BREAK_POINT_SM_MENUBAR_WIDTH; + } + } + } + @Builder drawerTitleBuilder() { if (this.titleOptions?.titleBarType === TitleBarType.DRAWER && this.title) { @@ -353,6 +381,7 @@ export struct AtomicServiceNavigation { .width(0) .layoutWeight(1) .clip(true) + .textAlign(i18n.isRTL(i18n.System.getSystemLocale()) ? TextAlign.End : TextAlign.Start) } .padding({ start: LengthMetrics.vp(this.currentBreakPoint !== BREAK_POINT_LG ? this.marginWindowLeft + 36 + 8 : @@ -360,11 +389,11 @@ export struct AtomicServiceNavigation { top: LengthMetrics.vp(10), bottom: LengthMetrics.vp(10), // 在Stack模式,或者非分栏模式下右侧需要有一定padding值,避免超长文本时不能避让menuBar - end: ((this.currentBreakPoint === BREAK_POINT_SM && (this.mode === NavigationMode.Auto || !this.mode)) || - this.mode === NavigationMode.Stack) ? LengthMetrics.vp(ATOMIC_SERVICE_CAPSULE_WIDTH + 16) : - LengthMetrics.vp(0) + end: ((this.currentBreakPoint === BREAK_POINT_SM && + (this.mode === NavigationMode.Auto || !this.mode)) || this.mode === NavigationMode.Stack) ? + LengthMetrics.vp(ATOMIC_SERVICE_CAPSULE_WIDTH + this.getMenuBarAvoidAreaWidth()) : LengthMetrics.vp(0) }) - .width('100%') + .width('50%') } } @@ -549,10 +578,16 @@ export struct AtomicServiceNavigation { } } + /** + * 根据当前屏幕尺寸判断是否要显示用户插入的布局 + */ private isShowMenus(): boolean { return this.mode === NavigationMode.Stack && this.currentBreakPoint !== BREAK_POINT_SM; } + /** + * 根据用户传入的类型和当前屏幕尺寸判断是否要显示NavigationMenuItem列表 + */ private getMenuItemArray(): undefined | Array { return this.isShowMenus() && this.menus instanceof Array ? this.menus : undefined; } -- Gitee From 53bf89f7ae7962cf6a543a6e8ed0348b7fc54747 Mon Sep 17 00:00:00 2001 From: Knight4Lancelot <320062713@qq.com> Date: Sat, 22 Feb 2025 14:52:56 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E5=85=83=E6=9C=8D=E5=8A=A1Navigation?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E6=96=B0=E5=A2=9E=E5=AE=BD=E5=B1=8F=E8=87=AA?= =?UTF-8?q?=E5=AE=9A=E4=B9=89=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Knight4Lancelot --- .../interfaces/atomicservicenavigation.js | 45 ++++--------------- .../source/atomicservicenavigation.ets | 29 +----------- 2 files changed, 10 insertions(+), 64 deletions(-) diff --git a/atomicservicenavigation/interfaces/atomicservicenavigation.js b/atomicservicenavigation/interfaces/atomicservicenavigation.js index b702bf3..9eb112b 100644 --- a/atomicservicenavigation/interfaces/atomicservicenavigation.js +++ b/atomicservicenavigation/interfaces/atomicservicenavigation.js @@ -51,12 +51,6 @@ const SIDE_BAR_OVERLAY_WIDTH = 304; const SIDE_BAR_COMMON_WIDTH = 360; const CONTENT_MIN_WIDTH = 600; const ATOMIC_SERVICE_CAPSULE_WIDTH = 81.5; -/** - * 抽屉模式适应不同设备尺寸下menubar的宽度 - */ -const BREAK_POINT_SM_MENUBAR_WIDTH = 16; -const BREAK_POINT_MD_MENUBAR_WIDTH = 24; -const BREAK_POINT_LG_MENUBAR_WIDTH = 32; /** * 背景颜色的不透明度的枚举类型 * @@ -101,7 +95,7 @@ export let MixMode; /** * 一种颜色渐渐转变为另一种颜色 */ - MixMode.TOWARDS = 3; + MixMode[MixMode['TOWARDS'] = 3] = 'TOWARDS'; })(MixMode || (MixMode = {})); /** * 背景底色 @@ -384,9 +378,10 @@ export class AtomicServiceNavigation extends ViewPU { Canvas.onReady(() => { if (gradientBackground.secondaryColor === undefined) { //单色渐变 - this.drawSingleGradient(this.context, gradientBackground.primaryColor, gradientBackground.backgroundTheme === undefined ? - backGroundColor[2] : backGroundColor[gradientBackground.backgroundTheme - 1]); - } else { + this.drawSingleGradient(this.context, gradientBackground.primaryColor, gradientBackground.backgroundTheme === undefined ? backGroundColor[2] : + backGroundColor[gradientBackground.backgroundTheme - 1]); + } + else { if (gradientBackground.mixMode === MixMode.AVERAGE) { //双色渐变五五分 this.drawGradientCanvasHalf(this.context, gradientBackground.primaryColor, gradientBackground.secondaryColor); @@ -545,25 +540,6 @@ export class AtomicServiceNavigation extends ViewPU { } } } - /** - * 返回抽屉模式下需要避让menubar的宽度 - */ - getMenuBarAvoidAreaWidth() { - switch (this.currentBreakPoint) { - case BREAK_POINT_SM: { - return BREAK_POINT_SM_MENUBAR_WIDTH; - } - case BREAK_POINT_MD: { - return BREAK_POINT_MD_MENUBAR_WIDTH; - } - case BREAK_POINT_LG: { - return BREAK_POINT_LG_MENUBAR_WIDTH; - } - default: { - return BREAK_POINT_SM_MENUBAR_WIDTH; - } - } - } drawerTitleBuilder(parent = null) { this.observeComponentCreation2((elmtId, isInitialRender) => { If.create(); @@ -579,7 +555,7 @@ export class AtomicServiceNavigation extends ViewPU { // 在Stack模式,或者非分栏模式下右侧需要有一定padding值,避免超长文本时不能避让menuBar end: ((this.currentBreakPoint === BREAK_POINT_SM && (this.mode === NavigationMode.Auto || !this.mode)) || this.mode === NavigationMode.Stack) ? - LengthMetrics.vp(ATOMIC_SERVICE_CAPSULE_WIDTH + this.getMenuBarAvoidAreaWidth()) : LengthMetrics.vp(0) + LengthMetrics.vp(ATOMIC_SERVICE_CAPSULE_WIDTH + 16) : LengthMetrics.vp(0) }); Row.width('50%'); }, Row); @@ -589,8 +565,7 @@ export class AtomicServiceNavigation extends ViewPU { Text.minFontSize(14); Text.maxFontSize(26); Text.height(36); - Text.fontColor({ 'id': -1, 'type': 10001, params: ['sys.color.font_primary'], - 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); + Text.fontColor({ 'id': -1, 'type': 10001, params: ['sys.color.font_primary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); Text.textOverflow({ overflow: TextOverflow.Ellipsis }); Text.fontWeight(FontWeight.Bold); Text.width(0); @@ -1150,10 +1125,8 @@ export class AtomicServiceNavigation extends ViewPU { */ drawGradientCanvasHalf(context, primaryColor, secondaryColor) { let height = this.navigationHeight * COLOR_RATIO_THIRTY_PERCENT; - let grad1 = context.createLinearGradient(COORDINATE_NEGATIVE_ONE * this.navigationWidth * COLOR_RATIO_FIFTY_PERCENT, - height, this.navigationWidth * COLOR_RATIO_FIFTY_PERCENT, 0); - let grad2 = context.createLinearGradient(this.navigationWidth * COLOR_RATIO_ONE_FIFTY_PERCENT, height, - this.navigationWidth * COLOR_RATIO_FIFTY_PERCENT, 0); + let grad1 = context.createLinearGradient(COORDINATE_NEGATIVE_ONE * this.navigationWidth * COLOR_RATIO_FIFTY_PERCENT, height, this.navigationWidth * COLOR_RATIO_FIFTY_PERCENT, 0); + let grad2 = context.createLinearGradient(this.navigationWidth * COLOR_RATIO_ONE_FIFTY_PERCENT, height, this.navigationWidth * COLOR_RATIO_FIFTY_PERCENT, 0); grad1.addColorStop(0, this.resourceColorToString(primaryColor)); grad1.addColorStop(COLOR_RATIO_FIFTY_PERCENT, this.resourceColorToString(primaryColor)); grad1.addColorStop(1, this.resourceColorToString(secondaryColor)); diff --git a/atomicservicenavigation/source/atomicservicenavigation.ets b/atomicservicenavigation/source/atomicservicenavigation.ets index df2c279..5786702 100644 --- a/atomicservicenavigation/source/atomicservicenavigation.ets +++ b/atomicservicenavigation/source/atomicservicenavigation.ets @@ -50,13 +50,6 @@ const SIDE_BAR_COMMON_WIDTH = 360; const CONTENT_MIN_WIDTH = 600; const ATOMIC_SERVICE_CAPSULE_WIDTH = 81.5; -/** - * 抽屉模式适应不同设备尺寸下menubar的宽度 - */ -const BREAK_POINT_SM_MENUBAR_WIDTH: number = 16; -const BREAK_POINT_MD_MENUBAR_WIDTH: number = 24; -const BREAK_POINT_LG_MENUBAR_WIDTH: number = 32; - /** * 背景颜色的不透明度的枚举类型 * @@ -346,26 +339,6 @@ export struct AtomicServiceNavigation { } } - /** - * 返回抽屉模式下需要避让menubar的宽度 - */ - private getMenuBarAvoidAreaWidth(): number { - switch (this.currentBreakPoint) { - case BREAK_POINT_SM: { - return BREAK_POINT_SM_MENUBAR_WIDTH; - } - case BREAK_POINT_MD: { - return BREAK_POINT_MD_MENUBAR_WIDTH; - } - case BREAK_POINT_LG: { - return BREAK_POINT_LG_MENUBAR_WIDTH; - } - default: { - return BREAK_POINT_SM_MENUBAR_WIDTH; - } - } - } - @Builder drawerTitleBuilder() { if (this.titleOptions?.titleBarType === TitleBarType.DRAWER && this.title) { @@ -391,7 +364,7 @@ export struct AtomicServiceNavigation { // 在Stack模式,或者非分栏模式下右侧需要有一定padding值,避免超长文本时不能避让menuBar end: ((this.currentBreakPoint === BREAK_POINT_SM && (this.mode === NavigationMode.Auto || !this.mode)) || this.mode === NavigationMode.Stack) ? - LengthMetrics.vp(ATOMIC_SERVICE_CAPSULE_WIDTH + this.getMenuBarAvoidAreaWidth()) : LengthMetrics.vp(0) + LengthMetrics.vp(ATOMIC_SERVICE_CAPSULE_WIDTH + 16) : LengthMetrics.vp(0) }) .width('50%') } -- Gitee From c010e6d858b849a7da38982715d2183a7c7e3b78 Mon Sep 17 00:00:00 2001 From: Knight4Lancelot <320062713@qq.com> Date: Sat, 22 Feb 2025 15:03:37 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E5=85=83=E6=9C=8D=E5=8A=A1Navigation?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E6=96=B0=E5=A2=9E=E5=AE=BD=E5=B1=8F=E8=87=AA?= =?UTF-8?q?=E5=AE=9A=E4=B9=89=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Knight4Lancelot --- atomicservicenavigation/interfaces/atomicservicenavigation.js | 2 +- atomicservicenavigation/source/atomicservicenavigation.ets | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/atomicservicenavigation/interfaces/atomicservicenavigation.js b/atomicservicenavigation/interfaces/atomicservicenavigation.js index 6dee3ea..b84f722 100644 --- a/atomicservicenavigation/interfaces/atomicservicenavigation.js +++ b/atomicservicenavigation/interfaces/atomicservicenavigation.js @@ -574,7 +574,7 @@ export class AtomicServiceNavigation extends ViewPU { (this.mode === NavigationMode.Auto || !this.mode)) || this.mode === NavigationMode.Stack) ? LengthMetrics.vp(ATOMIC_SERVICE_CAPSULE_WIDTH + 16) : LengthMetrics.vp(0) }); - Row.width('50%'); + Row.width('100%'); }, Row); this.observeComponentCreation2((elmtId, isInitialRender) => { Text.create(this.title); diff --git a/atomicservicenavigation/source/atomicservicenavigation.ets b/atomicservicenavigation/source/atomicservicenavigation.ets index 2c6231f..6808cce 100644 --- a/atomicservicenavigation/source/atomicservicenavigation.ets +++ b/atomicservicenavigation/source/atomicservicenavigation.ets @@ -366,7 +366,7 @@ export struct AtomicServiceNavigation { (this.mode === NavigationMode.Auto || !this.mode)) || this.mode === NavigationMode.Stack) ? LengthMetrics.vp(ATOMIC_SERVICE_CAPSULE_WIDTH + 16) : LengthMetrics.vp(0) }) - .width('50%') + .width('100%') } } -- Gitee From a32a1b10e8c6969f0ad565d312a29cc211a7eb18 Mon Sep 17 00:00:00 2001 From: Knight4Lancelot <320062713@qq.com> Date: Sat, 22 Feb 2025 15:05:45 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E5=85=83=E6=9C=8D=E5=8A=A1Navigation?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E6=96=B0=E5=A2=9E=E5=AE=BD=E5=B1=8F=E8=87=AA?= =?UTF-8?q?=E5=AE=9A=E4=B9=89=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Knight4Lancelot --- .../interfaces/atomicservicenavigation.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/atomicservicenavigation/interfaces/atomicservicenavigation.js b/atomicservicenavigation/interfaces/atomicservicenavigation.js index b84f722..bd78eea 100644 --- a/atomicservicenavigation/interfaces/atomicservicenavigation.js +++ b/atomicservicenavigation/interfaces/atomicservicenavigation.js @@ -95,7 +95,7 @@ export let MixMode; /** * 一种颜色渐渐转变为另一种颜色 */ - MixMode[MixMode['TOWARDS'] = 3] = 'TOWARDS'; + MixMode.TOWARDS = 3; })(MixMode || (MixMode = {})); /** * 背景底色 @@ -396,8 +396,7 @@ export class AtomicServiceNavigation extends ViewPU { //单色渐变 this.drawSingleGradient(this.context, gradientBackground.primaryColor, gradientBackground.backgroundTheme === undefined ? backGroundColor[2] : backGroundColor[gradientBackground.backgroundTheme - 1]); - } - else { + } else { if (gradientBackground.mixMode === MixMode.AVERAGE) { //双色渐变五五分 this.drawGradientCanvasHalf(this.context, gradientBackground.primaryColor, gradientBackground.secondaryColor); @@ -1161,8 +1160,10 @@ export class AtomicServiceNavigation extends ViewPU { */ drawGradientCanvasHalf(context, primaryColor, secondaryColor) { let height = this.navigationHeight * COLOR_RATIO_THIRTY_PERCENT; - let grad1 = context.createLinearGradient(COORDINATE_NEGATIVE_ONE * this.navigationWidth * COLOR_RATIO_FIFTY_PERCENT, height, this.navigationWidth * COLOR_RATIO_FIFTY_PERCENT, 0); - let grad2 = context.createLinearGradient(this.navigationWidth * COLOR_RATIO_ONE_FIFTY_PERCENT, height, this.navigationWidth * COLOR_RATIO_FIFTY_PERCENT, 0); + let grad1 = context.createLinearGradient(COORDINATE_NEGATIVE_ONE * this.navigationWidth * COLOR_RATIO_FIFTY_PERCENT, + height, this.navigationWidth * COLOR_RATIO_FIFTY_PERCENT, 0); + let grad2 = context.createLinearGradient(this.navigationWidth * COLOR_RATIO_ONE_FIFTY_PERCENT, height, + this.navigationWidth * COLOR_RATIO_FIFTY_PERCENT, 0); grad1.addColorStop(0, this.resourceColorToString(primaryColor)); grad1.addColorStop(COLOR_RATIO_FIFTY_PERCENT, this.resourceColorToString(primaryColor)); grad1.addColorStop(1, this.resourceColorToString(secondaryColor)); -- Gitee From be532c71ec43cad8a8630c2d76e2174ed858a23b Mon Sep 17 00:00:00 2001 From: Knight4Lancelot <320062713@qq.com> Date: Sat, 22 Feb 2025 15:06:54 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E5=85=83=E6=9C=8D=E5=8A=A1Navigation?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E6=96=B0=E5=A2=9E=E5=AE=BD=E5=B1=8F=E8=87=AA?= =?UTF-8?q?=E5=AE=9A=E4=B9=89=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Knight4Lancelot --- atomicservicenavigation/interfaces/atomicservicenavigation.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/atomicservicenavigation/interfaces/atomicservicenavigation.js b/atomicservicenavigation/interfaces/atomicservicenavigation.js index bd78eea..3c43b14 100644 --- a/atomicservicenavigation/interfaces/atomicservicenavigation.js +++ b/atomicservicenavigation/interfaces/atomicservicenavigation.js @@ -394,8 +394,8 @@ export class AtomicServiceNavigation extends ViewPU { Canvas.onReady(() => { if (gradientBackground.secondaryColor === undefined) { //单色渐变 - this.drawSingleGradient(this.context, gradientBackground.primaryColor, gradientBackground.backgroundTheme === undefined ? backGroundColor[2] : - backGroundColor[gradientBackground.backgroundTheme - 1]); + this.drawSingleGradient(this.context, gradientBackground.primaryColor, gradientBackground.backgroundTheme === undefined ? + backGroundColor[2] : backGroundColor[gradientBackground.backgroundTheme - 1]); } else { if (gradientBackground.mixMode === MixMode.AVERAGE) { //双色渐变五五分 -- Gitee