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

feat:更改连线动画 模板代码

Grnetsky преди 3 седмици
родител
ревизия
dd07944a51
променени са 1 файла, в които са добавени 2 реда и са изтрити 3 реда
  1. 2 3
      src/views/components/PenAnimates.vue

+ 2 - 3
src/views/components/PenAnimates.vue

@@ -429,10 +429,10 @@ function codeHints() {
       label: '补全代码模板', // 显示的文本
       label: '补全代码模板', // 显示的文本
       kind: 9, // 图标类型
       kind: 9, // 图标类型
       insertText: `const scale = pen.calculative.canvas.store.data.scale;
       insertText: `const scale = pen.calculative.canvas.store.data.scale;
-ctx.save();
 
 
 const width = 10  // 此处定义图形宽度
 const width = 10  // 此处定义图形宽度
 const height = 10 // 此处定义图形高度
 const height = 10 // 此处定义图形高度
+
 ctx.translate(state.x + (width/2 * scale), state.y + (height/2 * scale));  // 平移到中心点
 ctx.translate(state.x + (width/2 * scale), state.y + (height/2 * scale));  // 平移到中心点
 ctx.rotate((state.rotate * Math.PI) / 180); // 配置旋转角度
 ctx.rotate((state.rotate * Math.PI) / 180); // 配置旋转角度
 ctx.scale(scale, scale); // 配置缩放
 ctx.scale(scale, scale); // 配置缩放
@@ -440,8 +440,7 @@ ctx.translate(-(width/2 * scale), -(height/2 * scale));  // 平移回左上角
 
 
 ctx.beginPath();
 ctx.beginPath();
 //在此处编写你的图形定义代码...
 //在此处编写你的图形定义代码...
-
-ctx.restore()`, // 插入的文本
+`, // 插入的文本
       detail: "补全代码模板"
       detail: "补全代码模板"
     }],
     }],
   })
   })