From 7ac59f6006d329adde7a9708917f65105c2b0f36 Mon Sep 17 00:00:00 2001 From: joylink_cuiweidong <364937672@qq.com> Date: Wed, 13 Jan 2021 17:53:51 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B2=94=E5=BF=83=20=E7=BB=98=E5=9B=BE?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/jmapNew/shape/Section/ELines.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/jmapNew/shape/Section/ELines.js b/src/jmapNew/shape/Section/ELines.js index 74c7cf603..df4c7b928 100644 --- a/src/jmapNew/shape/Section/ELines.js +++ b/src/jmapNew/shape/Section/ELines.js @@ -57,16 +57,17 @@ export default class ELines extends Group { const triangleB = new JTriangle(startPointB, endPointB); let lineDirect = 1; if (triangleA.getRotation() > 0) { lineDirect = -1; } else { lineDirect = 1; } - const new1Point1 = {x:startPointA.x - lineDirect * offset * triangleA.getSinRate(), y:startPointA.y - offset * triangleA.getCosRate()}; - const new1Point2 = {x:startPointA.x + lineDirect * offset * triangleA.getSinRate(), y:startPointA.y + offset * triangleA.getCosRate()}; - const new2Point1 = {x:endPointA.x - lineDirect * offset * triangleA.getSinRate(), y:endPointA.y - offset * triangleA.getCosRate()}; - const new2Point2 = {x:endPointA.x + lineDirect * offset * triangleA.getSinRate(), y:endPointA.y + offset * triangleA.getCosRate()}; + // - offset * triangleA.getCosRate() + const new1Point1 = {x:startPointA.x - lineDirect * offset / triangleA.getSinRate(), y:startPointA.y }; + const new1Point2 = {x:startPointA.x + lineDirect * offset / triangleA.getSinRate(), y:startPointA.y}; + const new2Point1 = {x:endPointA.x - lineDirect * offset / triangleA.getSinRate(), y:endPointA.y }; + const new2Point2 = {x:endPointA.x + lineDirect * offset / triangleA.getSinRate(), y:endPointA.y}; if (triangleB.getRotation() > 0) { lineDirect = -1; } else { lineDirect = 1; } - const new3Point1 = {x:startPointB.x + lineDirect * offset * triangleB.getSinRate(), y:startPointB.y + offset * triangleB.getCosRate()}; - const new3Point2 = {x:startPointB.x - lineDirect * offset * triangleB.getSinRate(), y:startPointB.y - offset * triangleB.getCosRate()}; - const new4Point1 = {x:endPointB.x + lineDirect * offset * triangleB.getSinRate(), y:endPointB.y + offset * triangleB.getCosRate()}; - const new4Point2 = {x:endPointB.x - lineDirect * offset * triangleB.getSinRate(), y:endPointB.y - offset * triangleB.getCosRate()}; + const new3Point1 = {x:startPointB.x + lineDirect * offset / triangleB.getSinRate(), y:startPointB.y}; + const new3Point2 = {x:startPointB.x - lineDirect * offset / triangleB.getSinRate(), y:startPointB.y}; + const new4Point1 = {x:endPointB.x + lineDirect * offset / triangleB.getSinRate(), y:endPointB.y}; + const new4Point2 = {x:endPointB.x - lineDirect * offset / triangleB.getSinRate(), y:endPointB.y}; // getCosRate // getSinRate const point1 = segmentsIntr(new1Point1, new2Point1, new3Point2, new4Point2);