Merge pull request #13576 from dataease/pr@dev-v2@chart-title-style

style(图表): 图表在不显示标题时,联动、跳转等图标样式优化
This commit is contained in:
xuwei-fit2cloud 2024-11-26 18:15:15 +08:00 committed by GitHub
commit 0b537a4fc8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -891,20 +891,42 @@ const marginBottom = computed<string | 0>(() => {
const iconSize = computed<string>(() => { const iconSize = computed<string>(() => {
return 16 * scale.value + 'px' return 16 * scale.value + 'px'
}) })
/**
* 修改透明度
* 边框透明度为0时会是存色顾配置低透明度
* @param {boolean} isBorder 是否为边框
*/
const modifyAlpha = isBorder => {
const { backgroundColor, backgroundType, backgroundImageEnable, backgroundColorSelect } =
element.value.commonBackground
//
const transparent = 'rgba(0,0,0,0.01)'
// 0.01
if (backgroundType === 'outerImage' && backgroundImageEnable) return transparent
// hexrgba
if (backgroundColor.includes('#'))
return isBorder || !backgroundColorSelect ? transparent : backgroundColor
const match = backgroundColor.match(/rgba\((\d+), (\d+), (\d+), (\d+|0.\d+)\)/)
if (!match) return backgroundColor
const [r, g, b, a] = match.slice(1).map(Number)
// 0.01
return `rgba(${r}, ${g}, ${b}, ${!backgroundColorSelect || isBorder ? 0.01 : a})`
}
const titleIconStyle = computed(() => { const titleIconStyle = computed(() => {
const bgColor = modifyAlpha(false)
const borderColor = modifyAlpha(true)
// //
const style = { const style = {
position: 'absolute', position: 'absolute',
color: 'rgb(255, 252, 252)', border: `1px solid ${borderColor}`,
position: 'absolute', 'background-color': bgColor,
border: '1px solid rgb(173, 170, 170)',
'background-color': 'rgba(173, 170, 170)',
'border-radius': '2px', 'border-radius': '2px',
padding: '0 2px 0 2px', padding: '0 2px 0 2px',
top: '2px',
'z-index': 1, 'z-index': 1,
left: '6px' top: '2px',
left: '2px',
...(trackMenu.value.length ? {} : { display: 'none' })
} }
return { return {
color: canvasStyleData.value.component.seniorStyleSetting.linkageIconColor, color: canvasStyleData.value.component.seniorStyleSetting.linkageIconColor,