Quellcode durchsuchen

修改比例尺item问题

haojianlong vor 4 Jahren
Ursprung
Commit
a72dddaee6
2 geänderte Dateien mit 5 neuen und 3 gelöschten Zeilen
  1. 1 1
      package.json
  2. 4 2
      src/items/EditLineItem.ts

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
     "name": "@saga-web/cad-engine",
-    "version": "2.0.581",
+    "version": "2.0.583",
     "description": "上格云 CAD图形引擎。",
     "main": "lib/index.js",
     "types": "lib/index.d.js",

+ 4 - 2
src/items/EditLineItem.ts

@@ -436,7 +436,7 @@ export class EditLineItem extends SGraphItem {
             // 计算点到线段垂线与线段的交点
             if (
                 SMathUtil.pointToLine(p, new SLine(this.line[0], this.line[1]))
-                    .MinDis < this.dis
+                    .MinDis < this.sceneDis
             ) {
                 return true;
             }
@@ -538,6 +538,8 @@ export class EditLineItem extends SGraphItem {
      * @param painter   绘制对象
      */
     onDraw(painter: SPainter): void {
+        // 缓存场景长度
+        this.sceneDis = painter.toPx(this.dis);
         // 如果线段存在
         if (this.line.length) {
             const lw = painter.toPx(this.lineWidth);
@@ -553,7 +555,7 @@ export class EditLineItem extends SGraphItem {
             if (this.text && this.textPos) {
                 painter.font.textAlign = STextAlign.Center;
                 painter.brush.color = SColor.Black;
-                painter.font.size = 10;
+                painter.font.size = 14 * lw;
                 painter.pen.color = SColor.White;
                 painter.pen.lineWidth = 8 * lw;
                 painter.drawText(this.text, this.textPos.x, this.textPos.y);