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

Переделала SetPosition для EqArray, теперь отдается ширина контента с учетом...

Переделала SetPosition для EqArray, теперь отдается ширина контента с учетом выравниваний для EqArray

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@59379 954022d7-b5bf-4e40-9824-e11837661b57
parent d0fc939f
...@@ -3775,7 +3775,7 @@ ParaRun.prototype.Get_ParaContentPosByXY = function(SearchPos, Depth, _CurLine, ...@@ -3775,7 +3775,7 @@ ParaRun.prototype.Get_ParaContentPosByXY = function(SearchPos, Depth, _CurLine,
var TempDx = 0; var TempDx = 0;
if(para_Math_Ampersand === ItemType && null !== SearchPos.EqArrayInfoPoints) if(para_Math_Ampersand === ItemType && this.bEqqArray && null !== SearchPos.EqArrayInfoPoints)
{ {
SearchPos.EqArrayInfoPoints.NextAlignRange(); SearchPos.EqArrayInfoPoints.NextAlignRange();
TempDx = SearchPos.EqArrayInfoPoints.GetAlign(); TempDx = SearchPos.EqArrayInfoPoints.GetAlign();
...@@ -7746,55 +7746,19 @@ function CRunCollaborativeRange(PosS, PosE, Color) ...@@ -7746,55 +7746,19 @@ function CRunCollaborativeRange(PosS, PosE, Color)
this.PosE = PosE; this.PosE = PosE;
this.Color = Color; this.Color = Color;
} }
ParaRun.prototype.Math_SetPosition = function(pos)
ParaRun.prototype.Math_SetPosition = function(PosInfo)
{ {
var NewPos; var w = 0;
if(this.bEqqArray)
{
for(var Pos = 0; Pos < this.Content.length; Pos++)
{
var CurrElem = this.Content[Pos];
NewPos = new CMathPosition();
if(this.Content[Pos].Type == para_Math_Ampersand)
{
PosInfo.NextAlignRange();
PosInfo.ApplyAlign();
NewPos.x = PosInfo.x;
NewPos.y = PosInfo.y - this.size.ascent;
CurrElem.setPosition(NewPos);
}
else
{
NewPos.x = PosInfo.x;
NewPos.y = PosInfo.y - this.size.ascent;
CurrElem.setPosition(NewPos);
}
PosInfo.UpdateX(CurrElem.size.width);
}
}
else
{
for(var i = 0; i < this.Content.length; i++) for(var i = 0; i < this.Content.length; i++)
{ {
NewPos = new CMathPosition(); var NewPos = new CMathPosition();
NewPos.x = PosInfo.x; NewPos.x = pos.x + w;
NewPos.y = PosInfo.y - this.size.ascent; NewPos.y = pos.y - this.size.ascent;
this.Content[i].setPosition(NewPos); this.Content[i].setPosition(NewPos);
PosInfo.x += this.Content[i].size.width; w += this.Content[i].size.width;
}
} }
} }
ParaRun.prototype.Math_Draw = function(x, y, pGraphics) ParaRun.prototype.Math_Draw = function(x, y, pGraphics)
{ {
...@@ -8091,7 +8055,24 @@ ParaRun.prototype.GetMathTextPr = function() ...@@ -8091,7 +8055,24 @@ ParaRun.prototype.GetMathTextPr = function()
return {TextPr: TextPr, MathPr: this.MathPrp.Copy()}; return {TextPr: TextPr, MathPr: this.MathPrp.Copy()};
} }
ParaRun.prototype.ApplyPoints = function(PointsInfo)
{
if(this.bEqqArray)
{
this.size.width = 0;
for(var Pos = 0; Pos < this.Content.length; Pos++)
{
if(this.Content[Pos].Type == para_Math_Ampersand)
{
PointsInfo.NextAlignRange();
this.Content[Pos].size.width = PointsInfo.GetAlign();
}
this.size.width += this.Content[Pos].size.width;
}
}
}
ParaRun.prototype.Get_TextForAutoCorrect = function(AutoCorrectEngine, RunPos) ParaRun.prototype.Get_TextForAutoCorrect = function(AutoCorrectEngine, RunPos)
{ {
var ActionElement = AutoCorrectEngine.Get_ActionElement(); var ActionElement = AutoCorrectEngine.Get_ActionElement();
......
...@@ -158,8 +158,6 @@ function CMathPosition() ...@@ -158,8 +158,6 @@ function CMathPosition()
this.x = 0; this.x = 0;
this.y = 0; this.y = 0;
} }
function AmperWidths() function AmperWidths()
{ {
this.bEven = true; // является ли текущая точка нечетной this.bEven = true; // является ли текущая точка нечетной
...@@ -971,42 +969,56 @@ CMathContent.prototype = ...@@ -971,42 +969,56 @@ CMathContent.prototype =
{ {
return false; return false;
}, },
ApplyPoints: function(WidthsPoints, Points, MaxDimWidths)
{
this.InfoPoints.GWidths = WidthsPoints;
this.InfoPoints.GPoints = Points;
this.InfoPoints.GMaxDimWidths = MaxDimWidths;
// точки выравнивания данного контента содержатся в ContentPoints
var PosInfo = new CMathPointInfo();
PosInfo.SetInfoPoints(this.InfoPoints);
this.size.width = 0;
for(var i = 0 ; i < this.Content.length; i++)
{
if(this.Content[i].Type === para_Math_Run)
{
this.Content[i].ApplyPoints(PosInfo);
}
this.size.width += this.Content[i].size.width;
}
},
setPosition: function(pos) setPosition: function(pos)
{ {
this.pos.x = pos.x; this.pos.x = pos.x;
this.pos.y = pos.y; this.pos.y = pos.y;
var PosInfo = new CMathPointInfo();
PosInfo.x = this.pos.x;
PosInfo.y = this.pos.y + this.size.ascent;
if(this.RecalcInfo.bEqqArray) if(this.RecalcInfo.bEqqArray)
{ {
this.InfoPoints.GWidths = this.Parent.WidthsPoints; var PosInfo = new CMathPointInfo();
this.InfoPoints.GPoints = this.Parent.Points;
this.InfoPoints.GMaxDimWidths = this.Parent.MaxDimWidths;
PosInfo.SetInfoPoints(this.InfoPoints); PosInfo.SetInfoPoints(this.InfoPoints);
PosInfo.ApplyAlign();
this.pos.x += PosInfo.GetAlign();
} }
for(var i=0; i < this.Content.length; i++) for(var i=0; i < this.Content.length; i++)
{
if(this.Content[i].Type == para_Math_Run)
{
this.Content[i].Math_SetPosition(PosInfo);
}
else
{ {
var NewPos = new CMathPosition(); var NewPos = new CMathPosition();
NewPos.x = PosInfo.x; NewPos.x = this.pos.x;
NewPos.y = PosInfo.y; NewPos.y = this.pos.y + this.size.ascent;
if(this.Content[i].Type == para_Math_Run)
this.Content[i].Math_SetPosition(NewPos);
else
this.Content[i].setPosition(NewPos); this.Content[i].setPosition(NewPos);
PosInfo.UpdateX(this.Content[i].size.width);
} this.pos.x += this.Content[i].size.width;
} }
}, },
SetParent: function(Parent, ParaMath) SetParent: function(Parent, ParaMath)
{ {
......
...@@ -869,7 +869,7 @@ CMathAmp.prototype = ...@@ -869,7 +869,7 @@ CMathAmp.prototype =
this.AmpText.draw(x + this.GapLeft, y, pGraphics); this.AmpText.draw(x + this.GapLeft, y, pGraphics);
else if(editor.ShowParaMarks) // показать метки выравнивания, если включена отметка о знаках параграфа else if(editor.ShowParaMarks) // показать метки выравнивания, если включена отметка о знаках параграфа
{ {
var X = x + this.pos.x, var X = x + this.pos.x + this.size.width,
Y = y + this.pos.y, Y = y + this.pos.y,
Y2 = y + this.pos.y - this.AmpText.size.height; Y2 = y + this.pos.y - this.AmpText.size.height;
pGraphics.p_color(0,0,0, 255); pGraphics.p_color(0,0,0, 255);
......
...@@ -685,7 +685,6 @@ CEqArray.prototype.init = function(props) ...@@ -685,7 +685,6 @@ CEqArray.prototype.init = function(props)
} }
CEqArray.prototype.addRow = function() CEqArray.prototype.addRow = function()
{ {
this.bDecreaseRow = true;
var NewContent = new CMathContent(); var NewContent = new CMathContent();
this.protected_AddToContent(this.CurPos + 1, [NewContent], true); this.protected_AddToContent(this.CurPos + 1, [NewContent], true);
...@@ -699,16 +698,6 @@ CEqArray.prototype.fillContent = function() ...@@ -699,16 +698,6 @@ CEqArray.prototype.fillContent = function()
for (var nIndex = 0; nIndex < nRowsCount; nIndex++) for (var nIndex = 0; nIndex < nRowsCount; nIndex++)
this.elements[nIndex][0] = this.Content[nIndex]; this.elements[nIndex][0] = this.Content[nIndex];
}; };
CEqArray.prototype.PreRecalc = function(Parent, ParaMath, ArgSize, RPI, GapsInfo)
{
if(this.bDecreaseRow)
{
this.fillContent();
this.bDecreaseRow = false;
}
CEqArray.superclass.PreRecalc.call(this, Parent, ParaMath, ArgSize, RPI, GapsInfo);
}
CEqArray.prototype.Resize = function(oMeasure, RPI) CEqArray.prototype.Resize = function(oMeasure, RPI)
{ {
// на случай, чтобы не затереть массив // на случай, чтобы не затереть массив
...@@ -804,6 +793,9 @@ CEqArray.prototype.getMetrics = function() ...@@ -804,6 +793,9 @@ CEqArray.prototype.getMetrics = function()
Pos++; Pos++;
} }
for(var i = 0; i < this.nRow; i++)
this.elements[i][0].ApplyPoints(this.WidthsPoints, this.Points, this.MaxDimWidths);
for(var i = 0; i < this.nRow; i++) for(var i = 0; i < this.nRow; i++)
{ {
......
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