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

1. Исправила высоту delimiters для случая, когда высота скобок центрируется

2. Поправила размер итераторов для вложенных степеней 
3. Поправила баг при перемещении по стрелке вправо: не вставали в начало Run
4. Поправила баг : не выставлялся курсор из-за дефолтных текстовых настроек (не были проставлены все поля для RFonts)

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@56702 954022d7-b5bf-4e40-9824-e11837661b57
parent 63267deb
...@@ -51,6 +51,15 @@ function ParaMath() ...@@ -51,6 +51,15 @@ function ParaMath()
this.Ascent = 0; this.Ascent = 0;
this.Descent = 0; this.Descent = 0;
this.DefaultTextPr = new CTextPr();
this.DefaultTextPr.Init_Default();
this.DefaultTextPr.Italic = true;
this.DefaultTextPr.FontFamily = {Name : "Cambria Math", Index : -1 };
this.DefaultTextPr.RFonts.Set_All("Cambria Math", -1);
this.MathPr = this.MathPr =
{ {
naryLim: NARY_UndOvr, naryLim: NARY_UndOvr,
...@@ -66,6 +75,8 @@ function ParaMath() ...@@ -66,6 +75,8 @@ function ParaMath()
g_oTableId.Add( this, this.Id ); g_oTableId.Add( this, this.Id );
} }
var BFIRST = true;
ParaMath.prototype = ParaMath.prototype =
{ {
Get_Id : function() Get_Id : function()
...@@ -212,7 +223,7 @@ ParaMath.prototype = ...@@ -212,7 +223,7 @@ ParaMath.prototype =
Remove : function(Direction, bOnAddText) Remove : function(Direction, bOnAddText)
{ {
var oContent = this.GetSelectContent(); var oContent = this.GetSelectContent();
if (oContent.Start == oContent.End) /*if (oContent.Start == oContent.End)
{ {
var oElem = oContent.Content.getElem(oContent.Start); var oElem = oContent.Content.getElem(oContent.Start);
...@@ -257,7 +268,7 @@ ParaMath.prototype = ...@@ -257,7 +268,7 @@ ParaMath.prototype =
} }
} }
else else
return this.RemoveElem(oContent, Direction, bOnAddText); return this.RemoveElem(oContent, Direction, bOnAddText);*/
}, },
...@@ -434,6 +445,8 @@ ParaMath.prototype = ...@@ -434,6 +445,8 @@ ParaMath.prototype =
this.Root.Resize(null, this, g_oTextMeasurer, TextPr); this.Root.Resize(null, this, g_oTextMeasurer, TextPr);
BFIRST = false;
var pos = new CMathPosition(); var pos = new CMathPosition();
pos.x = 0; pos.x = 0;
pos.y = 0; pos.y = 0;
...@@ -820,9 +833,6 @@ ParaMath.prototype = ...@@ -820,9 +833,6 @@ ParaMath.prototype =
var w_px = (w_mm * dKoef) >> 0; var w_px = (w_mm * dKoef) >> 0;
var h_px = (h_mm * dKoef) >> 0; var h_px = (h_mm * dKoef) >> 0;
var _need_pix_width = this.Width + 1;
var _need_pix_height = this.Height + 1;
var _canvas = document.createElement('canvas'); var _canvas = document.createElement('canvas');
_canvas.width = w_px; _canvas.width = w_px;
_canvas.height = h_px; _canvas.height = h_px;
...@@ -837,7 +847,7 @@ ParaMath.prototype = ...@@ -837,7 +847,7 @@ ParaMath.prototype =
g.m_oCoordTransform.ty = 0; g.m_oCoordTransform.ty = 0;
g.transform(1,0,0,1,0,0); g.transform(1,0,0,1,0,0);
this.Root.draw( 0, 0, g); this.Root.draw(0, 0, g);
window.IsShapeToImageConverter = false; window.IsShapeToImageConverter = false;
...@@ -855,7 +865,7 @@ ParaMath.prototype = ...@@ -855,7 +865,7 @@ ParaMath.prototype =
ApplyArgSize : function(oWPrp, argSize) ApplyArgSize : function(oWPrp, argSize)
{ {
var tPrp = new CTextPr(); var tPrp = new CTextPr();
var defaultWPrp = /*var defaultWPrp =
{ {
FontFamily: {Name : "Cambria Math", Index : -1 }, FontFamily: {Name : "Cambria Math", Index : -1 },
FontSize: 11, FontSize: 11,
...@@ -863,9 +873,9 @@ ParaMath.prototype = ...@@ -863,9 +873,9 @@ ParaMath.prototype =
Bold: false, Bold: false,
RFonts: {}, RFonts: {},
Lang: {} Lang: {}
}; };*/
tPrp.Merge(defaultWPrp); tPrp.Merge(this.DefaultTextPr);
tPrp.Merge(oWPrp); tPrp.Merge(oWPrp);
var FSize = tPrp.FontSize; var FSize = tPrp.FontSize;
...@@ -1013,7 +1023,7 @@ ParaMath.prototype = ...@@ -1013,7 +1023,7 @@ ParaMath.prototype =
}, },
Get_Default_TPrp: function() Get_Default_TPrp: function()
{ {
var TextPrp = new CTextPr(); /*var TextPrp = new CTextPr();
TextPrp.Init_Default(); TextPrp.Init_Default();
var mathFont = new CTextPr(); var mathFont = new CTextPr();
...@@ -1030,7 +1040,7 @@ ParaMath.prototype = ...@@ -1030,7 +1040,7 @@ ParaMath.prototype =
mathFont.Set_FromObject(obj); mathFont.Set_FromObject(obj);
TextPrp.Merge(mathFont); TextPrp.Merge(mathFont);*/
/*var DefaultPrp = /*var DefaultPrp =
...@@ -1048,13 +1058,15 @@ ParaMath.prototype = ...@@ -1048,13 +1058,15 @@ ParaMath.prototype =
TextPrp.Set_FromObject(DefaultPrp);*/ TextPrp.Set_FromObject(DefaultPrp);*/
return TextPrp; var DefaultTextPrp = this.DefaultTextPr.Copy();
DefaultTextPrp.Italic = false;
return DefaultTextPrp;
}, },
Set_Select_ToMComp: function(Direction) Set_Select_ToMComp: function(Direction)
{ {
this.bSelectionUse = true; this.bSelectionUse = true;
this.Root.Set_Select_ToMComp(Direction); this.Root.Set_Select_ToMComp(Direction);
}, },
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
// Функции отрисовки // Функции отрисовки
...@@ -1228,26 +1240,34 @@ ParaMath.prototype = ...@@ -1228,26 +1240,34 @@ ParaMath.prototype =
this.Root.Get_ParaContentPos(bSelection, bStart, ContentPos); 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; return ContentPos;
}, },
Set_ParaContentPos : function(ContentPos, Depth) // выставить логическую позицию в контенте Set_ParaContentPos : function(ContentPos, Depth) // выставить логическую позицию в контенте
{ {
// TODO: ParaMath.Set_ParaContentPos // TODO: ParaMath.Set_ParaContentPos
this.State.ContentPos = ContentPos.Get(Depth);
var Pos = ContentPos.Get(Depth); console.log("Set_ParaContentPos");
this.State.ContentPos = Pos;
/*console.log("Set_ParaContentPos");
var str = ""; var str = "";
for(var i = 0; i < ContentPos.Data.length; i++) for(var i = 0; i < ContentPos.Data.length; i++)
{ {
str += ContentPos.Data[i] + " "; str += ContentPos.Data[i] + " ";
} }
console.log(str);*/ console.log(str);
this.Root.Set_ParaContentPos(ContentPos, Depth); this.Root.Set_ParaContentPos(ContentPos, Depth);
}, },
Get_PosByElement : function(Class, ContentPos, Depth, UseRange, Range, Line) Get_PosByElement : function(Class, ContentPos, Depth, UseRange, Range, Line)
{ {
...@@ -1500,5 +1520,4 @@ function TEST_MATH_ImageConverter() ...@@ -1500,5 +1520,4 @@ function TEST_MATH_ImageConverter()
var dataImg = editor.WordControl.m_oLogicDocument.Content[0].Content[0].MathToImageConverter(); var dataImg = editor.WordControl.m_oLogicDocument.Content[0].Content[0].MathToImageConverter();
console.log(dataImg.ImageUrl); console.log(dataImg.ImageUrl);
} }
\ No newline at end of file
...@@ -7157,9 +7157,7 @@ ParaRun.prototype.Math_Draw = function(x, y, pGraphics) ...@@ -7157,9 +7157,7 @@ ParaRun.prototype.Math_Draw = function(x, y, pGraphics)
pGraphics.b_color1(0,0,0,255); pGraphics.b_color1(0,0,0,255);
for(var i=0; i < this.Content.length;i++) for(var i=0; i < this.Content.length;i++)
{
this.Content[i].draw(X, Y, pGraphics); this.Content[i].draw(X, Y, pGraphics);
}
} }
ParaRun.prototype.Math_Recalculate = function(Parent, Paragraph, oMeasure, RecalcInfo) ParaRun.prototype.Math_Recalculate = function(Parent, Paragraph, oMeasure, RecalcInfo)
...@@ -7199,33 +7197,8 @@ ParaRun.prototype.Math_Recalculate = function(Parent, Paragraph, oMeasure, Recal ...@@ -7199,33 +7197,8 @@ ParaRun.prototype.Math_Recalculate = function(Parent, Paragraph, oMeasure, Recal
} }
/*if(this.Parent.bRoot)
{
var lng = this.Content.length;
for(var i = 0; i < lng; i++)
{
var left = this.Content[i].GapLeft,
right = this.Content[i].GapRight;
console.log(RecalcInfo.TEST_COUNT + ". Left : " + left + ", Right : " + right);
RecalcInfo.TEST_COUNT++;
}
}*/
this.size = {width: width, height: ascent + descent, ascent: ascent}; this.size = {width: width, height: ascent + descent, ascent: ascent};
} }
/*ParaRun.prototype.ApplyGaps = function()
{
if(this.Is_Empty() == false)
{
var lng = this.Content.length;
this.Content[lng - 1].ApplyGaps();
this.size.width += this.Content[lng - 1].size.width;
}
}*/
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);
......
...@@ -119,6 +119,10 @@ CMathBase.prototype = ...@@ -119,6 +119,10 @@ CMathBase.prototype =
return CompiledCtrPrp; return CompiledCtrPrp;
}, },
Get_CompiledCtrPrp_2: function() // without arg Size
{
return this.CompiledCtrPrp.Copy();
},
// TO DO // TO DO
// пересмотреть // пересмотреть
getCtrPrpForFirst: function() getCtrPrpForFirst: function()
...@@ -1517,7 +1521,7 @@ CMathBase.prototype = ...@@ -1517,7 +1521,7 @@ CMathBase.prototype =
return result; return result;
}, },
Get_RightPos: function(SearchPos, ContentPos, Depth, UseContentPos, BegRun) Get_RightPos: function(SearchPos, ContentPos, Depth, UseContentPos, StepEnd, BegRun)
{ {
var CurPos_X, CurPos_Y; var CurPos_X, CurPos_Y;
var result = false; var result = false;
...@@ -1544,7 +1548,7 @@ CMathBase.prototype = ...@@ -1544,7 +1548,7 @@ CMathBase.prototype =
if(!bJDraw && !usePlh) if(!bJDraw && !usePlh)
{ {
this.elements[CurPos_X][CurPos_Y].Get_RightPos(SearchPos, ContentPos, Depth + 2, bUseContent, BegRun); this.elements[CurPos_X][CurPos_Y].Get_RightPos(SearchPos, ContentPos, Depth + 2, bUseContent, StepEnd, BegRun);
SearchPos.Pos.Update(CurPos_X, Depth); SearchPos.Pos.Update(CurPos_X, Depth);
SearchPos.Pos.Update(CurPos_Y, Depth+1); SearchPos.Pos.Update(CurPos_Y, Depth+1);
} }
......
...@@ -160,6 +160,14 @@ CDegree.prototype.recalculateSup = function(oMeasure) ...@@ -160,6 +160,14 @@ CDegree.prototype.recalculateSup = function(oMeasure)
this.upBase = iter.height - ascBase; this.upBase = iter.height - ascBase;
} }
if(this.Parent.bRoot)
{
console.log("ArgSize of Base : " + this.elements[0][0].argSize);
console.log("ArgSize of Iterator : " + this.elements[0][1].argSize);
}
var height = this.upBase + base.height; var height = this.upBase + base.height;
var ascent = this.upBase + base.ascent; var ascent = this.upBase + base.ascent;
......
...@@ -5013,8 +5013,7 @@ CMathContent.prototype = ...@@ -5013,8 +5013,7 @@ CMathContent.prototype =
{ {
if(!this.bRoot) if(!this.bRoot)
{ {
var oWPrp = this.Parent.Get_CompiledCtrPrp(); var oWPrp = this.Parent.Get_CompiledCtrPrp_2(); // without arg Size
this.ParaMath.ApplyArgSize(oWPrp, this.argSize); this.ParaMath.ApplyArgSize(oWPrp, this.argSize);
oWPrp.Italic = false; oWPrp.Italic = false;
...@@ -5165,17 +5164,16 @@ CMathContent.prototype = ...@@ -5165,17 +5164,16 @@ CMathContent.prototype =
if( !bHidePlh ) if( !bHidePlh )
{ {
var oWPrp;
for(var i=0; i < this.content.length;i++) for(var i=0; i < this.content.length;i++)
{ {
if(this.content[i].typeObj == MATH_RUN_PRP) if(this.content[i].typeObj == MATH_RUN_PRP)
{ {
pGraphics.b_color1(0,0,0,255); pGraphics.b_color1(0,0,0,255);
var mgWPrp = this.content[i].value.getMergedWPrp(); var mgWPrp = this.content[i].value.getMergedWPrp();
var oWPrp = new CTextPr(); oWPrp = new CTextPr();
oWPrp.Merge(mgWPrp); oWPrp.Merge(mgWPrp);
//this.applyArgSize(oWPrp);
this.ParaMath.ApplyArgSize(oWPrp, this.argSize); this.ParaMath.ApplyArgSize(oWPrp, this.argSize);
pGraphics.SetFont(oWPrp); pGraphics.SetFont(oWPrp);
...@@ -5184,17 +5182,13 @@ CMathContent.prototype = ...@@ -5184,17 +5182,13 @@ CMathContent.prototype =
{ {
pGraphics.b_color1(0,0,0,255); pGraphics.b_color1(0,0,0,255);
//var oWPrp = this.Parent.Get_CtrPrp(); oWPrp = this.Parent.Get_CompiledCtrPrp_2();
var oWPrp = this.Parent.Get_CompiledCtrPrp();
//this.applyArgSize(oWPrp);
this.ParaMath.ApplyArgSize(oWPrp, this.argSize); this.ParaMath.ApplyArgSize(oWPrp, this.argSize);
oWPrp.Italic = false; oWPrp.Italic = false;
pGraphics.SetFont(oWPrp); pGraphics.SetFont(oWPrp);
//var ctrPrp = this.Parent.Get_CompiledCtrPrp();
//ctrPrp.Italic = false;
pGraphics.SetFont(oWPrp); pGraphics.SetFont(oWPrp);
...@@ -6441,7 +6435,7 @@ CMathContent.prototype = ...@@ -6441,7 +6435,7 @@ CMathContent.prototype =
} }
else if(curType == MATH_COMP) else if(curType == MATH_COMP)
{ {
this.content[CurPos].Get_RightPos(SearchPos, ContentPos, Depth + 1, bUseContent, BegRun); this.content[CurPos].Get_RightPos(SearchPos, ContentPos, Depth + 1, bUseContent, StepEnd, BegRun);
} }
else if(BegRun) else if(BegRun)
{ {
...@@ -6450,7 +6444,7 @@ CMathContent.prototype = ...@@ -6450,7 +6444,7 @@ CMathContent.prototype =
} }
else else
{ {
this.content[CurPos].Get_RightPos(SearchPos, ContentPos, Depth + 1, bUseContent); this.content[CurPos].Get_RightPos(SearchPos, ContentPos, Depth + 1, bUseContent, StepEnd);
} }
SearchPos.Pos.Update(CurPos, Depth); SearchPos.Pos.Update(CurPos, Depth);
...@@ -6481,6 +6475,9 @@ CMathContent.prototype = ...@@ -6481,6 +6475,9 @@ CMathContent.prototype =
//if ( true === SearchPos.UpdatePos ) //if ( true === SearchPos.UpdatePos )
// SearchPos.Pos.Update( CurPos, Depth ); // SearchPos.Pos.Update( CurPos, Depth );
var bFirst = true;
while(CurPos >= 0 && SearchPos.Found == false) while(CurPos >= 0 && SearchPos.Found == false)
{ {
var item = this.content[CurPos]; var item = this.content[CurPos];
......
...@@ -3601,7 +3601,8 @@ CDelimiter.prototype.Resize = function(Parent, ParaMath, oMeasure) ...@@ -3601,7 +3601,8 @@ CDelimiter.prototype.Resize = function(Parent, ParaMath, oMeasure)
var maxAD = ascentG - shCenter > descentG + shCenter ? ascentG - shCenter: descentG + shCenter; var maxAD = ascentG - shCenter > descentG + shCenter ? ascentG - shCenter: descentG + shCenter;
var plH = 9.877777777777776 * mgCtrPrp.FontSize/36; var plH = 9.877777777777776 * mgCtrPrp.FontSize/36;
var bTextContent = ascentG < plH || descentG < plH; // для текста операторы в случае центрирования не увеличиваем //var bTextContent = ascentG < plH || descentG < plH ; // для текста операторы в случае центрирования не увеличиваем
var bTextContent = ascentG < plH && heightG < 1.5*plH; // для текста операторы в случае центрирования не увеличиваем
var bCentered = this.Pr.shp == DELIMITER_SHAPE_CENTERED, var bCentered = this.Pr.shp == DELIMITER_SHAPE_CENTERED,
b2Max = bCentered && (2*maxAD - heightG > 0.001); b2Max = bCentered && (2*maxAD - heightG > 0.001);
......
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