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