瀏覽代碼

perf: 优化缩放时辅助线的渲染

奔跑的面条 2 年之前
父節點
當前提交
6c0f488624
共有 1 個文件被更改,包括 3 次插入3 次删除
  1. 3 3
      src/views/chart/ContentEdit/components/EditRule/index.vue

+ 3 - 3
src/views/chart/ContentEdit/components/EditRule/index.vue

@@ -37,6 +37,7 @@ import { useDesignStore } from '@/store/modules/designStore/designStore'
 import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
 import { useChartLayoutStore } from '@/store/modules/chartLayoutStore/chartLayoutStore'
 import { ChartLayoutStoreEnum } from '@/store/modules/chartLayoutStore/chartLayoutStore.d'
+import throttle from 'lodash/throttle'
 
 const chartEditStore = useChartEditStore()
 const chartLayoutStore = useChartLayoutStore()
@@ -177,7 +178,6 @@ const reDraw = () => {
   }, 10)
 }
 
-
 // 滚动居中
 const canvasPosCenter = () => {
   const { width: containerWidth, height: containerHeight } = $container.value.getBoundingClientRect()
@@ -205,9 +205,9 @@ watch(
       setTimeout(() => {
         canvasPosCenter()
         reDraw()
-      }, 500)
+      }, 400)
     } else {
-      reDraw()
+      throttle(reDraw, 20)
     }
   }
 )