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