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

В ревизиях 54643 и 54663 были реализованы свойства normal style (settings)

1. Свойство lit из settings
2. Поправила accent для матрицы
3. Поправлено расположение значка радикала относительно аргумента (добавлено смещение для аргумента)

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@54697 954022d7-b5bf-4e40-9824-e11837661b57
parent a6c67218
...@@ -128,7 +128,9 @@ CMathBase.prototype = ...@@ -128,7 +128,9 @@ CMathBase.prototype =
}, },
setRPrp: function(rPrp) setRPrp: function(rPrp)
{ {
this.RunPrp.Merge(rPrp); //this.RunPrp.Merge(rPrp);
this.RunPrp.mathPrp.bold = rPrp.mathPrp.bold; // как в Ворде, все остальные стили не поддерживаются
this.RunPrp.setTxtPrp(rPrp.textPrp); // Merge wTxtPrp
this.CtrPrp = new CTextPr(); this.CtrPrp = new CTextPr();
var gPrp = rPrp.getMergedWPrp(); var gPrp = rPrp.getMergedWPrp();
...@@ -934,13 +936,15 @@ CMathBase.prototype = ...@@ -934,13 +936,15 @@ CMathBase.prototype =
return res; return res;
}, },
getAscent: function(_height) getAscent: function(_height, oMeasure)
{ {
var Ascent = 0; var Ascent = 0;
if(this.nRow > 1) if(this.nRow > 1)
{ {
Ascent = _height || this.size.height; Ascent = _height || this.size.height;
Ascent /=2; Ascent /=2;
var mgCtrPrp = this.mergeCtrTPrp();
Ascent += this.Composition.GetShiftCenter(oMeasure, mgCtrPrp);
} }
else else
for(var i=0; i< this.nCol; i++) for(var i=0; i< this.nCol; i++)
......
...@@ -157,9 +157,9 @@ CMathRunPrp.prototype = ...@@ -157,9 +157,9 @@ CMathRunPrp.prototype =
return props; return props;
}, },
getTypeText: function() getTxtSettings: function()
{ {
return this.mathPrp.getTypeText(); return this.mathPrp.getTxtSettings();
} }
} }
...@@ -301,14 +301,20 @@ CMPrp.prototype = ...@@ -301,14 +301,20 @@ CMPrp.prototype =
this.typeText = TXT_NORMAL; this.typeText = TXT_NORMAL;
}, },
getTypeText: function() getTxtSettings: function()
{ {
var type= this.typeText; var type = this.typeText;
if(type == TXT_ROMAN && this.italic == false) // если MATH TEXT и не курсив, то подменяем на NORMAL TEXT if(type == TXT_ROMAN && this.italic == false) // если MATH TEXT и не курсив, то подменяем на NORMAL TEXT
type = TXT_NORMAL; type = TXT_NORMAL;
return type; var settings =
{
type: type,
lit: this.lit
};
return settings;
}, },
getTxtPrp: function() getTxtPrp: function()
{ {
...@@ -4731,7 +4737,12 @@ CMathContent.prototype = ...@@ -4731,7 +4737,12 @@ CMathContent.prototype =
}, },
Resize: function(oMeasure) // пересчитываем всю формулу Resize: function(oMeasure) // пересчитываем всю формулу
{ {
var typeTxt = TXT_ROMAN; // default MATH Text // default для случая с плейсхолдером, RunPrp в контенте отсутствуют
var TxtSettings =
{
type: TXT_ROMAN,
lit: false
}; // default type is TXT_ROMAN (MATH Text)
//var posPrev = -1; //var posPrev = -1;
for(var i = 0; i < this.content.length; i++) for(var i = 0; i < this.content.length; i++)
...@@ -4741,10 +4752,11 @@ CMathContent.prototype = ...@@ -4741,10 +4752,11 @@ CMathContent.prototype =
if(type == MATH_TEXT) if(type == MATH_TEXT)
{ {
this.content[i].value.setMText(typeTxt); this.content[i].value.setMText(TxtSettings.type);
this.content[i].value.Resize(oMeasure); this.content[i].value.Resize(oMeasure);
this.checkGapsSign(oMeasure, i); if(TxtSettings.type !== TXT_NORMAL && TxtSettings.lit === false)
this.checkGapsSign(oMeasure, i);
} }
else if(type == MATH_COMP) else if(type == MATH_COMP)
{ {
...@@ -4760,7 +4772,7 @@ CMathContent.prototype = ...@@ -4760,7 +4772,7 @@ CMathContent.prototype =
this.applyArgSize(oWPrp); // здесь мержим с DEFAULT_RUN_PRP this.applyArgSize(oWPrp); // здесь мержим с DEFAULT_RUN_PRP
typeTxt = obj.getTypeText(); TxtSettings = obj.getTxtSettings();
/*if(typeTxt == TXT_ROMAN) // MATH TEXT, наклон не меняем, если italic /*if(typeTxt == TXT_ROMAN) // MATH TEXT, наклон не меняем, если italic
oWPrp.Italic = false;*/ oWPrp.Italic = false;*/
...@@ -6006,6 +6018,10 @@ CMathContent.prototype = ...@@ -6006,6 +6018,10 @@ CMathContent.prototype =
{ {
//return (this.selection.startPos !== this.selection.endPos); //return (this.selection.startPos !== this.selection.endPos);
return this.RealSelect.startPos !== this.RealSelect.endPos; return this.RealSelect.startPos !== this.RealSelect.endPos;
},
setCtrPrp: function()
{
}, },
old_setStart_Selection: function(StartIndSelect) old_setStart_Selection: function(StartIndSelect)
{ {
......
...@@ -168,7 +168,7 @@ CMathMatrix.prototype.setRuleGap = function(space, rule, gap, minGap) ...@@ -168,7 +168,7 @@ CMathMatrix.prototype.setRuleGap = function(space, rule, gap, minGap)
space.value = Value;*/ space.value = Value;*/
} }
CMathMatrix.prototype.recalculateSize = function() CMathMatrix.prototype.recalculateSize = function(oMeasure)
{ {
var txtPrp = this.mergeCtrTPrp(); var txtPrp = this.mergeCtrTPrp();
...@@ -220,7 +220,7 @@ CMathMatrix.prototype.recalculateSize = function() ...@@ -220,7 +220,7 @@ CMathMatrix.prototype.recalculateSize = function()
} }
} }
else /*this.baseJc == 0*/ else /*this.baseJc == 0*/
ascent = this.getAscent(height); ascent = this.getAscent(height, oMeasure);
//center = height/2; //center = height/2;
this.size = {width: width, height: height, ascent: ascent}; this.size = {width: width, height: height, ascent: ascent};
......
...@@ -13,6 +13,8 @@ CSignRadical.prototype.draw = function(x, y, pGraphics) ...@@ -13,6 +13,8 @@ CSignRadical.prototype.draw = function(x, y, pGraphics)
//var txtPrp = this.Parent.getTxtPrp(); //var txtPrp = this.Parent.getTxtPrp();
var penW = txtPrp.FontSize*g_dKoef_pt_to_mm*0.042; var penW = txtPrp.FontSize*g_dKoef_pt_to_mm*0.042;
y += penW/2; // смещаем, для отрисовки верхней линии радикала
var plH = 9.877777777777776 * txtPrp.FontSize /36; var plH = 9.877777777777776 * txtPrp.FontSize /36;
var x1 = this.pos.x + x, var x1 = this.pos.x + x,
...@@ -187,9 +189,9 @@ CRadical.prototype.init = function(props) ...@@ -187,9 +189,9 @@ CRadical.prototype.init = function(props)
else if(props.type === DEGREE_RADICAL) else if(props.type === DEGREE_RADICAL)
this.type = DEGREE_RADICAL; this.type = DEGREE_RADICAL;
if(props.degHide === true && props.degHide === 1) if(props.degHide === true || props.degHide === 1)
this.type = SQUARE_RADICAL; this.type = SQUARE_RADICAL;
else if(props.degHide == false && props.degHide === 0) else if(props.degHide == false || props.degHide === 0)
this.type = DEGREE_RADICAL; this.type = DEGREE_RADICAL;
this.setDimension(1, 1); this.setDimension(1, 1);
...@@ -217,23 +219,28 @@ CRadical.prototype.recalculateSize = function() ...@@ -217,23 +219,28 @@ CRadical.prototype.recalculateSize = function()
{ {
this.signRadical.recalculateSize(); this.signRadical.recalculateSize();
var txtPrp = this.getCtrPrp();
var gapTop = 2.2*txtPrp.FontSize /36,
sign = this.signRadical.size;
if(this.type == SQUARE_RADICAL) if(this.type == SQUARE_RADICAL)
{ {
var sign = this.signRadical.size; var base = this.elements[0][0].size;
var arg = this.elements[0][0].size;
var shTop = (sign.height - gapTop - base.height)/2;
var height = sign.height, var height = sign.height,
width = sign.width, width = sign.width,
ascent = height - (arg.height - arg.ascent); ascent = gapTop + shTop + base.ascent;
//center = (height - arg.height)*0.6 + arg.center; //ascent = height - (base.height - base.ascent);
this.size = {width: width, height: height, ascent: ascent}; this.size = {width: width, height: height, ascent: ascent};
} }
else if(this.type == DEGREE_RADICAL) else if(this.type == DEGREE_RADICAL)
{ {
var degr = this.elements[0][0].size, var degr = this.elements[0][0].size,
base = this.elements[0][1].size, base = this.elements[0][1].size;
sign = this.signRadical.size;
var wTick = this.signRadical.sizeTick.width, var wTick = this.signRadical.sizeTick.width,
hTick = this.signRadical.sizeTick.height; hTick = this.signRadical.sizeTick.height;
...@@ -242,7 +249,6 @@ CRadical.prototype.recalculateSize = function() ...@@ -242,7 +249,6 @@ CRadical.prototype.recalculateSize = function()
var width = wDegree + sign.width; var width = wDegree + sign.width;
//var width = degr.width - wTick + sign.width; //var width = degr.width - wTick + sign.width;
var txtPrp = this.getCtrPrp();
var plH = 9.877777777777776 * txtPrp.FontSize /36; var plH = 9.877777777777776 * txtPrp.FontSize /36;
if( sign.height < plH ) if( sign.height < plH )
...@@ -254,18 +260,19 @@ CRadical.prototype.recalculateSize = function() ...@@ -254,18 +260,19 @@ CRadical.prototype.recalculateSize = function()
h2 = sign.height; h2 = sign.height;
var height, ascent; var height, ascent;
var shTop = (sign.height - gapTop - base.height)/2;
if(h1 > h2) if(h1 > h2)
{ {
height = h1; height = h1;
ascent = height - (base.height - base.ascent); ascent = height - shTop - (base.height - base.ascent);
//center = h1 - h2 + (sign.height - base.height)*0.6 + base.center; //ascent = height - (base.height - base.ascent);
} }
else else
{ {
height = h2; height = h2;
ascent = height - (base.height - base.ascent); ascent = height - shTop - (base.height - base.ascent);
//center = (sign.height - base.height)*0.6 + base.center; //ascent = height - (base.height - base.ascent);
} }
this.size = {width: width, height: height, ascent: ascent}; this.size = {width: width, height: height, ascent: ascent};
......
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