Commit 35e4465c authored by Anna.Pavlova's avatar Anna.Pavlova

Поправила баги с выставлением курсора

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@55333 954022d7-b5bf-4e40-9824-e11837661b57
parent e8ca920d
This diff is collapsed.
......@@ -4,7 +4,7 @@
* Time: 18:28
*/
function ParaRun(Paragraph, bMathRun, Parent)
function ParaRun(Paragraph, bMathRun)
{
this.Id = g_oIdCounter.Get_NewId(); // Id данного элемента
this.Type = para_Run; // тип данного элемента
......@@ -49,7 +49,7 @@ function ParaRun(Paragraph, bMathRun, Parent)
if(bMathRun)
{
this.typeObj = MATH_PARA_RUN;
this.Parent = Parent;
this.Parent = null;
this.size =
{
ascent: 0,
......@@ -611,6 +611,11 @@ ParaRun.prototype =
X += Item.WidthVisible;
break;
}
case para_Math_Text:
{
X += Item.WidthVisible;
break;
}
}
}
......@@ -6492,7 +6497,7 @@ ParaRun.prototype.Math_Draw = function(x, y, pGraphics)
// var oWPrp = this.Get_CompiledPr(true);
var oWPrp = this.Pr.Copy();
this.Math_applyArgSize(oWPrp);
this.Parent.applyArgSize(oWPrp);
oWPrp.Italic = false;
......@@ -6510,6 +6515,8 @@ ParaRun.prototype.Math_Recalculate = function(RecalcInfo)
var RangeStartPos = 0;
var RangeEndPos = this.Content.length;
this.Parent = RecalcInfo.Parent;
// обновляем позиции start и end для Range
this.Lines[0].Add_Range(0, RangeStartPos, RangeEndPos);
......@@ -6518,7 +6525,7 @@ ParaRun.prototype.Math_Recalculate = function(RecalcInfo)
//var oWPrp = this.Get_CompiledPr(true);
var oWPrp = this.Pr.Copy();
this.Math_applyArgSize(oWPrp);
this.Parent.applyArgSize(oWPrp);
//oWPrp.Merge(RecalcInfo.Composition.DEFAULT_RUN_PRP.getTxtPrp());
oWPrp.Italic = false;
......@@ -6555,7 +6562,7 @@ ParaRun.prototype.Math_Recalculate = function(RecalcInfo)
ParaRun.prototype.Math_Update_Cursor = function(X, Y, CurPage, UpdateTarget)
{
var runPrp = this.Get_CompiledPr(true);
this.Math_applyArgSize(runPrp);
this.Parent.applyArgSize(runPrp);
var sizeCursor = runPrp.FontSize*g_dKoef_pt_to_mm;
......
......@@ -1242,8 +1242,6 @@ CMathBase.prototype =
return gaps;
},
/// Position for Paragraph
Get_ParaContentPosByXY: function(SearchPos, Depth)
{
......@@ -1264,6 +1262,9 @@ CMathBase.prototype =
Depth +=2;
//SearchPos.CurX += SearchPos.X - disp.mCoord.x;
//SearchPos.CurX += this.align(pos.x, pos.y).x;
SearchPos.X = disp.mCoord.x;
SearchPos.Y = disp.mCoord.y;
......@@ -1382,13 +1383,23 @@ CMathBase.prototype =
}
},
Selection_DrawRange: function(SelectionDraw)
{
if(this.IsSelectEmpty())
this.elements[this.SelectStart_X][this.SelectStart_Y].Selection_DrawRange(SelectionDraw);
},
Selection_IsEmpty: function()
{
if(this.IsSelectEmpty())
this.elements[this.SelectStart_X][this.SelectStart_Y].Selection_IsEmpty();
},
IsSelectEmpty: function()
{
return (this.SelectStart_X == this.SelectEnd_X) && (this.SelectStart_Y == this.SelectEnd_Y);
},
update_Cursor: function(CurPage, UpdateTarget)
Recalculate_CurPos: function(_X, Y, CurrentRun, _CurRange, _CurLine, _CurPage, UpdateCurPos, UpdateTarget, ReturnTarget)
{
return this.elements[this.CurPos_X][this.CurPos_Y].update_Cursor(CurPage, UpdateTarget);
return this.elements[this.CurPos_X][this.CurPos_Y].Recalculate_CurPos(_X, Y, CurrentRun, _CurRange, _CurLine, _CurPage, UpdateCurPos, UpdateTarget, ReturnTarget);
}
//////////////////////////
......
......@@ -161,12 +161,13 @@ CCoeffGaps.prototype =
var COEFF_GAPS = new CCoeffGaps();
function CRecalculateInfo(oMeasure, argSize, Composition)
function CRecalculateInfo(oMeasure, Parent)
{
this.measure = oMeasure;
this.Parent = Parent;
this.Composition = Composition; // для Para_Run
this.argSize = argSize; // argSize выставляем один раз для всего контента
this.Composition = this.Parent.Composition; // для Para_Run
this.argSize = this.Parent.argSize; // argSize выставляем один раз для всего контента
this.leftRunPrp = null; // Run_Prp левого элемента
this.currRunPrp = null;
......@@ -1194,12 +1195,12 @@ CMathContent.prototype =
if(this.content.length == 0)
{
this.content.push(new ParaRun(this.Composition.Parent.Paragraph, true, this));
this.content.push(new ParaRun(this.Composition.Parent.Paragraph, true));
//this.CurPos++;
}
this.content.push(obj);
this.content.push(new ParaRun(this.Composition.Parent.Paragraph, true, this));
this.content.push(new ParaRun(this.Composition.Parent.Paragraph, true));
//this.CurPos += 2;
......@@ -5379,7 +5380,7 @@ CMathContent.prototype =
lit: false
};*/
var RecalcInfo = new CRecalculateInfo(oMeasure, this.argSize, this.Composition);
var RecalcInfo = new CRecalculateInfo(oMeasure, this, this.argSize, this.Composition);
/*if(this.content.length > 1)
......@@ -5604,12 +5605,10 @@ CMathContent.prototype =
this.content[i].draw(x, y, pGraphics);
}
else if(this.content[i].typeObj == MATH_COMP)
this.content[i].draw(x, y, pGraphics);
else if(this.content[i].typeObj == MATH_PLACEHOLDER)
this.content[i].draw(x, y, pGraphics);
else // MATH_PARA_RUN
else if(this.content[i].typeObj == MATH_PARA_RUN)
this.content[i].Math_Draw(x, y, pGraphics);
else
this.content[i].draw(x, y, pGraphics);
/*if(this.content[i].value.typeObj == MATH_COMP)
{
......@@ -5729,6 +5728,32 @@ CMathContent.prototype =
return result;
},
Recalculate_CurPos : function(_X, Y, CurrentRun, _CurRange, _CurLine, _CurPage, UpdateCurPos, UpdateTarget, ReturnTarget)
{
var result;
if(this.content[this.CurPos].typeObj == MATH_COMP)
{
_X += this.WidthToElement[this.CurPos];
result = this.content[this.CurPos].Recalculate_CurPos(_X, Y, CurrentRun, _CurRange, _CurLine, _CurPage, UpdateCurPos, UpdateTarget, ReturnTarget);
}
else if(this.content[this.CurPos].typeObj == MATH_PARA_RUN)
{
var absPos = this.Composition.absPos;
//var X = this.pos.x + absPos.x + this.WidthToElement[this.CurPos],
// Y = this.pos.y + absPos.y + this.size.ascent;
//_X += this.WidthToElement[this.CurPos];
Y = this.pos.y + absPos.y + this.size.ascent;
_X = this.pos.x + absPos.x + this.WidthToElement[this.CurPos];
result = this.content[this.CurPos].Recalculate_CurPos(_X, Y, CurrentRun, 0, 0, _CurPage, UpdateCurPos, UpdateTarget, ReturnTarget);
}
return result;
},
old_coordWOGaps: function( msCoord )
{
var x = msCoord.x;
......@@ -6367,6 +6392,27 @@ CMathContent.prototype =
return this.SelectStartPos !== this.SelectEndPos;
//return this.SelectStartPos !== this.SelectEndPos;
},
Selection_IsEmpty: function()
{
var startPos = this.SelectStartPos,
endPos = this.SelectEndPos;
var result = false;
if(startPos == endPos)
{
var bRunPrp = this.content[startPos].typeObj == MATH_RUN_PRP,
bComp = this.content[startPos].typeObj == MATH_COMP,
bSelectComp = bComp ? this.content[startPos].IsSelectEmpty() : false;
if(bRunPrp || bSelectComp)
result = this.content[startPos].Selection_IsEmpty();
else
result = false;
}
return result;
},
setCtrPrp: function()
{
......@@ -7479,7 +7525,7 @@ CMathContent.prototype =
//ContentPos.Add(pos);
SearchPos.X -= this.WidthToElement[pos];
SearchPos.CurX += this.WidthToElement[pos];
//SearchPos.CurX += this.WidthToElement[pos];
if(this.content[pos].typeObj == MATH_COMP)
{
......@@ -7487,9 +7533,11 @@ CMathContent.prototype =
}
else if(this.content[pos].typeObj == MATH_PARA_RUN) // проверка на gaps в findDisposition
{
SearchPos.X += this.pos.x + this.Composition.absPos.x;
SearchPos.X += this.pos.x + this.Composition.absPos.x + this.WidthToElement[pos];
SearchPos.CurX += this.pos.x + this.WidthToElement[pos];
this.content[pos].Get_ParaContentPosByXY(SearchPos, Depth, 0, 0);
}
}
},
Get_ParaContentPos: function(bSelection, bStart, ContentPos)
......@@ -7527,8 +7575,11 @@ CMathContent.prototype =
var curr = this.content[this.CurPos];
if(this.content.length > 0)
{
if(curr.typeObj == MATH_COMP || curr.typeObj == MATH_PARA_RUN)
curr.Set_ParaContentPos(ContentPos, Depth);
}
},
set_SelectEndExtreme: function(bEnd)
......
......@@ -62,6 +62,9 @@ function CMathText()
this.GapRight = 0;
this.WidthVisible = 0;
// для Para_Run
this.Type = para_Math_Text;
//this.Parent = null;
/*this.TxtPrp = new CMathTextPrp();
......
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