|
@@ -346,7 +346,7 @@ const help = {
|
|
|
}
|
|
|
ctx.stroke();
|
|
|
ctx.restore();
|
|
|
- }
|
|
|
+ },
|
|
|
};
|
|
|
|
|
|
export default class Draw {
|
|
@@ -876,13 +876,22 @@ export default class Draw {
|
|
|
ctx.stroke();
|
|
|
ctx.fill();
|
|
|
ctx.restore();
|
|
|
-
|
|
|
- label && element.points.forEach((point) => this.drawPoint(point));
|
|
|
}
|
|
|
|
|
|
drawCircle(element) {
|
|
|
console.log(element)
|
|
|
+ this.context.save()
|
|
|
+ const geo = [element.center, element.points[1], {...element.center, x: 999}]
|
|
|
+ let angle = mathUtil.Angle(...geo)
|
|
|
+ angle = help.isTriangleClockwise(...geo) ? -angle : angle
|
|
|
+
|
|
|
+
|
|
|
+ const center = coordinate.getScreenXY(element.center)
|
|
|
+ this.context.translate(center.x, center.y)
|
|
|
+ this.context.rotate((angle / 180) * Math.PI)
|
|
|
+ this.context.translate(-center.x, -center.y)
|
|
|
this.drawElliptic(element, element.radiusX, element.radiusY)
|
|
|
+ this.context.restore()
|
|
|
|
|
|
const [_, label] = help.getVectorStyle(element);
|
|
|
label && element.points.forEach((point) => this.drawPoint(point));
|
|
@@ -1006,18 +1015,18 @@ export default class Draw {
|
|
|
this.context.save();
|
|
|
help.setVectorStyle(this.context, vector);
|
|
|
this.context.fillStyle = vector.color;
|
|
|
- const oldFont = this.context.font;
|
|
|
this.context.font = `${
|
|
|
vector.fontSize * coordinate.ratio
|
|
|
}px Microsoft YaHei`;
|
|
|
const bound = help.getTextCenter(this.context, vector.value)
|
|
|
|
|
|
+ console.log(vector)
|
|
|
const screen = coordinate.getScreenXY(vector.center)
|
|
|
this.drawTextByInfo(
|
|
|
// vector.center,
|
|
|
coordinate.getXYFromScreenNotRatio({
|
|
|
// y: screen.y + (bound.height + Style.Point.radius),
|
|
|
- y: screen.y + (bound.height /2),
|
|
|
+ y: screen.y + (bound.height + Style.Point.radius ),
|
|
|
x: screen.x - (bound.width / 2)
|
|
|
}),
|
|
|
vector.value,
|
|
@@ -1025,14 +1034,8 @@ export default class Draw {
|
|
|
false
|
|
|
);
|
|
|
|
|
|
- const ctx = this.context;
|
|
|
- const pt = coordinate.getScreenXY(vector.center);
|
|
|
- const text = ctx.measureText(vector.value);
|
|
|
- pt.x -= text.width / 2;
|
|
|
- pt.y += (text.actualBoundingBoxAscent + text.actualBoundingBoxDescent) / 2;
|
|
|
-
|
|
|
this.context.restore();
|
|
|
- // this.drawPoint({...vector.center, color: vector.color}, true)
|
|
|
+ this.drawPoint({...vector.center, color: vector.color}, true)
|
|
|
}
|
|
|
|
|
|
drawSVG(vector) {
|