Commit 7e4296b2 authored by Anna.Pavlova's avatar Anna.Pavlova Committed by Alexander.Trofimov

Переделала отрисовку линий в Accent (через drawHorLine и drawVertLine)

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@58575 954022d7-b5bf-4e40-9824-e11837661b57
parent 60c3d988
...@@ -77,7 +77,7 @@ function ParaMath() ...@@ -77,7 +77,7 @@ function ParaMath()
g_oTableId.Add( this, this.Id ); g_oTableId.Add( this, this.Id );
} }
Asc.extendClass(ParaMath, CParagraphContentWithContentBase) Asc.extendClass(ParaMath, CParagraphContentWithContentBase);
ParaMath.prototype.Get_Type = function() ParaMath.prototype.Get_Type = function()
{ {
......
...@@ -46,6 +46,7 @@ CAccentCircumflex.prototype.calcCoord = function(stretch) ...@@ -46,6 +46,7 @@ CAccentCircumflex.prototype.calcCoord = function(stretch)
// g_dKoef_px_to_mm = 25.4/96 // g_dKoef_px_to_mm = 25.4/96
var textScale = fontSize/1000, // 1000 pt var textScale = fontSize/1000, // 1000 pt
alpha = textScale*25.4/96 /64; alpha = textScale*25.4/96 /64;
...@@ -141,6 +142,8 @@ CAccentLine.prototype.calcCoord = function(stretch) ...@@ -141,6 +142,8 @@ CAccentLine.prototype.calcCoord = function(stretch)
var X = [], var X = [],
Y = []; Y = [];
//stretch *= 0.9;
X[0] = 0; Y[0] = 0; X[0] = 0; Y[0] = 0;
X[1] = stretch; Y[1] = 0; X[1] = stretch; Y[1] = 0;
X[2] = stretch; Y[2] = 0.011*fontSize; X[2] = stretch; Y[2] = 0.011*fontSize;
...@@ -160,10 +163,22 @@ CAccentLine.prototype.drawPath = function(pGraphics, XX, YY) ...@@ -160,10 +163,22 @@ CAccentLine.prototype.drawPath = function(pGraphics, XX, YY)
pGraphics._l(XX[3], YY[3]); pGraphics._l(XX[3], YY[3]);
pGraphics._l(XX[4], YY[4]); pGraphics._l(XX[4], YY[4]);
} }
CAccentLine.prototype.draw = function(x, y, pGraphics)
{
var fontSize = this.Parent.Get_CompiledCtrPrp().FontSize;
var penW = fontSize*0.067 * 25.4/96;
var x1 = x + 25.4/96,
x2 = x + this.stretch - 25.4/96;
pGraphics.p_color(0,0,0, 255);
pGraphics.drawHorLine(0, y, x1, x2, penW);
}
function CAccentDoubleLine() function CAccentDoubleLine()
{ {
this.diff = 0;
CGlyphOperator.call(this); CGlyphOperator.call(this);
} }
Asc.extendClass(CAccentDoubleLine, CGlyphOperator); Asc.extendClass(CAccentDoubleLine, CGlyphOperator);
...@@ -176,6 +191,16 @@ CAccentDoubleLine.prototype.calcSize = function(stretch) ...@@ -176,6 +191,16 @@ CAccentDoubleLine.prototype.calcSize = function(stretch)
width = stretch > width ? stretch : width; width = stretch > width ? stretch : width;
var Line = new CMathText(true);
Line.add(0x305);
Line.Resize(g_oTextMeasurer);
var DoubleLine = new CMathText(true);
DoubleLine.add(0x33F);
DoubleLine.Resize(g_oTextMeasurer);
this.diff = DoubleLine.size.ascent - Line.size.ascent;
return {width: width, height: height}; return {width: width, height: height};
} }
CAccentDoubleLine.prototype.calcCoord = function(stretch) CAccentDoubleLine.prototype.calcCoord = function(stretch)
...@@ -219,6 +244,26 @@ CAccentDoubleLine.prototype.drawPath = function(pGraphics, XX, YY) ...@@ -219,6 +244,26 @@ CAccentDoubleLine.prototype.drawPath = function(pGraphics, XX, YY)
pGraphics._l(XX[9], YY[9]); pGraphics._l(XX[9], YY[9]);
} }
CAccentDoubleLine.prototype.draw = function(x, y, pGraphics)
{
var fontSize = this.Parent.Get_CompiledCtrPrp().FontSize;
var diff = this.diff;
if(diff < 2*25.4/96)
diff = 2*25.4/96;
var penW = fontSize*0.067 * 25.4/96;
var x1 = x + 25.4/96,
x2 = x + this.stretch - 25.4/96,
y1 = y,
y2 = y + diff;
pGraphics.p_color(0,0,0, 255);
pGraphics.drawHorLine(0, y1, x1, x2, penW);
pGraphics.drawHorLine(0, y2, x1, x2, penW);
}
function CAccentTilde() function CAccentTilde()
...@@ -561,8 +606,6 @@ CAccent.prototype.draw = function(x, y, pGraphics) ...@@ -561,8 +606,6 @@ CAccent.prototype.draw = function(x, y, pGraphics)
} }
} }
this.operator.draw(x, y, pGraphics); this.operator.draw(x, y, pGraphics);
} }
CAccent.prototype.Get_ParaContentPosByXY = function(SearchPos, Depth, _CurLine, _CurRange, StepEnd) CAccent.prototype.Get_ParaContentPosByXY = function(SearchPos, Depth, _CurLine, _CurRange, StepEnd)
......
...@@ -397,6 +397,10 @@ CGlyphOperator.prototype.draw = function(pGraphics, XX, YY) ...@@ -397,6 +397,10 @@ CGlyphOperator.prototype.draw = function(pGraphics, XX, YY)
pGraphics.df(); pGraphics.df();
pGraphics.SetIntegerGrid(intGrid); pGraphics.SetIntegerGrid(intGrid);
} }
CGlyphOperator.prototype.drawOnlyLines = function(x, y, pGraphics)
{
this.draw(x, y, pGraphics);
}
CGlyphOperator.prototype.getCtrPrp = function() CGlyphOperator.prototype.getCtrPrp = function()
{ {
return this.Parent.Get_CompiledCtrPrp(); return this.Parent.Get_CompiledCtrPrp();
...@@ -2527,7 +2531,6 @@ COperator.prototype.mergeProperties = function(properties, defaultProps) // pr ...@@ -2527,7 +2531,6 @@ COperator.prototype.mergeProperties = function(properties, defaultProps) // pr
else if(code === 0x305 || type === ACCENT_LINE) else if(code === 0x305 || type === ACCENT_LINE)
{ {
typeOper = ACCENT_LINE; typeOper = ACCENT_LINE;
//codeChr = 0x332;
codeChr = 0x305; codeChr = 0x305;
operator = new CAccentLine(); operator = new CAccentLine();
...@@ -2541,7 +2544,6 @@ COperator.prototype.mergeProperties = function(properties, defaultProps) // pr ...@@ -2541,7 +2544,6 @@ COperator.prototype.mergeProperties = function(properties, defaultProps) // pr
else if(code === 0x33F || type === ACCENT_DOUBLE_LINE) else if(code === 0x33F || type === ACCENT_DOUBLE_LINE)
{ {
typeOper = ACCENT_DOUBLE_LINE; typeOper = ACCENT_DOUBLE_LINE;
//codeChr = 0x333;
codeChr = 0x33F; codeChr = 0x33F;
operator = new CAccentDoubleLine(); operator = new CAccentDoubleLine();
...@@ -2957,10 +2959,12 @@ COperator.prototype.draw = function(x, y, pGraphics) ...@@ -2957,10 +2959,12 @@ COperator.prototype.draw = function(x, y, pGraphics)
} }
else else
{ {
if(this.type === OPER_SEPARATOR) var bLine = this.typeOper == ACCENT_LINE || this.typeOper == ACCENT_DOUBLE_LINE;
if(bLine)
this.drawLines(x, y, pGraphics);
else if(this.type === OPER_SEPARATOR)
this.drawSeparator(x, y, pGraphics); this.drawSeparator(x, y, pGraphics);
/*else if(this.type == OPER_ACCENT)
this.drawAccent(x, y, pGraphics);*/
else else
this.drawOperator(x, y, pGraphics); this.drawOperator(x, y, pGraphics);
} }
...@@ -3008,6 +3012,14 @@ COperator.prototype.drawSeparator = function(absX, absY, pGraphics) ...@@ -3008,6 +3012,14 @@ COperator.prototype.drawSeparator = function(absX, absY, pGraphics)
} }
} }
} }
COperator.prototype.drawLines = function(absX, absY, pGraphics)
{
if(this.typeOper !== OPERATOR_EMPTY)
{
var PosOper = this.Positions[0];
this.operator.drawOnlyLines(PosOper.x + absX, PosOper.y + absY, pGraphics);
}
}
COperator.prototype.fixSize = function(ParaMath, oMeasure, stretch) COperator.prototype.fixSize = function(ParaMath, oMeasure, stretch)
{ {
this.ParaMath = ParaMath; this.ParaMath = ParaMath;
...@@ -3039,9 +3051,8 @@ COperator.prototype.fixSize = function(ParaMath, oMeasure, stretch) ...@@ -3039,9 +3051,8 @@ COperator.prototype.fixSize = function(ParaMath, oMeasure, stretch)
{ {
var bNotStretchDelim = (this.type == OPER_DELIMITER || this.type == OPER_SEPARATOR) && this.grow == false; var bNotStretchDelim = (this.type == OPER_DELIMITER || this.type == OPER_SEPARATOR) && this.grow == false;
//bNotStretchAccent = this.type == OPER_ACCENT && this.typeOper == ACCENT_TILDE;
var StretchLng = bNotStretchDelim /*|| bNotStretchAccent*/ ? 0 : stretch; var StretchLng = bNotStretchDelim ? 0 : stretch;
this.operator.fixSize(StretchLng); this.operator.fixSize(StretchLng);
dims = this.operator.getCoordinateGlyph(); dims = this.operator.getCoordinateGlyph();
...@@ -3064,7 +3075,6 @@ COperator.prototype.fixSize = function(ParaMath, oMeasure, stretch) ...@@ -3064,7 +3075,6 @@ COperator.prototype.fixSize = function(ParaMath, oMeasure, stretch)
height = letterOperator.size.ascent - letterX.size.ascent; height = letterOperator.size.ascent - letterX.size.ascent;
} }
else else
{ {
if(this.typeOper == OPERATOR_TEXT) if(this.typeOper == OPERATOR_TEXT)
......
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