Преглед на файлове

修改连线显示问题

lex преди 2 години
родител
ревизия
73fdd0590a
променени са 1 файла, в които са добавени 3 реда и са изтрити 2 реда
  1. 3 2
      src/views/unit-test/model/keep-look-question/index.tsx

+ 3 - 2
src/views/unit-test/model/keep-look-question/index.tsx

@@ -300,8 +300,9 @@ export default defineComponent({
      */
     const drawLine = (ctx: any, startPoint: any, endPoint: any) => {
       ctx.beginPath()
-      ctx.moveTo(Math.ceil(startPoint.x) * state.dpr, Math.ceil(startPoint.y) * state.dpr)
-      ctx.lineTo(Math.ceil(endPoint.x) * state.dpr, Math.ceil(endPoint.y) * state.dpr)
+      // + 1 为了处理连线显示问题
+      ctx.moveTo(Math.ceil(startPoint.x + 1) * state.dpr, Math.ceil(startPoint.y) * state.dpr)
+      ctx.lineTo(Math.ceil(endPoint.x + 1) * state.dpr, Math.ceil(endPoint.y) * state.dpr)
       ctx.lineWidth = 2 * state.dpr
       ctx.strokeStyle = '#FF8057'