|
@@ -21,7 +21,7 @@ const help = {
|
|
|
[stateService.getDraggingItem(), "Dragging"],
|
|
|
[stateService.getFocusItem(), "Focus"],
|
|
|
];
|
|
|
- let currentAttr
|
|
|
+ let currentAttr;
|
|
|
|
|
|
return [
|
|
|
itemsEntry.reduce((prev, [item, attr]) => {
|
|
@@ -31,13 +31,13 @@ const help = {
|
|
|
geoId === item.vectorId
|
|
|
) {
|
|
|
if (Style[attr] && Style[attr][geoType]) {
|
|
|
- currentAttr = attr
|
|
|
+ currentAttr = attr;
|
|
|
return Style[attr][geoType];
|
|
|
}
|
|
|
}
|
|
|
return prev;
|
|
|
}, Style[geoType]),
|
|
|
- currentAttr
|
|
|
+ currentAttr,
|
|
|
];
|
|
|
},
|
|
|
setVectorStyle(ctx, vector, geoType = vector.geoType) {
|
|
@@ -305,6 +305,7 @@ export default class Draw {
|
|
|
const extremePoint = coordinate.getScreenXY(vector.extremePoint);
|
|
|
const ctx = this.context;
|
|
|
ctx.save();
|
|
|
+ ctx.strokeStyle = "red";
|
|
|
ctx.beginPath();
|
|
|
ctx.arc(
|
|
|
// pt.x,
|
|
@@ -324,9 +325,11 @@ export default class Draw {
|
|
|
ctx.beginPath();
|
|
|
help.setVectorStyle(ctx, null, "RoadEdge");
|
|
|
//曲线
|
|
|
- ctx.moveTo(start.x, start.y);
|
|
|
- ctx.quadraticCurveTo(pt.x, pt.y, end.x, end.y);
|
|
|
- ctx.stroke();
|
|
|
+ // ctx.moveTo(start.x, start.y);
|
|
|
+ // ctx.quadraticCurveTo(pt.x, pt.y, end.x, end.y);
|
|
|
+
|
|
|
+ const [coves] = help.transformCoves([vector.curves]);
|
|
|
+ help.drawCoves(ctx, coves);
|
|
|
ctx.restore();
|
|
|
}
|
|
|
|
|
@@ -409,9 +412,13 @@ export default class Draw {
|
|
|
ctx.moveTo(start.x, start.y);
|
|
|
ctx.lineTo(end.x, end.y);
|
|
|
|
|
|
- const dires = vector.category === UIEvents.MeasureLine
|
|
|
- ? [[start, end], [end, start]]
|
|
|
- : [[start, end]]
|
|
|
+ const dires =
|
|
|
+ vector.category === UIEvents.MeasureLine
|
|
|
+ ? [
|
|
|
+ [start, end],
|
|
|
+ [end, start],
|
|
|
+ ]
|
|
|
+ : [[start, end]];
|
|
|
for (let [start, end] of dires) {
|
|
|
const lines = mathUtil.getArrow(start, end);
|
|
|
ctx.moveTo(lines[0].x, lines[0].y);
|
|
@@ -471,14 +478,14 @@ export default class Draw {
|
|
|
const imgCenter = coordinate.getScreenXY(backImg.center);
|
|
|
const start = {
|
|
|
x: imgCenter.x - help.getReal(img.width) / 2,
|
|
|
- y: imgCenter.y - help.getReal(img.height) / 2 ,
|
|
|
+ y: imgCenter.y - help.getReal(img.height) / 2,
|
|
|
};
|
|
|
- const ro = img.width / help.getReal(img.width)
|
|
|
+ const ro = img.width / help.getReal(img.width);
|
|
|
imgBound = [
|
|
|
(pt.x - start.x - size) * ro,
|
|
|
(pt.y - start.y - size) * ro,
|
|
|
- (size * 2) * ro,
|
|
|
- (size * 2) * ro,
|
|
|
+ size * 2 * ro,
|
|
|
+ size * 2 * ro,
|
|
|
];
|
|
|
}
|
|
|
const size = help.getReal(style.target.radius);
|
|
@@ -559,7 +566,7 @@ export default class Draw {
|
|
|
this.context.font = `${vector.fontSize}px Microsoft YaHei`;
|
|
|
this.drawTextByInfo(vector.center, vector.value, 0, false);
|
|
|
|
|
|
- const ctx = this.context
|
|
|
+ const ctx = this.context;
|
|
|
const pt = coordinate.getScreenXY(vector.center);
|
|
|
const text = ctx.measureText(vector.value);
|
|
|
pt.x -= text.width / 2;
|