|
@@ -228,6 +228,16 @@ export const help = {
|
|
|
(ctx.lineWidth || 1) *
|
|
|
(weight === VectorWeight.Bold ? 2 : 1);
|
|
|
|
|
|
+ const funStyle = [
|
|
|
+ VectorStyle.PointDrawLine,
|
|
|
+ VectorStyle.SingleDashedLine,
|
|
|
+ VectorStyle.SingleSolidLine,
|
|
|
+ ]
|
|
|
+ if (typeof line === "function" && !funStyle.includes(style)) {
|
|
|
+ style = VectorStyle.SingleSolidLine
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
switch (style) {
|
|
|
case VectorStyle.PointDrawLine:
|
|
|
case VectorStyle.SingleDashedLine:
|
|
@@ -243,8 +253,12 @@ export const help = {
|
|
|
]);
|
|
|
}
|
|
|
|
|
|
- ctx.moveTo(line[0].x, line[0].y);
|
|
|
- ctx.lineTo(line[1].x, line[1].y);
|
|
|
+ if (typeof line === 'function') {
|
|
|
+ line()
|
|
|
+ } else {
|
|
|
+ ctx.moveTo(line[0].x, line[0].y);
|
|
|
+ ctx.lineTo(line[1].x, line[1].y);
|
|
|
+ }
|
|
|
break;
|
|
|
// 单实线
|
|
|
case VectorStyle.DoubleDashedLine:
|
|
@@ -677,13 +691,13 @@ export default class Draw {
|
|
|
}
|
|
|
|
|
|
|
|
|
- midCovesArray = help.transformCoves([
|
|
|
- vector.curves,
|
|
|
- ]);
|
|
|
- ctx.strokeStyle = 'red'
|
|
|
- for (let coves of midCovesArray) {
|
|
|
- help.drawCoves(ctx, coves);
|
|
|
- }
|
|
|
+ // midCovesArray = help.transformCoves([
|
|
|
+ // vector.curves,
|
|
|
+ // ]);
|
|
|
+ // ctx.strokeStyle = 'red'
|
|
|
+ // for (let coves of midCovesArray) {
|
|
|
+ // help.drawCoves(ctx, coves);
|
|
|
+ // }
|
|
|
|
|
|
}
|
|
|
ctx.restore();
|
|
@@ -758,8 +772,13 @@ export default class Draw {
|
|
|
ctx.save();
|
|
|
help.setVectorStyle(ctx, vector);
|
|
|
select && help.setStyle(ctx, style);
|
|
|
- ctx.lineWidth *= Settings.lineWidth;
|
|
|
- help.drawCoves(ctx, coves);
|
|
|
+ // ctx.lineWidth *= Settings.lineWidth;
|
|
|
+
|
|
|
+ help.drawStyleLine(this.context, () => {
|
|
|
+ help.drawCoves(ctx, coves);
|
|
|
+ }, vector.style, vector.weight);
|
|
|
+
|
|
|
+ // help.drawCoves(ctx, coves);
|
|
|
ctx.restore();
|
|
|
|
|
|
if (import.meta.env.DEV) {
|
|
@@ -1211,14 +1230,11 @@ export default class Draw {
|
|
|
ctx.save();
|
|
|
help.setVectorStyle(ctx, vector);
|
|
|
|
|
|
- const lineWidth =
|
|
|
- Settings.lineWidth *
|
|
|
- (ctx.lineWidth || 1) *
|
|
|
- (vector.weight === VectorWeight.Bold ? 2 : 1);
|
|
|
- ctx.lineWidth = lineWidth
|
|
|
- help.transformCoves([vector.curves]).forEach((coves) => {
|
|
|
- help.drawCoves(ctx, coves);
|
|
|
- });
|
|
|
+ help.drawStyleLine(this.context, () => {
|
|
|
+ help.transformCoves([vector.curves]).forEach((coves) => {
|
|
|
+ help.drawCoves(ctx, coves);
|
|
|
+ });
|
|
|
+ }, vector.style, vector.weight);
|
|
|
ctx.restore();
|
|
|
|
|
|
// if (import.meta.env.DEV) {
|