bill 2 vuotta sitten
vanhempi
commit
9f2a527937

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 1 - 1
server/test/a0k4xu045_202305311600080410/attach/sceneStore


+ 15 - 12
src/graphic/Renderer/Draw.js

@@ -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) {

+ 1 - 1
src/views/graphic/confirm.vue

@@ -25,7 +25,7 @@ import {uiType, drawRef} from '@/hook/useGraphic'
   width: 145px;
   display: flex;
   justify-content: space-between;
-  margin-left: -75px;
+  transform: translateX(-50%);
 }
 
 .confirm-action {

+ 5 - 2
src/views/scene/menus/actions.ts

@@ -99,13 +99,16 @@ const menuActions = {
     let hide = Message.success({ msg: "请单击选择固定点位置" })
     const onDestroy = trackPosMenuAction(
       () => {
-        hide()
-        hide = null
+        hide && hide()
         onComplete()
       },
       pos => {
         const len = fixPoints.value.push({ id: getId(), pos, text: "固定点" })
         activeFixPointStack.current.value.value = fixPoints.value[len - 1]
+        if (hide) {
+          hide()
+          hide = null
+        }
       },
       true
     )