Commit 0550715d authored by Alexey.Musinov's avatar Alexey.Musinov Committed by Alexander.Trofimov

Fixed issue #31386

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@68194 954022d7-b5bf-4e40-9824-e11837661b57
parent c778ed7f
...@@ -250,38 +250,45 @@ ...@@ -250,38 +250,45 @@
this.angle = 0; // angle; this.angle = 0; // angle;
this.fontNeedUpdate = true; this.fontNeedUpdate = true;
var dx = 0, dy = 0, sx = 0, sw = 0; var dx = 0, dy = 0, sx = 0, sw = 0,
var tm = this._doMeasure(maxWidth); tm = this._doMeasure(maxWidth),
var mul = (90 - (Math.abs(angle)) ) / 90; mul = (90 - (Math.abs(angle)) ) / 90,
var posh = (angle === 90 || angle === -90) ? textW : Math.abs(Math.sin(angle * Math.PI / 180.0) * textW); posh = (angle === 90 || angle === -90) ? textW : Math.abs(Math.sin(angle * Math.PI / 180.0) * textW),
var posv = (angle === 90 || angle === -90) ? 0 : Math.abs(Math.cos(angle * Math.PI / 180.0) * textW); posv = (angle === 90 || angle === -90) ? 0 : Math.abs(Math.cos(angle * Math.PI / 180.0) * textW),
if ("bottom" === alignVertical) { isHorzLeft = ('left' === alignHorizontal),
isHorzCenter = ('center' === alignHorizontal),
isHorzRight = ('right' === alignHorizontal),
isVertBottom = ('bottom' === alignVertical),
isVertCenter = ('center' === alignVertical),
isVertTop = ('top' === alignVertical);
if (isVertBottom) {
if (angle < 0) { if (angle < 0) {
if ("left" === alignHorizontal) { if (isHorzLeft) {
dx = (1 - mul) * tm.height; dx = (1 - mul) * tm.height;
sw = x + posv + (mul * 0.5) * tm.height; sw = x + posv + (mul * 0.5) * tm.height;
} }
else if ("center" === alignHorizontal) { else if (isHorzCenter) {
dx = (w + tm.height - posv) * 0.5; dx = (w + tm.height - posv) * 0.5;
sx = x + (w - posv) * 0.5 - (mul * 0.5) * tm.height; sx = x + (w - posv) * 0.5 - (mul * 0.5) * tm.height;
sw = x + (w + posv) * 0.5 + (mul * 0.5) * tm.height; sw = x + (w + posv) * 0.5 + (mul * 0.5) * tm.height;
} }
else if ("right" === alignHorizontal) { else if (isHorzRight) {
dx = w - posv; dx = w - posv;
sx = x + dx - (mul * 0.5) * tm.height; sx = x + dx - (mul * 0.5) * tm.height;
} }
} else { } else {
if ("left" === alignHorizontal) { if (isHorzLeft) {
sw = x + posv + (mul * 0.5) * tm.height; sw = x + posv + (mul * 0.5) * tm.height;
} }
else if ("center" === alignHorizontal) { else if (isHorzCenter) {
dx = (w - tm.height - posv) * 0.5; dx = (w - tm.height - posv) * 0.5;
sx = x + (w - posv) * 0.5 - (mul * 0.5) * tm.height; sx = x + (w - posv) * 0.5 - (mul * 0.5) * tm.height;
sw = x + (w + posv) * 0.5 + (mul * 0.5) * tm.height; sw = x + (w + posv) * 0.5 + (mul * 0.5) * tm.height;
} }
else if ("right" === alignHorizontal) { else if (isHorzRight) {
dx = w - posv - (1 - mul) * tm.height; dx = w - posv - (1 - mul) * tm.height;
sx = x + dx; sx = x + dx;
} }
...@@ -302,32 +309,32 @@ ...@@ -302,32 +309,32 @@
} }
} }
} }
else if ("center" === alignVertical) { else if (isVertCenter) {
if (angle < 0) { if (angle < 0) {
if ("left" === alignHorizontal) { if (isHorzLeft) {
dx = (1 - mul * 0.5) * tm.height; dx = (1 - mul * 0.5) * tm.height;
sw = x + posv + (mul * 0.5) * tm.height; sw = x + posv + (mul * 0.5) * tm.height;
} }
else if ("center" === alignHorizontal) { else if (isHorzCenter) {
dx = (w + tm.height - posv) * 0.5; dx = (w + tm.height - posv) * 0.5;
sx = x + (w - posv) * 0.5 - (mul * 0.5) * tm.height; sx = x + (w - posv) * 0.5 - (mul * 0.5) * tm.height;
sw = x + (w + posv) * 0.5 + (mul * 0.5) * tm.height; sw = x + (w + posv) * 0.5 + (mul * 0.5) * tm.height;
} }
else if ("right" === alignHorizontal) { else if (isHorzRight) {
dx = w - (mul * 0.5) * tm.height - posv; dx = w - (mul * 0.5) * tm.height - posv;
sx = x + dx - (mul * 0.5) * tm.height; sx = x + dx - (mul * 0.5) * tm.height;
} }
} else { } else {
if ("left" === alignHorizontal) { if (isHorzLeft) {
sw = x + posv + (mul * 0.5) * tm.height; sw = x + posv + (mul * 0.5) * tm.height;
} }
else if ("center" == alignHorizontal) { else if (isHorzCenter) {
dx = (w - tm.height - posv) * 0.5; dx = (w - tm.height - posv) * 0.5;
sx = x + (w - posv) * 0.5 - (mul * 0.5) * tm.height; sx = x + (w - posv) * 0.5 - (mul * 0.5) * tm.height;
sw = x + (w + posv) * 0.5 + (mul * 0.5) * tm.height; sw = x + (w + posv) * 0.5 + (mul * 0.5) * tm.height;
} }
else if ("right" === alignHorizontal) { else if (isHorzRight) {
dx = w - posv - tm.height; sx = x + dx; dx = w - posv - tm.height; sx = x + dx;
sx = x + dx - (mul * 0.5) * tm.height; sx = x + dx - (mul * 0.5) * tm.height;
} }
...@@ -348,32 +355,32 @@ ...@@ -348,32 +355,32 @@
} }
} }
} }
else if ("top" === alignVertical) { else if (isVertTop) {
if (angle < 0) { if (angle < 0) {
if ("left" === alignHorizontal) { if (isHorzLeft) {
dx = (1 - mul * 0.5) * tm.height; dx = (1 - mul * 0.5) * tm.height;
sw = x + posv + (mul * 0.5) * tm.height; sw = x + posv + (mul * 0.5) * tm.height;
} }
else if ('c' === alignHorizontal) { else if (isHorzCenter) {
dx = (w + tm.height - posv) * 0.5; dx = (w + tm.height - posv) * 0.5;
sx = x + (w - posv) * 0.5 - (mul * 0.5) * tm.height; sx = x + (w - posv) * 0.5 - (mul * 0.5) * tm.height;
sw = x + (w + posv) * 0.5 + (mul * 0.5) * tm.height; sw = x + (w + posv) * 0.5 + (mul * 0.5) * tm.height;
} }
else if ("right" === alignHorizontal) { else if (isHorzRight) {
dx = w - (mul * 0.5) * tm.height - posv; dx = w - (mul * 0.5) * tm.height - posv;
sx = x + dx - (mul * 0.5) * tm.height; sx = x + dx - (mul * 0.5) * tm.height;
} }
} else { } else {
if ("left" === alignHorizontal) { if (isHorzLeft) {
sw = x + posv + (mul * 0.5) * tm.height; sw = x + posv + (mul * 0.5) * tm.height;
} }
else if ('c' === alignHorizontal) { else if (isHorzCenter) {
dx = (w - tm.height - posv) * 0.5; dx = (w - tm.height - posv) * 0.5;
sx = x + (w - posv) * 0.5 - (mul * 0.5) * tm.height; sx = x + (w - posv) * 0.5 - (mul * 0.5) * tm.height;
sw = x + (w + posv) * 0.5 + (mul * 0.5) * tm.height; sw = x + (w + posv) * 0.5 + (mul * 0.5) * tm.height;
} }
else if ("right" === alignHorizontal) { else if (isHorzRight) {
dx = w - posv - tm.height; sx = x + dx; dx = w - posv - tm.height; sx = x + dx;
sx = x + dx - (mul * 0.5) * tm.height; sx = x + dx - (mul * 0.5) * tm.height;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment