From d118cf0948c8410c0eafbb214d9dbbe9742f90a9 Mon Sep 17 00:00:00 2001 From: Sergey Luzyanin Date: Wed, 25 Oct 2023 00:07:50 +0300 Subject: [PATCH] fix drawing shadow --- common/Drawings/Format/GraphicObjectBase.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/common/Drawings/Format/GraphicObjectBase.js b/common/Drawings/Format/GraphicObjectBase.js index 38d373f7eb..5bf997f1db 100644 --- a/common/Drawings/Format/GraphicObjectBase.js +++ b/common/Drawings/Format/GraphicObjectBase.js @@ -1108,12 +1108,8 @@ if (outerShdw.sy) { H *= outerShdw.sy / 100000; } - // W += penW; - // H += penW; - if (W < this.extX + penW) { + if(AscFormat.fApproxEqual(W, this.extX) && AscFormat.fApproxEqual(H, this.extY)) { W = this.extX + penW + 1; - } - if (H < this.extY + penW) { H = this.extY + penW + 1; } shape.spPr.xfrm.setExtX(W); @@ -1192,8 +1188,14 @@ var oTransform = new AscCommon.CMatrix(); var dist = outerShdw.dist ? outerShdw.dist / 36000 : 0; var dir = outerShdw.dir ? outerShdw.dir : 0; - oTransform.tx = dist * Math.cos(AscFormat.cToRad * dir) - (this.shdwSp.extX - this.extX) / 2.0; - oTransform.ty = dist * Math.sin(AscFormat.cToRad * dir) - (this.shdwSp.extY - this.extY) / 2.0; + if(this.shdwSp.extX < this.extX && this.shdwSp.extY < this.extY) { + oTransform.tx = dist * Math.cos(AscFormat.cToRad * dir); + oTransform.ty = dist * Math.sin(AscFormat.cToRad * dir); + } + else { + oTransform.tx = dist * Math.cos(AscFormat.cToRad * dir) - (this.shdwSp.extX - this.extX) / 2.0; + oTransform.ty = dist * Math.sin(AscFormat.cToRad * dir) - (this.shdwSp.extY - this.extY) / 2.0; + } global_MatrixTransformer.MultiplyAppend(oTransform, this.transform); this.shdwSp.bounds.x = this.bounds.x + this.shdwSp.bounds.l; this.shdwSp.bounds.y = this.bounds.y + this.shdwSp.bounds.t;