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

1. Поправила degree (Sup), ограничение по высоте итератора для отрисовки...

1. Поправила degree (Sup), ограничение по высоте итератора для отрисовки относительно основания (чтобы итератор не уезжал вниз)
2. Реализовала gaps degree (Sub)
3. Поправила баг: gaps для двух рядом стоящих мат. объектов

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@54185 954022d7-b5bf-4e40-9824-e11837661b57
parent a7172ada
......@@ -81,6 +81,40 @@ CDegree.prototype.old__recalculateSup = function(oMeasure)
this.size = {width: width, height: height, ascent: ascent};
}
CDegree.prototype.old_recalculateSubScript = function(oMeasure)
{
var base = this.elements[0][0].size,
iter = this.elements[0][1].size;
/*var FontSize = this.getCtrPrp().FontSize,
shiftCenter = 0.5*DIV_CENT*FontSize;*/
//var ctrPrp = this.getCtrPrp(); // выставить потом размер шрифта для итератора
var mgCtrPrp = this.mergeCtrTPrp();
var shCenter = this.Composition.GetShiftCenter(oMeasure, mgCtrPrp);
var width = base.width + iter.width + this.dW;
var low = 0;
if(iter.ascent - shCenter > 2/3*base.height)
{
low = iter.height - 2/3*base.height;
}
else
{
low = iter.height - iter.ascent + shCenter;
}
var height = base.height + low;
var ascent = base.ascent;
this.upper = -(height - iter.height);
this.size = {width: width, height: height, ascent: ascent};
}
CDegree.prototype.recalculateSup = function(oMeasure)
{
var base = this.elements[0][0].size,
......@@ -96,18 +130,29 @@ CDegree.prototype.recalculateSup = function(oMeasure)
if(bBaseOnlyText)
{
var TxtAsc = 1.786*shCenter;
if(TxtAsc + iter.ascent> base.ascent)
this.upBase = TxtAsc + iter.ascent - base.ascent;
var UpBaseline = 1.786*shCenter; // baseline итератора
if(UpBaseline + iter.ascent> base.ascent)
this.upBase = UpBaseline + iter.ascent - base.ascent;
else
this.upIter = base.ascent - TxtAsc - iter.ascent;
this.upIter = base.ascent - UpBaseline - iter.ascent;
}
else
{
this.upBase = iter.ascent - 1.2*shCenter;
if(iter.height - this.upBase > 0.5*base.ascent)
this.upBase = iter.height - 0.5*base.ascent;
}
var height = this.upBase + base.height;
var ascent = this.upBase + base.ascent;
// only for supScript
if(this.IsPlhIterator())
this.dW = 0.008*mgCtrPrp.FontSize;
else
this.dW = 0.01*mgCtrPrp.FontSize;
var width = base.width + iter.width + this.dW;
this.size = {width: width, height: height, ascent: ascent};
......@@ -117,34 +162,32 @@ CDegree.prototype.recalculateSubScript = function(oMeasure)
var base = this.elements[0][0].size,
iter = this.elements[0][1].size;
/*var FontSize = this.getCtrPrp().FontSize,
shiftCenter = 0.5*DIV_CENT*FontSize;*/
//var ctrPrp = this.getCtrPrp(); // выставить потом размер шрифта для итератора
var mgCtrPrp = this.mergeCtrTPrp();
var shCenter = this.Composition.GetShiftCenter(oMeasure, mgCtrPrp);
var width = base.width + iter.width + this.dW;
var low = 0;
var bBaseOnlyText = this.elements[0][0].IsOnlyText();
if(iter.ascent - shCenter > 2/3*base.height)
if(bBaseOnlyText)
{
low = iter.height - 2/3*base.height;
this.upIter = base.ascent + 0.9*shCenter - iter.ascent;
if(base.ascent/2 > this.upIter)
this.upIter = base.ascent/2;
}
else
{
low = iter.height - iter.ascent + shCenter;
this.upIter = base.height + 0.9*shCenter - iter.ascent;
if(base.ascent - shCenter > this.upIter)
this.upIter = base.height - base.ascent + shCenter;
}
var height = base.height + low;
var height = this.upIter + iter.height;
var ascent = base.ascent;
this.upper = -(height - iter.height);
this.size = {width: width, height: height, ascent: ascent};
}
CDegree.prototype.old_old_setPosition = function(_pos)
{
......@@ -396,15 +439,6 @@ CDegree.prototype.getPropsForWrite = function()
return props;
}
CDegree.prototype.setDistance = function()
{
var mgCtrPrp = this.mergeCtrTPrp();
if(this.IsPlhIterator())
this.dW = 0.008*mgCtrPrp.FontSize;
else
this.dW = 0.02*mgCtrPrp.FontSize;
}
CDegree.prototype.IsPlhIterator = function()
{
return this.elements[0][1].IsPlaceholder();
......
......@@ -4448,7 +4448,6 @@ CMathContent.prototype =
return {state: state, SelectContent: SelectContent }; //для CMathContent state всегда true
},
old_changePosForMove: function(pos, order)
{
var posChange = -1;
......@@ -4487,7 +4486,6 @@ CMathContent.prototype =
return posChange;
},
/*
курсор стоит перед RunPrp, в случае если после них идет текст,
в случае с мат. объектом логическое положение курсора после RunPrp (аналогично и для начала формулы) = >
......@@ -4893,11 +4891,17 @@ CMathContent.prototype =
leftCode = bLeftText ? left.getCodeChr() : null,
rightCode = bRightText ? right.getCodeChr() : null;
if(curr.typeObj == MATH_TEXT)
{
var gapLeftComp = 0,
gapRightComp = 0;
if(bLeftComp)
gapLeftComp = this.getGapsMComp(left).right;
//var gapSign = this.Composition.GetGapSign(oMeasure, wTextRPrp);
if(bRightComp)
gapRightComp = this.getGapsMComp(right).left;
if(curr.typeObj == MATH_TEXT)
{
var bSign = false;
if(this.checkOperSign(currCode)) // plus, minus, greater, less
......@@ -4978,10 +4982,10 @@ CMathContent.prototype =
}
if(bSign && bLeftComp)
coeffLeft = coeffLeft - this.getGapsMComp(left).right;
coeffLeft = coeffLeft - gapLeftComp;
if(bSign && bRightComp)
coeffRight = coeffRight - this.getGapsMComp(right).left;
coeffRight = coeffRight - gapRightComp;
coeffLeft = Math.ceil(coeffLeft*10)/10;
coeffRight = Math.ceil(coeffRight*10)/10;
......@@ -4989,35 +4993,29 @@ CMathContent.prototype =
}
else if(curr.typeObj == MATH_COMP)
{
var gapsMComp = this.getGapsMComp(curr);
var currGaps = this.getGapsMComp(curr);
if(bLeft)
coeffLeft = gapsMComp.left;
if(bRight && !bRightComp)
coeffRight = gapsMComp.right;
/*var checkGap = this.checkGapKind(curr);
if(checkGap.bEmptyGaps)
{
if(left !== null)
coeffLeft = 0.1;
}
else if(checkGap.bChildGaps)
{
var gaps = curr.getGapsInside();
coeffLeft = currGaps.left;
if(left !== null)
coeffLeft = gaps.left;
if(right !== null)
coeffRight = gaps.right;
if(bLeftComp)
{
if(gapLeftComp/2 < coeffLeft)
coeffLeft = gapLeftComp/2;
}
}
else
if(bRight)
{
if(left !== null)
coeffLeft = 0.4;
coeffRight = currGaps.right;
if(right !== null)
coeffRight = 0.26;
}*/
if(bRightComp)
{
if(coeffRight/2 > gapRightComp )
coeffRight -= gapRightComp;
else
coeffRight /=2;
}
}
}
if(bLeftText)
......@@ -5235,8 +5233,6 @@ CMathContent.prototype =
else
this.content[i].value.draw(x, y, pGraphics);
/*if(this.content[i].value.typeObj == MATH_COMP)
{
var penW = 25.4/96;
......@@ -5253,7 +5249,7 @@ CMathContent.prototype =
}
/// TEST
if(!this.IsOnlyText())
/*if(!this.IsOnlyText())
{
var penW = 25.4/96;
var x1 = this.pos.x + x - penW,
......@@ -5264,7 +5260,7 @@ CMathContent.prototype =
pGraphics.p_color(0,0,255, 255);
pGraphics.drawVerLine(0, x1, y1, y2, penW);
pGraphics.drawVerLine(0, x2, y1, y2, penW);
}
}*/
/*if(this.bRoot)
{
......@@ -6195,7 +6191,7 @@ CMathContent.prototype =
if(this.argSize == -1)
{
// aa: 0.0013 bb: 0.66 cc: 0.5
//aa: 0.0013 bb: 0.66 cc: 0.5
//aa: 0.0009 bb: 0.68 cc: 0.26
FSize = 0.0009*FSize*FSize + 0.68*FSize + 0.26;
//FSize = 0.001*FSize*FSize + 0.723*FSize - 1.318;
......
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