mirror of
https://github.com/ONLYOFFICE/sdkjs.git
synced 2026-04-07 14:09:12 +08:00
For bug 67237
This commit is contained in:
committed by
Sergey Luzyanin
parent
63430bd03b
commit
8accffe161
@ -20437,5 +20437,15 @@
|
||||
window['AscFormat'].CVarStyle = CVarStyle;
|
||||
window['AscFormat'].CFontProps = CFontProps;
|
||||
window['AscFormat'].CLineStyle = CLineStyle;
|
||||
|
||||
window["AscFormat"].RECT_ALIGN_B = RECT_ALIGN_B;
|
||||
window["AscFormat"].RECT_ALIGN_BL = RECT_ALIGN_BL;
|
||||
window["AscFormat"].RECT_ALIGN_BR = RECT_ALIGN_BR;
|
||||
window["AscFormat"].RECT_ALIGN_CTR = RECT_ALIGN_CTR;
|
||||
window["AscFormat"].RECT_ALIGN_L = RECT_ALIGN_L;
|
||||
window["AscFormat"].RECT_ALIGN_R = RECT_ALIGN_R;
|
||||
window["AscFormat"].RECT_ALIGN_T = RECT_ALIGN_T;
|
||||
window["AscFormat"].RECT_ALIGN_TL = RECT_ALIGN_TL;
|
||||
window["AscFormat"].RECT_ALIGN_TR = RECT_ALIGN_TR;
|
||||
})
|
||||
(window);
|
||||
|
||||
@ -1305,25 +1305,98 @@
|
||||
}
|
||||
};
|
||||
CGraphicObjectBase.prototype.getShdwTransform = function(outerShdw, mainShape) {
|
||||
var oTransform = new AscCommon.CMatrix();
|
||||
const oOldShdwTransform = this.transform;
|
||||
const oOldShdwBounds = this.bounds;
|
||||
this.bounds = new AscFormat.CGraphicBounds(0, 0, 0, 0);
|
||||
const oOldMainBounds = mainShape.bounds;
|
||||
mainShape.bounds = new AscFormat.CGraphicBounds(0, 0, 0, 0);
|
||||
|
||||
const oTxBody = mainShape.txBody;
|
||||
mainShape.txBody = null;
|
||||
mainShape.recalculateBounds();
|
||||
mainShape.txBody = oTxBody;
|
||||
|
||||
const oTransform = new AscCommon.CMatrix();
|
||||
this.transform = oTransform;
|
||||
global_MatrixTransformer.MultiplyAppend(oTransform, mainShape.transform);
|
||||
this.recalculateBounds();
|
||||
|
||||
const nMainW = mainShape.bounds.w;
|
||||
const nMainH = mainShape.bounds.h;
|
||||
const dMainX = mainShape.bounds.x;
|
||||
const dMainY = mainShape.bounds.y;
|
||||
|
||||
const nShdwW = this.bounds.w;
|
||||
const nShdwH = this.bounds.h;
|
||||
const dShdwX = this.bounds.x;
|
||||
const dShdwY = this.bounds.y;
|
||||
|
||||
let dX;
|
||||
let dY;
|
||||
switch (outerShdw.algn) {
|
||||
case AscFormat.RECT_ALIGN_BL: {
|
||||
dX = dMainX - dShdwX;
|
||||
dY = dMainY + nMainH - (dShdwY + nShdwH);
|
||||
break;
|
||||
}
|
||||
case AscFormat.RECT_ALIGN_BR: {
|
||||
dX = (dMainX + nMainW) - (dShdwX + nShdwW);
|
||||
dY = dMainY + nMainH - (dShdwY + nShdwH);
|
||||
break;
|
||||
}
|
||||
case AscFormat.RECT_ALIGN_CTR: {
|
||||
dX = (dMainX + nMainW / 2) - (dShdwX + nShdwW / 2);
|
||||
dY = (dMainY + nMainH / 2) - (dShdwY + nShdwH / 2);
|
||||
break;
|
||||
}
|
||||
case AscFormat.RECT_ALIGN_L: {
|
||||
dX = dMainX - dShdwX;
|
||||
dY = (dMainY + nMainH / 2) - (dShdwY + nShdwH / 2);
|
||||
break;
|
||||
}
|
||||
case AscFormat.RECT_ALIGN_R: {
|
||||
dX = (dMainX + nMainW) - (dShdwX + nShdwW);
|
||||
dY = (dMainY + nMainH / 2) - (dShdwY + nShdwH / 2);
|
||||
break;
|
||||
}
|
||||
case AscFormat.RECT_ALIGN_T: {
|
||||
dX = (dMainX + nMainW / 2) - (dShdwX + nShdwW / 2);
|
||||
dY = dMainY - dShdwY;
|
||||
break;
|
||||
}
|
||||
case AscFormat.RECT_ALIGN_TL: {
|
||||
dX = dMainX - dShdwX;
|
||||
dY = dMainY - dShdwY;
|
||||
break;
|
||||
}
|
||||
case AscFormat.RECT_ALIGN_TR: {
|
||||
dX = (dMainX + nMainW) - (dShdwX + nShdwW);
|
||||
dY = dMainY - dShdwY;
|
||||
break;
|
||||
}
|
||||
case AscFormat.RECT_ALIGN_B:
|
||||
default: {
|
||||
dX = (dMainX + nMainW / 2) - (dShdwX + nShdwW / 2);
|
||||
dY = dMainY + nMainH - (dShdwY + nShdwH);
|
||||
break;
|
||||
}
|
||||
}
|
||||
var dist = outerShdw.dist ? outerShdw.dist / 36000 : 0;
|
||||
var dir = outerShdw.dir ? outerShdw.dir : 0;
|
||||
if(this.extX < mainShape.extX && this.extY < mainShape.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.extX - mainShape.extX) / 2.0;
|
||||
oTransform.ty = dist * Math.sin(AscFormat.cToRad * dir) - (this.extY - mainShape.extY) / 2.0;
|
||||
}
|
||||
dX += dist * Math.cos(AscFormat.cToRad * dir);
|
||||
dY += dist * Math.sin(AscFormat.cToRad * dir);
|
||||
oTransform.tx += dX;
|
||||
oTransform.ty += dY;
|
||||
if(this.flipH) {
|
||||
oTransform.tx -= this.extX;
|
||||
}
|
||||
if(this.flipV) {
|
||||
oTransform.ty += this.extY;
|
||||
}
|
||||
global_MatrixTransformer.MultiplyAppend(oTransform, mainShape.transform);
|
||||
return oTransform;
|
||||
this.transform = oOldShdwTransform;
|
||||
this.bounds = oOldShdwBounds;
|
||||
mainShape.bounds = oOldMainBounds;
|
||||
return oTransform;
|
||||
};
|
||||
CGraphicObjectBase.prototype.drawAdjustments = function (drawingDocument) {
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user