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

Реализовала поиск по позиции для EqqArray с учетом выравниваний (поправила...

Реализовала поиск по позиции для EqqArray с учетом выравниваний (поправила Recalculate_CurPos, Get_ParaContentPosByXY)

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@58058 954022d7-b5bf-4e40-9824-e11837661b57
parent 2afdd9bb
......@@ -25,8 +25,6 @@ function ParaMath()
this.Root = new CMathContent();
this.Root.bRoot = true;
this.NotDraw = false;
//this.Root.setComposition(this);
this.X = 0;
this.Y = 0;
......@@ -548,20 +546,15 @@ ParaMath.prototype =
this.Root.Resize(g_oTextMeasurer, null, this, RPI/*recalculate properties info*/, ArgSize, TextPr);
this.NotDraw = RPI.bManyRuns;
//this.Root.Resize(null, this, g_oTextMeasurer, RPI/*recalculate properties info*/, TextPr);
this.OldMathPara = this.MathPara;
var PosInfo = new CMathPosInfo();
var pos = new CMathPosition();
pos.x = 0;
pos.y = 0;
this.Root.setPosition(pos, PosInfo);
this.Root.setPosition(pos);
this.Width = this.Root.size.width;
this.Height = this.Root.size.height;
......@@ -1235,7 +1228,6 @@ ParaMath.prototype =
// this.absPos.x ~> this.X
// this.absPos.y ~> this.Y
//if(this.NotDraw == false)
this.Root.draw( PDSE.X, PDSE.Y - this.Ascent, PDSE.Graphics);
PDSE.X += this.Width;
......@@ -1338,18 +1330,6 @@ ParaMath.prototype =
Result = this.Root.Get_ParaContentPosByXY(SearchPos, Depth, _CurLine, _CurRange, StepEnd);
/*var str = "Get_ParaContentPosByXY :";
//console.log("Get_ParaContentPosByXY");
for(var i = 0; i < SearchPos.Pos.Data.length; i++)
{
str += SearchPos.Pos.Data[i] + " ";
}
if(this.Id == "80")
console.log(str);*/
if ( D >= - 0.001 && D <= Dx + 0.001 )
{
SearchPos.DiffX = 0.001;
......@@ -1407,14 +1387,6 @@ ParaMath.prototype =
this.Root.Get_ParaContentPos(bSelection, bStart, ContentPos);
/*console.log("Get_ParaContentPos");
var str = "";
for(var i = 0; i < ContentPos.Data.length; i++)
{
str += ContentPos.Data[i] + ", ";
}
console.log(str);*/
return ContentPos;
},
......@@ -1479,15 +1451,6 @@ ParaMath.prototype =
{
// TODO: ParaMath.Get_StartEndPos
this.Root.Get_WordStartPos(SearchPos, ContentPos, Depth, UseContentPos, false);
/*var str = "";
for(var i = 0; i < SearchPos.Pos.Data.length; i++)
{
str += SearchPos.Pos.Data[i] + " ";
}
console.log(str);*/
},
Get_WordEndPos : function(SearchPos, ContentPos, Depth, UseContentPos, StepEnd)
......
......@@ -14299,9 +14299,11 @@ function CParagraphSearchPosXY()
this.InTextPos = new CParagraphContentPos();
this.CurX = 0;
this.CurY = 0;
this.X = 0;
this.Y = 0;
this.DiffX = 1000000; // километра для ограничения должно хватить
this.DiffY = 1000000;
this.NumberingDiffX = 1000000; // километра для ограничения должно хватить
this.Line = 0;
......
......@@ -50,11 +50,11 @@ function ParaRun(Paragraph, bMathRun)
if(bMathRun)
{
this.Type = para_Math_Run;
this.MathPrp = new CMPrp();
this.Parent = null;
this.bEqqArray = false;
//this.WidthsPoints = [];
this.size = new CMathSize();
this.MathPrp = new CMPrp();
}
this.StartState = null;
......@@ -625,7 +625,7 @@ ParaRun.prototype =
return new CParaPos( ( LinesCount === 1 ? this.Lines[0].RangesLength - 1 + this.StartRange : this.Lines[0].RangesLength - 1 ), LinesCount - 1 + this.StartLine, 0, 0 );
},
Recalculate_CurPos : function(X, Y, CurrentRun, _CurRange, _CurLine, CurPage, UpdateCurPos, UpdateTarget, ReturnTarget)
Recalculate_CurPos : function(X, Y, CurrentRun, _CurRange, _CurLine, CurPage, UpdateCurPos, UpdateTarget, ReturnTarget, PointInfo)
{
var Para = this.Paragraph;
......@@ -664,9 +664,16 @@ ParaRun.prototype =
X += Item.WidthVisible;
break;
}
case para_Math_Ampersand:
{
PointInfo.NextAlignRange();
X += PointInfo.GetAlign();
}
}
}
if ( true === CurrentRun && Pos === this.State.ContentPos )
{
if ( true === UpdateCurPos )
......@@ -801,7 +808,6 @@ ParaRun.prototype =
}
}
return { X : X, Y : TargetY, Height : Height, Internal : { Line : CurLine, Page : CurPage, Range : CurRange } };
}
else
......@@ -809,6 +815,7 @@ ParaRun.prototype =
}
return { X : X, Y: Y, Internal : { Line : CurLine, Page : CurPage, Range : CurRange } };
},
......@@ -3659,7 +3666,7 @@ ParaRun.prototype =
}
},
Get_ParaContentPosByXY : function(SearchPos, Depth, _CurLine, _CurRange, StepEnd)
Get_ParaContentPosByXY : function(SearchPos, Depth, _CurLine, _CurRange, StepEnd, PointInfo)
{
var Result = false;
......@@ -3671,21 +3678,40 @@ ParaRun.prototype =
var EndPos = Range.EndPos;
var CurPos = StartPos;
//only for para_Math_Run
var bUpdateDiffY = true,
DiffY;
/*if(this.Type == para_Math_Run)
{
DiffY = SearchPos.Y - SearchPos.CurY;
if(Math.abs(DiffY) > SearchPos.DiffY)
bUpdateDiffY = false;
}*/
for (; CurPos < EndPos; CurPos++ )
{
var Item = this.Content[CurPos];
var TempDx = 0;
if ( para_Drawing != Item.Type || true === Item.Is_Inline() )
if(Item.Type == para_Math_Ampersand)
{
PointInfo.NextAlignRange();
TempDx = PointInfo.GetAlign();
}
else if ( para_Drawing != Item.Type || true === Item.Is_Inline() )
{
TempDx = Item.WidthVisible;
}
// Проверяем, попали ли мы в данный элемент
var Diff = SearchPos.X - SearchPos.CurX;
if ( Math.abs( Diff ) < SearchPos.DiffX + 0.001 )
if ( Math.abs( Diff ) < SearchPos.DiffX + 0.001 /*&& bUpdateDiffY*/)
{
//SearchPos.DiffY = Math.abs(DiffY);
SearchPos.DiffX = Math.abs( Diff );
SearchPos.Pos.Update( CurPos, Depth );
Result = true;
......@@ -3700,7 +3726,7 @@ ParaRun.prototype =
SearchPos.CurX += TempDx;
// Заглушка для знака параграфа и конца строки
if ( Math.abs( SearchPos.X - SearchPos.CurX ) < SearchPos.DiffX )
if ( Math.abs( SearchPos.X - SearchPos.CurX ) < SearchPos.DiffX /*&& bUpdateDiffY*/)
{
if ( para_End === Item.Type )
{
......@@ -3729,11 +3755,12 @@ ParaRun.prototype =
Result = true;
}
if (this.Type == para_Math_Run /*&& this.Is_Empty()*/) // не только для пустых Run, но и для проверки на конец Run (т.к. Diff не обновляется)
if (this.Type == para_Math_Run /*&& bUpdateDiffY*/ /*&& this.Is_Empty()*/) // не только для пустых Run, но и для проверки на конец Run (т.к. Diff не обновляется)
{
var Diff = SearchPos.X - SearchPos.CurX;
if ( Math.abs( Diff ) < SearchPos.DiffX + 0.001 )
{
//SearchPos.DiffY = Math.abs(DiffY);
SearchPos.DiffX = Math.abs( Diff );
SearchPos.Pos.Update( CurPos, Depth );
Result = true;
......@@ -4053,7 +4080,7 @@ ParaRun.prototype =
while ( CurPos < ContentLen - 1 )
{
CurPos++;
var Item = this.Content[CurPos]
var Item = this.Content[CurPos];
var TempType = Item.Type;
if ( (true !== StepEnd && para_End === TempType) || !( para_Space === TempType || ( para_Text === TempType && true === Item.Is_NBSP() ) ) )
......@@ -4385,7 +4412,7 @@ ParaRun.prototype =
{
for ( var CurPos = StartPos; CurPos < EndPos; CurPos++ )
{
if ( para_End !== this.Content[CurPos].Type )
if ( para_End !== this.Content[CurPos].Type && para_Math_Ampersand !== this.Content[CurPos].Type) // para_math_Ampersand имеет нулевую ширину, поэтому чтобы не случилось так что не было ни селекта, ни курсора, не учитываем para_Math_Ampersand
return false;
}
}
......@@ -7577,7 +7604,7 @@ ParaRun.prototype.Math_SetPosition = function(PosInfo)
if(this.Content[Pos].Type == para_Math_Ampersand)
{
PosInfo.UpdatePoint();
PosInfo.NextAlignRange();
PosInfo.ApplyAlign();
NewPos.x = PosInfo.x;
......@@ -7595,7 +7622,6 @@ ParaRun.prototype.Math_SetPosition = function(PosInfo)
PosInfo.UpdateX(CurrElem.size.width);
}
}
else
{
......
......@@ -60,24 +60,28 @@ CRPI.prototype.Copy = function()
}
function CMathPosInfo()
function CMathPointInfo()
{
this.x = 0;
this.y = 0;
this.bEven = true;
this.CurrPoint = 0;
this.GWidths = null;
this.GPoints = null;
this.ContentPoints = null;
this.GMaxDimWidths = null;
this.InfoPoints = {};
}
CMathPointInfo.prototype.SetInfoPoints = function(InfoPoints)
{
this.InfoPoints.GWidths = InfoPoints.GWidths;
this.InfoPoints.GPoints = InfoPoints.GPoints;
this.InfoPoints.ContentPoints = InfoPoints.ContentPoints.Widths;
this.InfoPoints.GMaxDimWidths = InfoPoints.GMaxDimWidths;
}
CMathPosInfo.prototype.UpdateX = function(value)
CMathPointInfo.prototype.UpdateX = function(value)
{
this.x += value;
}
CMathPosInfo.prototype.UpdatePoint = function()
CMathPointInfo.prototype.NextAlignRange = function()
{
if(this.bEven)
this.bEven = false;
......@@ -87,7 +91,11 @@ CMathPosInfo.prototype.UpdatePoint = function()
this.bEven = true;
}
}
CMathPosInfo.prototype.ApplyAlign = function()
CMathPointInfo.prototype.ApplyAlign = function()
{
this.x += this.GetAlign();
}
CMathPointInfo.prototype.GetAlign = function()
{
var align = 0;
......@@ -95,15 +103,15 @@ CMathPosInfo.prototype.ApplyAlign = function()
{
var alignEven, alignGeneral, alignOdd;
var Len = this.ContentPoints.length,
Point = this.ContentPoints[this.CurrPoint];
var Len = this.InfoPoints.ContentPoints.length,
Point = this.InfoPoints.ContentPoints[this.CurrPoint];
var GWidth = this.GWidths[this.CurrPoint],
GPoint = this.GPoints[this.CurrPoint];
var GWidth = this.InfoPoints.GWidths[this.CurrPoint],
GPoint = this.InfoPoints.GPoints[this.CurrPoint];
if(this.CurrPoint == Len - 1 && Point.odd == -1) // то есть последняя точка четная, выравнивание по центру
{
var GMaxDimWidth = this.GMaxDimWidths[this.CurrPoint];
var GMaxDimWidth = this.InfoPoints.GMaxDimWidths[this.CurrPoint];
alignGeneral = (GMaxDimWidth - Point.even)/2;
alignEven = 0;
......@@ -116,9 +124,9 @@ CMathPosInfo.prototype.ApplyAlign = function()
if(this.CurrPoint > 0)
{
var PrevGenPoint = this.GPoints[this.CurrPoint-1],
PrevGenWidth = this.GWidths[this.CurrPoint-1],
PrevPoint = this.ContentPoints[this.CurrPoint-1];
var PrevGenPoint = this.InfoPoints.GPoints[this.CurrPoint-1],
PrevGenWidth = this.InfoPoints.GWidths[this.CurrPoint-1],
PrevPoint = this.InfoPoints.ContentPoints[this.CurrPoint-1];
var alignPrevGen = (PrevGenWidth - PrevGenPoint.even - PrevGenPoint.odd)/2;
alignOdd = alignPrevGen + PrevGenPoint.odd - PrevPoint.odd;
......@@ -129,10 +137,25 @@ CMathPosInfo.prototype.ApplyAlign = function()
align = alignGeneral + alignEven + alignOdd;
}
return align;
}
this.x += align;
function CInfoPoints()
{
this.GWidths = null;
this.GPoints = null;
this.GMaxDimWidths = null;
this.ContentPoints = new AmperWidths();
}
CInfoPoints.prototype.SetDefault = function()
{
this.GWidths = null;
this.GPoints = null;
this.GMaxDimWidths = null;
this.ContentPoints.SetDefault();
}
function CMathPosition()
{
this.x = 0;
......@@ -142,8 +165,6 @@ function CMathPosition()
function AmperWidths()
{
/*this.Amp = 0;
this.CurrPoint = -1;*/
this.bEven = true; // является ли текущая точка нечетной
this.Widths = [];
}
......@@ -189,6 +210,12 @@ AmperWidths.prototype.AddNewAlignRange = function()
this.bEven = !this.bEven;
}
AmperWidths.prototype.SetDefault = function()
{
this.bEven = true;
this.Widths.length = 0;
}
function CGaps(oSign, oEqual, oZeroOper, oLett)
......@@ -841,12 +868,11 @@ function CMathContent()
{
this.Id = g_oIdCounter.Get_NewId();
this.content = []; // array of mathElem
this.CurPos = 0;
this.WidthToElement = [];
this.WidthPoints = []; /// for EqqArray Runs
//this.WidthPoints = []; /// for EqqArray Runs
this.pos = new CMathPosition(); // относительная позиция
// Properties
......@@ -854,6 +880,10 @@ function CMathContent()
this.ArgSize = new CMathArgSize();
this.Compiled_ArgSz = new CMathArgSize();
// for EqqArray
this.InfoPoints = new CInfoPoints();
///////////////
this.bDot = false;
this.plhHide = false;
this.bRoot = false;
......@@ -866,13 +896,11 @@ function CMathContent()
Use: false
};
/*this.bSelectionUse = false;
this.SelectStartPos = 0;
this.SelectEndPos = 0;*/
this.RecalcInfo =
{
TextPr: true
TextPr: true,
bEqqArray: false,
bChangeInfoPoints: false
};
this.NearPosArray = [];
......@@ -3932,7 +3960,7 @@ CMathContent.prototype =
this.content.push( placeholder );*/
},
//////////////////////////////////////
recalculateSize: function()
/*recalculateSize: function()
{
var width = 0 ;
var ascent = 0 ;
......@@ -3960,7 +3988,8 @@ CMathContent.prototype =
}
this.size = {width: width, height: ascent + descent, ascent: ascent};
},
},*/
Resize: function(oMeasure, Parent, ParaMath, RPI, ArgSize) // пересчитываем всю формулу
{
if(ArgSize !== null && ArgSize !== undefined)
......@@ -3976,20 +4005,21 @@ CMathContent.prototype =
this.Parent = Parent;
}
this.WidthToElement.length = 0;
var GapsInfo = new CMathGapsInfo(oMeasure, this, this.Compiled_ArgSz.value);
if (!this.bRoot && this.content.length == 0)
this.fillPlaceholders();
this.WidthToElement.length = 0;
this.bEqqArray = RPI.bEqqArray;
this.RecalcInfo.bEqqArray = RPI.bEqqArray;
var lng = this.content.length;
this.size.SetZero();
this.WidthPoints = new AmperWidths();
this.InfoPoints.SetDefault();
for(var pos = 0; pos < lng; pos++)
{
......@@ -4001,7 +4031,6 @@ CMathContent.prototype =
else if(this.content[pos].Type == para_Math_Run)
this.content[pos].Math_SetGaps(GapsInfo);
if(pos > 0)
this.recalculateSize_2(pos-1, oMeasure, Parent, ParaMath, RPI);
......@@ -4024,10 +4053,10 @@ CMathContent.prototype =
this.content[pos].Resize(oMeasure, this, ParaMath, NewRPI, this.Compiled_ArgSz);
if(RPI.bEqqArray)
this.WidthPoints.UpdatePoint(this.content[pos].size.width);
this.InfoPoints.ContentPoints.UpdatePoint(this.content[pos].size.width);
}
else if(this.content[pos].Type == para_Math_Run)
this.content[pos].Math_Recalculate(oMeasure, this, ParaMath.Paragraph, RPI, this.Compiled_ArgSz, this.WidthPoints);
this.content[pos].Math_Recalculate(oMeasure, this, ParaMath.Paragraph, RPI, this.Compiled_ArgSz, this.InfoPoints.ContentPoints);
this.WidthToElement[pos] = this.size.width;
......@@ -4042,6 +4071,10 @@ CMathContent.prototype =
this.size.height = SizeDescent < oDescent ? oDescent + this.size.ascent : SizeDescent + this.size.ascent;
},
getWidthsPoints: function()
{
return this.InfoPoints.ContentPoints.Widths;
},
IsEqqArray: function()
{
return this.Parent.IsEqqArray();
......@@ -4166,45 +4199,46 @@ CMathContent.prototype =
{
return false;
},
setPosition: function(PosInfo)
setPosition: function(pos)
{
this.pos.x = PosInfo.x;
this.pos.y = PosInfo.y;
this.pos.x = pos.x;
this.pos.y = pos.y;
var NewPosInfo = new CMathPosInfo();
NewPosInfo.x = this.pos.x;
NewPosInfo.y = this.pos.y + this.size.ascent;
var PosInfo = new CMathPointInfo();
PosInfo.x = this.pos.x;
PosInfo.y = this.pos.y + this.size.ascent;
if(this.bEqqArray)
if(this.RecalcInfo.bEqqArray)
{
NewPosInfo.GWidths = this.Parent.WidthsPoints;
NewPosInfo.GPoints = this.Parent.Points;
NewPosInfo.ContentPoints = this.WidthPoints.Widths;
NewPosInfo.GMaxDimWidths = this.Parent.MaxDimWidths;
this.InfoPoints.GWidths = this.Parent.WidthsPoints;
this.InfoPoints.GPoints = this.Parent.Points;
this.InfoPoints.GMaxDimWidths = this.Parent.MaxDimWidths;
NewPosInfo.ApplyAlign();
}
PosInfo.SetInfoPoints(this.InfoPoints);
PosInfo.ApplyAlign();
var ConsoleY = PosInfo.y + this.size.ascent,
id = this.Id;
console.log("" + id + " : " + ConsoleY);
if(this.Id == "91")
{
console.log("setPosition " + PosInfo.x);
}
}
for(var i=0; i < this.content.length; i++)
{
if(this.content[i].Type == para_Math_Run)
{
this.content[i].Math_SetPosition(NewPosInfo);
this.content[i].Math_SetPosition(PosInfo);
}
else
{
this.content[i].setPosition(NewPosInfo);
NewPosInfo.UpdateX(this.content[i].size.width);
}
var NewPos = new CMathPosition();
NewPos.x = PosInfo.x;
NewPos.y = PosInfo.y;
this.content[i].setPosition(NewPos);
PosInfo.UpdateX(this.content[i].size.width);
}
}
},
///// properties /////
......@@ -4242,10 +4276,31 @@ CMathContent.prototype =
/// For Para Math
Recalculate_CurPos : function(_X, Y, CurrentRun, _CurRange, _CurLine, _CurPage, UpdateCurPos, UpdateTarget, ReturnTarget)
old_Recalculate_CurPos : function(_X, Y, CurrentRun, _CurRange, _CurLine, _CurPage, UpdateCurPos, UpdateTarget, ReturnTarget)
{
var result;
var PointInfo = new CMathPointInfo();
PointInfo.SetInfoPoints(this.InfoPoints);
if(this.RecalcInfo.bEqqArray)
{
_X = this.pos.x + this.ParaMath.X + PointInfo.GetAlign();
Y = this.pos.y + this.ParaMath.Y + this.size.ascent;
for(var i = 0; i < this.CurPos; i++)
{
if(this.content[this.CurPos].Type == para_Math_Run)
this.content[i].Recalculate_CurPos(_X, Y, false, _CurRange, _CurLine, _CurPage, UpdateCurPos, UpdateTarget, ReturnTarget);
else
_X += this.content[i].size.width;
}
result = this.content[this.CurPos].Recalculate_CurPos(_X, Y, CurrentRun, _CurRange, _CurLine, _CurPage, UpdateCurPos, UpdateTarget, ReturnTarget);
}
else
{
if(this.content[this.CurPos].Type == para_Math_Composition)
{
result = this.content[this.CurPos].Recalculate_CurPos(_X, Y, CurrentRun, _CurRange, _CurLine, _CurPage, UpdateCurPos, UpdateTarget, ReturnTarget);
......@@ -4258,9 +4313,38 @@ CMathContent.prototype =
result = this.content[this.CurPos].Recalculate_CurPos(_X, Y, CurrentRun, _CurRange, _CurLine, _CurPage, UpdateCurPos, UpdateTarget, ReturnTarget);
}
}
return result;
},
Recalculate_CurPos : function(_X, Y, CurrentRun, _CurRange, _CurLine, _CurPage, UpdateCurPos, UpdateTarget, ReturnTarget)
{
_X = this.pos.x + this.ParaMath.X;
Y = this.pos.y + this.ParaMath.Y + this.size.ascent;
if(this.RecalcInfo.bEqqArray)
{
var PointInfo = new CMathPointInfo();
PointInfo.SetInfoPoints(this.InfoPoints);
_X += PointInfo.GetAlign();
for(var i = 0; i < this.CurPos; i++)
{
if(this.content[this.CurPos].Type == para_Math_Run)
this.content[i].Recalculate_CurPos(_X, Y, false, _CurRange, _CurLine, _CurPage, UpdateCurPos, UpdateTarget, ReturnTarget, PointInfo);
else
_X += this.content[i].size.width;
}
}
else
_X += this.WidthToElement[this.CurPos];
return this.content[this.CurPos].Recalculate_CurPos(_X, Y, CurrentRun, _CurRange, _CurLine, _CurPage, UpdateCurPos, UpdateTarget, ReturnTarget, PointInfo);
},
Check_NearestPos: function(ParaNearPos, Depth)
{
var ContentNearPos = new CParagraphElementNearPos();
......@@ -4623,7 +4707,7 @@ CMathContent.prototype =
},
/// функции для работы с курсором
Get_ParaContentPosByXY: function(SearchPos, Depth, _CurLine, _CurRange, StepEnd)
_Get_ParaContentPosByXY: function(SearchPos, Depth, _CurLine, _CurRange, StepEnd)
{
var result = false;
if(this.content.length > 0) // случай , если у нас контент не заполнен, не предусмотрен
......@@ -4641,14 +4725,11 @@ CMathContent.prototype =
if(this.content[pos].Type == para_Math_Run)
{
//SearchPos.CurX += W;
if(this.content[pos].Get_ParaContentPosByXY(SearchPos, Depth+1, _CurLine, _CurRange, StepEnd))
{
SearchPos.Pos.Update(pos, Depth);
result = true;
}
}
else // para_Math_Composition
{
......@@ -4656,27 +4737,6 @@ CMathContent.prototype =
// это избавит от ошибок, связанных с тем что расстояния до мат объекта и до пустого рана совпадают
// если же ран не пустой, то также должны встать в ран (в конец), а не в мат объект
/*if(SearchPos.X < SearchPos.CurX + this.content[pos].GapLeft)
{
SearchPos.CurX -= this.content[pos-1].size.width;
if(this.content[pos-1].Get_ParaContentPosByXY(SearchPos, Depth+1, _CurLine, _CurRange, StepEnd))
{
SearchPos.Pos.Update(pos-1, Depth);
result = true;
}
} // аналогично для GapRight
else if(SearchPos.CurX + this.content[pos].size.width - this.content[pos].GapRight < SearchPos.X)
{
SearchPos.CurX += this.content[pos].size.width + this.content[pos+1].size.width;
if(this.content[pos+1].Get_ParaContentPosByXY(SearchPos, Depth+1, _CurLine, _CurRange, StepEnd))
{
SearchPos.Pos.Update(pos+1, Depth);
result = true;
}
}
else
{*/
if( this.content[pos].Get_ParaContentPosByXY(SearchPos, Depth+1, _CurLine, _CurRange, StepEnd) )
{
......@@ -4704,50 +4764,62 @@ CMathContent.prototype =
result = true;
}
/*}*/
}
SearchPos.CurX = SearchCurX + this.size.width;
}
/*if(pos > 0)
return result;
},
Get_ParaContentPosByXY: function(SearchPos, Depth, _CurLine, _CurRange, StepEnd)
{
SearchPos.CurX -= this.content[pos-1].size.width;
if( this.content[pos-1].Get_ParaContentPosByXY(SearchPos, Depth+1, _CurLine, _CurRange, StepEnd) )
var result = false;
if(this.content.length > 0) // случай , если у нас контент не заполнен, не предусмотрен
{
SearchPos.Pos.Update(pos-1, Depth);
result = true;
}
}
var pos = 0;
var lng = this.content.length;
var PointInfo = new CMathPointInfo();
PointInfo.SetInfoPoints(this.InfoPoints);
if( this.content[pos].Get_ParaContentPosByXY(SearchPos, Depth+1, _CurLine, _CurRange, StepEnd) )
if(this.RecalcInfo.bEqqArray)
SearchPos.CurX += PointInfo.GetAlign();
SearchPos.CurY = this.pos.y + this.ParaMath.Y + this.size.ascent;
while(pos < lng)
{
//result = this.content[pos].Get_ParaContentPosByXY(SearchPos, Depth+1, _CurLine, _CurRange, StepEnd, PointInfo);
if(this.content[pos].Type == para_Math_Composition)
{
if( this.content[pos].Get_ParaContentPosByXY(SearchPos, Depth+1, _CurLine, _CurRange, StepEnd))
{
SearchPos.Pos.Update(pos, Depth);
result = true;
}
//this.findToInternalContent(pos, SearchPos, Depth, _CurLine, _CurRange, StepEnd);
//SearchPos.CurX += this.content[pos].size.width;
if(pos < lng - 1)
}
else
{
//SearchPos.CurX += this.size.width - this.WidthToElement[pos + 1];
if( this.content[pos+1].Get_ParaContentPosByXY(SearchPos, Depth+1, _CurLine, _CurRange, StepEnd) )
if(this.content[pos].Get_ParaContentPosByXY(SearchPos, Depth+1, _CurLine, _CurRange, StepEnd, PointInfo))
{
SearchPos.Pos.Update(pos+1, Depth);
SearchPos.Pos.Update(pos, Depth);
result = true;
}
}
//SearchPos.CurX += this.size.width - this.WidthToElement[pos + 1] + this.content[pos + 1].size.width;
}*/
pos++;
}
}
/*if(this.bRoot)
{
var pos = SearchPos.Pos.Get(Depth+1);
console.log("SearchPos.Pos " + pos);
}*/
return result;
},
Get_ParaContentPos: function(bSelection, bStart, ContentPos)
......@@ -5355,12 +5427,6 @@ CMathContent.prototype =
if(start !== end)
this.content[end].Selection_Remove();
}
/*else
console.log("True");*/
/*this.Selection.Start = this.CurPos;
this.Selection.End = this.CurPos;*/
this.Selection.Use = false;
},
......
......@@ -750,6 +750,8 @@ CMathAmp.prototype =
ascent: this.AmpText.size.ascent
};
}
this.WidthVisible = this.size.width;
},
setPosition: function(pos)
{
......
......@@ -283,10 +283,13 @@ CMathMatrix.prototype.Get_ParaContentPosByXY = function(SearchPos, Depth, _CurLi
H += Heights[i] + this.gaps.row[i];
}
var SearchCurX = SearchPos.CurX;
var align = this.align(CurrX, CurrY);
var SearchCurX = SearchPos.CurX + this.GapLeft + W_CurX ;
if(this.kind === MATH_MATRIX)
{
SearchPos.CurX += this.align(CurrX, CurrY).x;
}
SearchPos.CurX += this.GapLeft + W_CurX + align.x;
var result = this.elements[CurrX][CurrY].Get_ParaContentPosByXY(SearchPos, Depth+2, _CurLine, _CurRange, StepEnd);
......@@ -770,7 +773,7 @@ CEqArray.prototype.getMetrics = function(RPI)
for(var i = 0; i < this.nRow; i++)
{
var WidthsRow = this.elements[i][0].WidthPoints.Widths,
var WidthsRow = this.elements[i][0].getWidthsPoints(),
len = WidthsRow.length;
if(Pos < len)
......
......@@ -3760,8 +3760,6 @@ CDelimiter.prototype.Get_ParaContentPosByXY = function(SearchPos, Depth, _CurLin
sepWidth = this.sepOper.size.width,
endWidth = this.endOper.size.width;
SearchPos.Pos.Update(0, Depth);
SearchPos.CurX += begWidth + this.GapLeft;
var result;
......@@ -3770,6 +3768,7 @@ CDelimiter.prototype.Get_ParaContentPosByXY = function(SearchPos, Depth, _CurLin
{
if(this.elements[0][j].Get_ParaContentPosByXY(SearchPos, Depth+2, _CurLine, _CurRange, StepEnd))
{
SearchPos.Pos.Update(0, Depth);
SearchPos.Pos.Update(j, Depth+1);
result = true;
}
......@@ -3987,13 +3986,16 @@ CCharacter.prototype.Get_ParaContentPosByXY = function(SearchPos, Depth, _CurLin
{
var align = (this.size.width - this.elements[0][0].size.width)/2;
SearchPos.Pos.Update(0, Depth);
SearchPos.Pos.Update(0, Depth+1);
SearchPos.CurX += this.GapLeft + align;
var result = this.elements[0][0].Get_ParaContentPosByXY(SearchPos, Depth+2, _CurLine, _CurRange, StepEnd);
if(result)
{
SearchPos.Pos.Update(0, Depth);
SearchPos.Pos.Update(0, Depth+1);
}
SearchPos.CurX += this.GapRight + align;
return result;
......
......@@ -1150,10 +1150,6 @@ CRadical.prototype.setPosition = function(pos, PosInfo)
}
else if(this.Pr.type == DEGREE_RADICAL)
{
/*var degr = this.elements[0][0].size,
base = this.elements[0][1].size,
sign = this.signRadical.size;*/
var wTick = this.signRadical.measure.widthTick;
var PosDegree = new CMathPosition();
......@@ -1216,54 +1212,15 @@ CRadical.prototype.Get_ParaContentPosByXY = function(SearchPos, Depth, _CurLine,
}
CRadical.prototype.draw = function(x, y, pGraphics)
{
////// test //////
/*var xx = x + this.pos.x,
yy = y + this.pos.y,
w = this.size.width,
h = this.size.height;
pGraphics.p_width(1000);
pGraphics.b_color1(0,0,250, 255);
pGraphics._s();
pGraphics._m(xx, yy);
pGraphics._l(xx + w, yy);
pGraphics._l(xx + w, yy + h);
pGraphics._l(xx, yy + h);
pGraphics._l(xx, yy);
pGraphics.df();*/
this.signRadical.draw(x, y, pGraphics);
CRadical.superclass.draw.call(this, x, y, pGraphics);
}
CRadical.prototype.getBase = function()
{
/*var base = null;
if(this.Pr.type == SQUARE_RADICAL)
base = this.elements[0][0];
else if(this.Pr.type == DEGREE_RADICAL)
base = this.elements[0][1];*/
return this.Base;
}
CRadical.prototype.getDegree = function()
{
/*var degree = null;
if(this.type == DEGREE_RADICAL)
degree = this.elements[0][0];
else if(this.type = SQUARE_RADICAL)
degree = this.elements[0][0];*/
// для стремной ситуации, когда руками в xml выставили в degHide true, а объект со степенью имеется, возвращаем основание
/*var iterator = null;
if(this.Pr.degHide == false)
iterator = this.elements[0][0];*/
return this.Iterator;
}
CRadical.prototype.getPropsForWrite = function()
......
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