From cede4c8ab01c69291be74dedb627d3aafcc11c67 Mon Sep 17 00:00:00 2001 From: Fedor Kobyakov Date: Fri, 17 Jan 2025 14:16:05 +0300 Subject: [PATCH 1/2] [ve] Add EllipticalArcTo to line convert; Fix bug 72563 --- common/Drawings/Format/Path.js | 37 +++++++++++++++++----------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/common/Drawings/Format/Path.js b/common/Drawings/Format/Path.js index 17fdd7acfc..45e7452bc8 100644 --- a/common/Drawings/Format/Path.js +++ b/common/Drawings/Format/Path.js @@ -764,7 +764,7 @@ AscFormat.InitClass(Path, AscFormat.CBaseFormatObject, AscDFH.historyitem_type_P // check if it not ellipse arc in fact but line (three points on one line) // if this case will not be caught there will be NaN in params and // drawing will be unpredictable - // inaccuracy may be different so commented code below + // inaccuracy may be different // (Ax * (By - Cy) + Bx * (Cy - Ay) + Cx * (Ay - By) ) / 2 - triangle square if (isNaN(lastY)) { lastY = 0; @@ -772,24 +772,23 @@ AscFormat.InitClass(Path, AscFormat.CBaseFormatObject, AscDFH.historyitem_type_P if (isNaN(lastX)) { lastX = 0; } - // let triangleSquare = (x * (b - lastY) + a * (lastY - y) + lastX * (y - b)) / 2; - // if ( Math.round(triangleSquare) === 0 || Math.round(triangleSquare) === -0) { - // AscCommon.consoleLog("tranform ellipticalArcTo to line. 2 catch:", - // cmd.x, cmd.y, cmd.a, cmd.b, 0, 1); - // this.ArrPathCommand[i] ={id: lineTo, X:x, Y:y}; - // } else { - - // change ellipticalArcTo params to draw arc easy - this.ArrPathCommand.push({id: ellipticalArcTo, - stX: lastX, - stY: lastY, - wR: newParams.wR, - hR: newParams.hR, - stAng: newParams.stAng*cToRad, - swAng: newParams.swAng*cToRad, - ellipseRotation: newParams.ellipseRotation*cToRad}); - - // } + let triangleSquare = (x * (b - lastY) + a * (lastY - y) + lastX * (y - b)) / 2; + let accuracy = 10e4; + if ( Math.round(triangleSquare * accuracy) === 0 || Math.round(triangleSquare * accuracy) === -0) { + AscCommon.consoleLog("tranform ellipticalArcTo to line. 2 catch. Triangle square:", + triangleSquare); + this.ArrPathCommand[i] ={id: lineTo, X:x, Y:y}; + } else { + // change ellipticalArcTo params to draw arc easy + this.ArrPathCommand.push({id: ellipticalArcTo, + stX: lastX, + stY: lastY, + wR: newParams.wR, + hR: newParams.hR, + stAng: newParams.stAng*cToRad, + swAng: newParams.swAng*cToRad, + ellipseRotation: newParams.ellipseRotation*cToRad}); + } lastX = x; lastY = y; From 9f8d43667e7cd75b5e8b84795c0ec5034d7b1439 Mon Sep 17 00:00:00 2001 From: Fedor Kobyakov Date: Fri, 17 Jan 2025 15:45:29 +0300 Subject: [PATCH 2/2] [ve] Disable invert fill patterns --- visio/model/ooxmlApi/convertFunctions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/visio/model/ooxmlApi/convertFunctions.js b/visio/model/ooxmlApi/convertFunctions.js index ddbc0f5f71..d92c114260 100644 --- a/visio/model/ooxmlApi/convertFunctions.js +++ b/visio/model/ooxmlApi/convertFunctions.js @@ -1656,7 +1656,7 @@ function mapVisioFillPatternToOOXML(fillPatternType) { // change down to up and up to down bcs of Global matrix inverted - let upSideDownPatterns = true; + let upSideDownPatterns = false; switch (fillPatternType) { case 2: return upSideDownPatterns ? AscCommon.global_hatch_offsets.dnDiag :