From 2885345f2b4f2c721161993df11af36d2f8ef717 Mon Sep 17 00:00:00 2001 From: wangwenrui Date: Fri, 19 Feb 2021 18:35:21 +0800 Subject: [PATCH] =?UTF-8?q?fix:resize=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nezha-fronted/src/components/common/js/tools.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/nezha-fronted/src/components/common/js/tools.js b/nezha-fronted/src/components/common/js/tools.js index 4cc4504c5..8e9aabad2 100644 --- a/nezha-fronted/src/components/common/js/tools.js +++ b/nezha-fronted/src/components/common/js/tools.js @@ -382,7 +382,8 @@ export const chartResizeTool = { function mouseupListener(e) { //将resize-box的宽高设为resize-shadow的宽高 box.style.width = `${shadow.offsetWidth}px`; - box.style.height = `${Math.round(shadow.offsetHeight/10)*10}px`; + box.style.height = `${Math.round((shadow.offsetHeight )/chartPaddingTop)*chartPaddingTop}px`; + console.log('box height:',box.style.height) data.height = Math.round((box.offsetHeight+chartPaddingTop)/stepHeight)*stepHeight; data.span = Math.round((box.offsetWidth+chartBlankWidth)/stepWidth); //请求后台,保存变更 @@ -420,10 +421,10 @@ export const chartResizeTool = { } if (height > stepHeight/2) { //放大shadow高 heightChange = true; - shadow.style.height = `${Math.round(shadow.offsetHeight/10)*10+stepHeight}px`; + shadow.style.height = `${Math.round(shadow.offsetHeight/chartPaddingTop)*chartPaddingTop+stepHeight}px`; } else if (height <= 0-(stepHeight/2)) { //缩小shadow高 heightChange = true; - shadow.style.height = `${Math.round(shadow.offsetHeight/10)*10-stepHeight}px`; + shadow.style.height = `${Math.round(shadow.offsetHeight/chartPaddingTop)*chartPaddingTop-stepHeight}px`; } if (heightChange) { shadowNewHeight = shadow.offsetHeight+chartBlankHeight;