Commit 72b45730 by 吴斌

update: 端口移动以1px的距离跳跃,而非连续。

fix:端口间连线对不齐的问题。
parent 67d0df75
...@@ -148,6 +148,10 @@ export class PortShiftingTool extends go.Tool { ...@@ -148,6 +148,10 @@ export class PortShiftingTool extends go.Tool {
const br = main.getDocumentPoint(go.Spot.BottomRight); const br = main.getDocumentPoint(go.Spot.BottomRight);
const x = Math.max(0, Math.min((last.x - tl.x) / (br.x - tl.x), 1)); const x = Math.max(0, Math.min((last.x - tl.x) / (br.x - tl.x), 1));
const y = Math.max(0, Math.min((last.y - tl.y) / (br.y - tl.y), 1)); const y = Math.max(0, Math.min((last.y - tl.y) / (br.y - tl.y), 1));
this.port.alignment = new go.Spot(x, y); const parent_x = br.x - tl.x
const parent_y = br.y - tl.y
const dx = Math.round(parent_x * x)
const dy = Math.round(parent_y * y)
this.port.alignment = new go.Spot(dx/parent_x, dy/parent_y);
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment