Fix clip for shapes with rotated text
This commit is contained in:
Ilya Kirillov
2025-06-30 18:12:05 +03:00
parent 237b27e43e
commit 287cd572ec

View File

@ -3872,6 +3872,24 @@
};
CShape.prototype._isTextRotated = function(bodyPr) {
if (!bodyPr) {
return false;
}
let isRotated = (bodyPr.vert === AscFormat.nVertTTvert
|| bodyPr.vert === AscFormat.nVertTTvert270
|| bodyPr.vert === AscFormat.nVertTTeaVert
);
if (bodyPr.wrap !== AscFormat.nTWTNone
&& bodyPr.upright
&& !checkNormalRotate(this.getFullRotate())) {
isRotated = !isRotated;
}
return isRotated;
};
CShape.prototype.recalculateDocContent = function (oDocContent, oBodyPr) {
let nStartPage = this.Get_AbsolutePage ? this.Get_AbsolutePage() : 0;
let oRet = {w: 0, h: 0, contentH: 0};
@ -4022,7 +4040,15 @@
&& !this.isForm()
&& oDocContent.GetLogicDocument()
&& !oDocContent.GetLogicDocument().IsPresentationEditor()) {
oDocContent.Set_ClipInfo(0, oRect.l - l_ins, oRect.r - l_ins, oRect.t - t_ins, oRect.b - t_ins);
let x = oRect.l - l_ins;
let y = oRect.t - t_ins;
if (this._isTextRotated(oBodyPr)) {
oDocContent.Set_ClipInfo(0, y, y + h, x, x + w);
} else {
oDocContent.Set_ClipInfo(0, x, x + w, y, y + h);
}
}
return oRet;