From 1b837cf59bb9ce8e95a6746d3efd4c27fdbdc732 Mon Sep 17 00:00:00 2001 From: Minamiyama Date: Thu, 25 Sep 2025 23:27:59 +0800 Subject: [PATCH] =?UTF-8?q?feat(component-background):=20=E9=87=8D?= =?UTF-8?q?=E6=9E=84=E5=9C=86=E8=A7=92=E9=85=8D=E7=BD=AE=E4=B8=BA=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E5=A4=9A=E7=A7=8D=E6=A8=A1=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将borderRadius从单一数值改为支持统一值、对角和逐角三种配置模式 添加多语言支持并移除冗余的borderRadius2属性 更新组件以使用新的圆角配置结构 --- .../BackgroundOverallCommon.vue | 62 +++++++++++-------- .../component-background/Types.ts | 3 +- .../src/custom-component/component-list.ts | 5 +- core/core-frontend/src/locales/en.ts | 7 +++ core/core-frontend/src/locales/tw.ts | 7 +++ core/core-frontend/src/locales/zh-CN.ts | 7 +++ 6 files changed, 63 insertions(+), 28 deletions(-) diff --git a/core/core-frontend/src/components/visualization/component-background/BackgroundOverallCommon.vue b/core/core-frontend/src/components/visualization/component-background/BackgroundOverallCommon.vue index 88fad5375e..2077f54003 100644 --- a/core/core-frontend/src/components/visualization/component-background/BackgroundOverallCommon.vue +++ b/core/core-frontend/src/components/visualization/component-background/BackgroundOverallCommon.vue @@ -117,8 +117,8 @@ :class="'form-item-' + themes" >
- 左上 + {{ + t('visualization.corner_top_left') + }}
- 左下 + {{ + t('visualization.corner_bottom_left') + }}
- 右上 + {{ + t('visualization.corner_top_right') + }}
- 右下 + {{ + t('visualization.corner_bottom_right') + }}
@@ -418,7 +426,7 @@ import { ShorthandMode } from '@/Types' const state = reactive({ commonBackground: { innerPadding: {}, - borderRadius2: {} + borderRadius: {} }, BackgroundShowMap: {}, checked: false, @@ -436,6 +444,11 @@ const paddingModes = Object.values(ShorthandMode).map(item => ({ value: item })) as { label: string; value: ShorthandMode }[] +const cornerModes = Object.values(ShorthandMode).map(item => ({ + label: t(`visualization.corner_shorthand_mode_${item}`), + value: item +})) as { label: string; value: ShorthandMode }[] + const goFile = () => { files.value.click() } @@ -476,18 +489,18 @@ const init = () => { } } const borderRadius = commonBackgroundPop.borderRadius - if (typeof borderRadius !== 'undefined') { - commonBackgroundPop.borderRadius2 = { + if (typeof borderRadius === 'number') { + commonBackgroundPop.borderRadius = { mode: ShorthandMode.Uniform, topLeft: borderRadius, topRight: borderRadius, bottomLeft: borderRadius, bottomRight: borderRadius } - commonBackgroundPop.borderRadius = undefined } state.commonBackground = commonBackgroundPop updateInnerPadding() + updateBorderRadius() if (state.commonBackground.outerImage) { state.fileList = [{ url: imgUrlTrans(state.commonBackground.outerImage) }] } else { @@ -529,14 +542,13 @@ const updateInnerPadding = () => { } const updateBorderRadius = () => { - if (state.commonBackground.borderRadius2.mode === ShorthandMode.Uniform) { - state.commonBackground.borderRadius2.topLeft = state.commonBackground.borderRadius2.topLeft - state.commonBackground.borderRadius2.topRight = state.commonBackground.borderRadius2.topLeft - state.commonBackground.borderRadius2.bottomLeft = state.commonBackground.borderRadius2.topLeft - state.commonBackground.borderRadius2.bottomRight = state.commonBackground.borderRadius2.topLeft - } else if (state.commonBackground.borderRadius2.mode === ShorthandMode.Axis) { - state.commonBackground.borderRadius2.bottomRight = state.commonBackground.borderRadius2.topLeft - state.commonBackground.borderRadius2.topRight = state.commonBackground.borderRadius2.bottomLeft + if (state.commonBackground.borderRadius.mode === ShorthandMode.Uniform) { + state.commonBackground.borderRadius.topRight = state.commonBackground.borderRadius.topLeft + state.commonBackground.borderRadius.bottomLeft = state.commonBackground.borderRadius.topLeft + state.commonBackground.borderRadius.bottomRight = state.commonBackground.borderRadius.topLeft + } else if (state.commonBackground.borderRadius.mode === ShorthandMode.Axis) { + state.commonBackground.borderRadius.bottomRight = state.commonBackground.borderRadius.topLeft + state.commonBackground.borderRadius.topRight = state.commonBackground.borderRadius.bottomLeft } } diff --git a/core/core-frontend/src/components/visualization/component-background/Types.ts b/core/core-frontend/src/components/visualization/component-background/Types.ts index 36dda623db..c8f93b3558 100644 --- a/core/core-frontend/src/components/visualization/component-background/Types.ts +++ b/core/core-frontend/src/components/visualization/component-background/Types.ts @@ -6,7 +6,7 @@ export type BackgroundType = 'outerImage' | 'innerImage' export interface CommonBackground { innerPadding?: EdgeValues - borderRadius?: number + borderRadius?: CornerValues backdropFilterEnable?: boolean backdropFilter?: number backgroundColorSelect?: boolean @@ -16,7 +16,6 @@ export interface CommonBackground { innerImageColor?: string innerImage?: string outerImage?: string - borderRadius2?: CornerValues } export interface State { diff --git a/core/core-frontend/src/custom-component/component-list.ts b/core/core-frontend/src/custom-component/component-list.ts index 5186462952..9882072eca 100644 --- a/core/core-frontend/src/custom-component/component-list.ts +++ b/core/core-frontend/src/custom-component/component-list.ts @@ -190,7 +190,10 @@ export const COMMON_COMPONENT_BACKGROUND_BASE: CommonBackground = { mode: ShorthandMode.Uniform, top: 12 }, - borderRadius: 0, + borderRadius: { + mode: ShorthandMode.Uniform, + topLeft: 0 + }, backdropFilter: 4 } diff --git a/core/core-frontend/src/locales/en.ts b/core/core-frontend/src/locales/en.ts index af30f521ac..a36c3330f7 100644 --- a/core/core-frontend/src/locales/en.ts +++ b/core/core-frontend/src/locales/en.ts @@ -3400,6 +3400,13 @@ export default { edge_bottom: 'Bottom', edge_left: 'Left', board_radio: 'Corners', + corner_shorthand_mode_uniform: 'Uniform', + corner_shorthand_mode_axis: 'Diagonal', + corner_shorthand_mode_per_edge: 'Per Corner', + corner_top_left: 'Top Left', + corner_top_right: 'Top Right', + corner_bottom_left: 'Bottom Left', + corner_bottom_right: 'Bottom Right', web_set_tips: 'Some websites may not allow embedding and will not display.', repeat_params: 'Duplicate parameter names exist.', enable_outer_param_set: 'Enable External Parameter Settings', diff --git a/core/core-frontend/src/locales/tw.ts b/core/core-frontend/src/locales/tw.ts index f10d3f5deb..aaf5de3049 100644 --- a/core/core-frontend/src/locales/tw.ts +++ b/core/core-frontend/src/locales/tw.ts @@ -3304,6 +3304,13 @@ export default { edge_bottom: '下', edge_left: '左', board_radio: '圓角', + corner_shorthand_mode_uniform: '統一值', + corner_shorthand_mode_axis: '對角', + corner_shorthand_mode_per_edge: '逐角', + corner_top_left: '左上', + corner_top_right: '右上', + corner_bottom_left: '左下', + corner_bottom_right: '右下', web_set_tips: '部分網站可能設置不允許嵌入而無法顯示', repeat_params: '存在名稱重複的參數', enable_outer_param_set: '啟用外部參數設置', diff --git a/core/core-frontend/src/locales/zh-CN.ts b/core/core-frontend/src/locales/zh-CN.ts index a37ee23617..3cddbdf39c 100644 --- a/core/core-frontend/src/locales/zh-CN.ts +++ b/core/core-frontend/src/locales/zh-CN.ts @@ -3313,6 +3313,13 @@ export default { edge_bottom: '下', edge_left: '左', board_radio: '圆角', + corner_shorthand_mode_uniform: '统一值', + corner_shorthand_mode_axis: '对角', + corner_shorthand_mode_per_edge: '逐角', + corner_top_left: '左上', + corner_top_right: '右上', + corner_bottom_left: '左下', + corner_bottom_right: '右下', web_set_tips: '部分网站可能设置不允许嵌入而无法显示', repeat_params: '存在名称重复的参数', enable_outer_param_set: '启用外部参数设置',