|
@@ -170,13 +170,20 @@ export const Component = defineComponent({
|
|
canvas.height = Math.ceil(Math.max(1, height));
|
|
canvas.height = Math.ceil(Math.max(1, height));
|
|
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
ctx.lineWidth = data.value.lineWidth;
|
|
ctx.lineWidth = data.value.lineWidth;
|
|
-
|
|
|
|
|
|
+ ctx.save();
|
|
|
|
|
|
|
|
+ if (data.value.reverseFill) {
|
|
|
|
+ ctx.fillStyle = data.value.fillColor;
|
|
|
|
+ ctx.fillRect(0, 0, canvas.width, canvas.height);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (data.value.res)
|
|
ctx.strokeStyle = data.value.lineColor;
|
|
ctx.strokeStyle = data.value.lineColor;
|
|
|
|
|
|
const padding = 0.2;
|
|
const padding = 0.2;
|
|
|
|
|
|
ctx.lineJoin = "round";
|
|
ctx.lineJoin = "round";
|
|
|
|
+
|
|
ctx.beginPath();
|
|
ctx.beginPath();
|
|
|
|
|
|
|
|
|
|
@@ -203,21 +210,32 @@ export const Component = defineComponent({
|
|
let bColor = data.value.fillColor;
|
|
let bColor = data.value.fillColor;
|
|
if (!bColor) bColor = data.value.lineColor;
|
|
if (!bColor) bColor = data.value.lineColor;
|
|
ctx.fillStyle = bColor;
|
|
ctx.fillStyle = bColor;
|
|
|
|
+ if (data.value.reverseFill) {
|
|
|
|
+ ctx.fillStyle = "red";
|
|
|
|
+ // 设置剪切区域
|
|
|
|
+ ctx.clip();
|
|
|
|
+ // 将当前路径指定的区域颜色扣除
|
|
|
|
+ ctx.globalCompositeOperation = "destination-out";
|
|
|
|
+ }
|
|
ctx.fill();
|
|
ctx.fill();
|
|
}
|
|
}
|
|
|
|
|
|
- points.forEach((p, index)=>{
|
|
|
|
- const x = width * p[0];
|
|
|
|
- const y = height * p[1];
|
|
|
|
|
|
+ ctx.restore();
|
|
|
|
|
|
- if (store.isEditMode && store.currCompId == props.compId) {
|
|
|
|
- ctx.fillStyle = "red"
|
|
|
|
|
|
+ if (store.isEditMode && store.currCompId == props.compId) {
|
|
|
|
+ points.forEach((p, index)=>{
|
|
|
|
+ const x = width * p[0];
|
|
|
|
+ const y = height * p[1];
|
|
|
|
|
|
- ctx.beginPath();
|
|
|
|
- ctx.arc(x, y, 5, 0, Math.PI*2);
|
|
|
|
- ctx.fill();
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
|
|
+
|
|
|
|
+ ctx.fillStyle = "red"
|
|
|
|
+
|
|
|
|
+ ctx.beginPath();
|
|
|
|
+ ctx.arc(x, y, 5, 0, Math.PI*2);
|
|
|
|
+ ctx.fill();
|
|
|
|
+
|
|
|
|
+ })
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
return () => (
|
|
return () => (
|