|
@@ -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: "补全代码模板"
|
|
}],
|
|
}],
|
|
})
|
|
})
|