style(仪表板): 优化下钻弹框的弹出位置,避免超出图表可视范围

This commit is contained in:
jianneng-fit2cloud 2024-05-29 11:32:05 +08:00
parent ee95ff144a
commit 32669aca3e
3 changed files with 15 additions and 6 deletions

View File

@ -432,19 +432,28 @@ export async function decompressionPre(params, callBack) {
callBack(deTemplateData)
}
export function trackBarStyleCheck(element, trackbarStyle, scale) {
export function trackBarStyleCheck(element, trackbarStyle, _scale, trackMenuNumber) {
const { width, height } = element.style
const widthReal = width
const heightReal = height
// 浮窗高度
function calculateTrackHeight(trackMenuNumber) {
if (trackMenuNumber === 2) {
return 75
} else {
const increment = Math.floor(trackMenuNumber - 2) * 35
return 75 + increment
}
}
if (trackbarStyle.left < 0) {
trackbarStyle.left = 0
} else if (widthReal - trackbarStyle.left < 60) {
trackbarStyle.left = trackbarStyle.left - 60
}
const trackMenuHeight = calculateTrackHeight(trackMenuNumber)
if (trackbarStyle.top < 0) {
trackbarStyle.top = 0
} else if (heightReal - trackbarStyle.top < 100) {
trackbarStyle.top = trackbarStyle.top - 100
} else if (trackbarStyle.top + trackMenuHeight + 60 > heightReal) {
trackbarStyle.top = trackbarStyle.top - trackMenuHeight
}
}

View File

@ -244,7 +244,7 @@ const action = param => {
left: param.x - 50,
top: param.y + 10
}
trackBarStyleCheck(props.element, barStyleTemp, props.scale)
trackBarStyleCheck(props.element, barStyleTemp, props.scale, trackMenu.value.length)
state.trackBarStyle.left = barStyleTemp.left + 'px'
state.trackBarStyle.top = barStyleTemp.top + 'px'
viewTrack.value.trackButtonClick()

View File

@ -261,7 +261,7 @@ const action = param => {
left: param.x - 50,
top: param.y + 10
}
trackBarStyleCheck(props.element, barStyleTemp, props.scale)
trackBarStyleCheck(props.element, barStyleTemp, props.scale, trackMenu.value.length)
state.trackBarStyle.left = barStyleTemp.left + 'px'
state.trackBarStyle.top = barStyleTemp.top + 'px'
viewTrack.value.trackButtonClick()