Commit 2e531952 authored by Anna.Pavlova's avatar Anna.Pavlova Committed by Alexander.Trofimov

Поправила отрисовку дробной черты для дробей Linear и Skewed для textArt

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@66622 954022d7-b5bf-4e40-9824-e11837661b57
parent 39176231
...@@ -118,9 +118,7 @@ CFraction.prototype.drawSkewedFraction = function(PDSE) ...@@ -118,9 +118,7 @@ CFraction.prototype.drawSkewedFraction = function(PDSE)
{ {
var mgCtrPrp = this.Get_TxtPrControlLetter(); var mgCtrPrp = this.Get_TxtPrControlLetter();
var penW = mgCtrPrp.FontSize*0.0211; var gap = this.dW/2 - mgCtrPrp.FontSize*0.0028;
var gap = this.dW/2 - penW/7.5;
var plh = 9.877777777777776 * mgCtrPrp.FontSize / 36; var plh = 9.877777777777776 * mgCtrPrp.FontSize / 36;
var minHeight = 2*this.dW, var minHeight = 2*this.dW,
...@@ -138,6 +136,9 @@ CFraction.prototype.drawSkewedFraction = function(PDSE) ...@@ -138,6 +136,9 @@ CFraction.prototype.drawSkewedFraction = function(PDSE)
var heightSlash = this.size.height*2/3; var heightSlash = this.size.height*2/3;
var x1, y1, x2, y2, b,
xx1, yy1, xx2, yy2;
if(heightSlash < maxHeight) if(heightSlash < maxHeight)
{ {
if(heightSlash < minHeight) if(heightSlash < minHeight)
...@@ -151,20 +152,19 @@ CFraction.prototype.drawSkewedFraction = function(PDSE) ...@@ -151,20 +152,19 @@ CFraction.prototype.drawSkewedFraction = function(PDSE)
tg = (heightSlash - maxHeight)*(tg1 - tg2)/(middleHeight - maxHeight) + tg2; tg = (heightSlash - maxHeight)*(tg1 - tg2)/(middleHeight - maxHeight) + tg2;
} }
var b = this.elements[0][0].size.height - tg*(this.elements[0][0].size.width + gap); b = this.elements[0][0].size.height - tg*(this.elements[0][0].size.width + gap);
var y1 = this.elements[0][0].size.height/3,
y2 = this.elements[0][0].size.height/3 + heightSlash;
var x1 = (y1 - b)/tg, y1 = this.elements[0][0].size.height/3;
x2 = (y2 - b)/tg; y2 = this.elements[0][0].size.height/3 + heightSlash;
var xx1 = X + x1, x1 = (y1 - b)/tg;
xx2 = X + x2; x2 = (y2 - b)/tg;
var yy1 = Y + y1, xx1 = X + x1;
yy2 = Y + y2; xx2 = X + x2;
yy1 = Y + y1;
yy2 = Y + y2;
} }
else else
{ {
...@@ -182,33 +182,23 @@ CFraction.prototype.drawSkewedFraction = function(PDSE) ...@@ -182,33 +182,23 @@ CFraction.prototype.drawSkewedFraction = function(PDSE)
shift = maxVal; shift = maxVal;
var y0 = this.elements[0][0].size.height - shift; var y0 = this.elements[0][0].size.height - shift;
var b = this.elements[0][0].size.height - tg*(this.elements[0][0].size.width + gap);
var y1 = y0, b = this.elements[0][0].size.height - tg*(this.elements[0][0].size.width + gap);
y2 = y0 + heightSlash;
var x1 = (y1 - b)/tg, y1 = y0;
x2 = (y2 - b)/tg; y2 = y0 + heightSlash;
var xx1 = X + x1, x1 = (y1 - b)/tg;
xx2 = X + x2; x2 = (y2 - b)/tg;
var yy1 = Y + y1, xx1 = X + x1;
yy2 = Y + y2; xx2 = X + x2;
yy1 = Y + y1;
yy2 = Y + y2;
} }
PDSE.Graphics.SetFont(mgCtrPrp); this.drawFractionalLine(PDSE, xx1, yy1, xx2, yy2);
PDSE.Graphics.p_width(penW*1000);
this.Make_ShdColor(PDSE, this.Get_CompiledCtrPrp());
PDSE.Graphics._s();
PDSE.Graphics._m(xx1, yy1);
PDSE.Graphics._l(xx2, yy2);
PDSE.Graphics.ds();
PDSE.Graphics._s();
CFraction.superclass.Draw_Elements.call(this, PDSE); CFraction.superclass.Draw_Elements.call(this, PDSE);
}; };
...@@ -226,22 +216,44 @@ CFraction.prototype.drawLinearFraction = function(PDSE) ...@@ -226,22 +216,44 @@ CFraction.prototype.drawLinearFraction = function(PDSE)
x2 = X + this.elements[0][0].size.width + shift, x2 = X + this.elements[0][0].size.width + shift,
y2 = Y + this.size.height; y2 = Y + this.size.height;
this.drawFractionalLine(PDSE, x1, y1, x2, y2);
CFraction.superclass.Draw_Elements.call(this, PDSE);
};
CFraction.prototype.drawFractionalLine = function(PDSE, x1, y1, x2, y2)
{
var mgCtrPrp = this.Get_TxtPrControlLetter(); var mgCtrPrp = this.Get_TxtPrControlLetter();
var penW = mgCtrPrp.FontSize*0.0211; var penW = mgCtrPrp.FontSize*0.0211;
PDSE.Graphics.SetFont(mgCtrPrp); PDSE.Graphics.SetFont(mgCtrPrp);
PDSE.Graphics.p_width(penW*1000); PDSE.Graphics.p_width(penW*1000);
this.Make_ShdColor(PDSE, this.Get_CompiledCtrPrp()); this.Make_ShdColor(PDSE, this.Get_CompiledCtrPrp());
PDSE.Graphics._s(); PDSE.Graphics._s();
PDSE.Graphics._m(x1, y1);
PDSE.Graphics._l(x2, y2);
PDSE.Graphics.ds();
PDSE.Graphics._s(); var sideY = y2 - y1,
sideX = x1 - x2;
CFraction.superclass.Draw_Elements.call(this, PDSE); var hypoth = Math.sqrt(sideY*sideY + sideX*sideX);
var sin = sideY/hypoth,
cos = sideX/hypoth;
var dx = sin*penW/2, dy = cos*penW/2;
var xx1 = x1 - dx, yy1 = y1 - dy,
xx2 = x1 + dx, yy2 = y1 + dy,
xx3 = x2 + dx, yy3 = y2 + dy,
xx4 = x2 - dx, yy4 = y2 - dy;
PDSE.Graphics._m(xx1, yy1);
PDSE.Graphics._l(xx2, yy2);
PDSE.Graphics._l(xx3, yy3);
PDSE.Graphics._l(xx4, yy4);
PDSE.Graphics._l(xx1, yy1);
PDSE.Graphics.df();
}; };
CFraction.prototype.getNumerator = function() CFraction.prototype.getNumerator = function()
{ {
...@@ -343,7 +355,6 @@ CFraction.prototype.recalculateSkewed = function(oMeasure) ...@@ -343,7 +355,6 @@ CFraction.prototype.recalculateSkewed = function(oMeasure)
{ {
var mgCtrPrp = this.Get_TxtPrControlLetter(); var mgCtrPrp = this.Get_TxtPrControlLetter();
//this.gapSlash = 5.011235894097222 * mgCtrPrp.FontSize/36;
this.dW = 5.011235894097222 * mgCtrPrp.FontSize/36; this.dW = 5.011235894097222 * mgCtrPrp.FontSize/36;
var width = this.elements[0][0].size.width + this.dW + this.elements[0][1].size.width; var width = this.elements[0][0].size.width + this.dW + this.elements[0][1].size.width;
var height = this.elements[0][0].size.height + this.elements[0][1].size.height; var height = this.elements[0][0].size.height + this.elements[0][1].size.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