Skip to content

Commit

Permalink
Merge pull request 'feature/visio' (#509) from feature/visio into rel…
Browse files Browse the repository at this point in the history
  • Loading branch information
konovalovsergey committed Jan 17, 2025
2 parents f19d0a4 + 9f8d436 commit 129b3d8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 20 deletions.
37 changes: 18 additions & 19 deletions common/Drawings/Format/Path.js
Original file line number Diff line number Diff line change
Expand Up @@ -764,32 +764,31 @@ 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;
}
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;
Expand Down
2 changes: 1 addition & 1 deletion visio/model/ooxmlApi/convertFunctions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 :
Expand Down

0 comments on commit 129b3d8

Please sign in to comment.