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

1. Убрала старую функции инициализации CAccent

2. Уменьшила высоту и ширину фигурной скобки для GroupCharacter. Ширина теперь для GroupCharacter статична, чтобы скобка не прыгала, как если бы это был Delimiter.
3. Реализовала круглую (в положении сверху и снизу) и квадратную скобки для GroupCharacter. 

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@58392 954022d7-b5bf-4e40-9824-e11837661b57
parent d7eb7af4
This diff is collapsed.
...@@ -60,7 +60,6 @@ CLimit.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize) ...@@ -60,7 +60,6 @@ CLimit.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
this.Parent = Parent; this.Parent = Parent;
this.ParaMath = ParaMath; this.ParaMath = ParaMath;
//this.Set_CompiledCtrPrp(ParaMath);
if(this.RecalcInfo.bProps == true || RPI.bChangeInline == true) if(this.RecalcInfo.bProps == true || RPI.bChangeInline == true)
{ {
...@@ -125,8 +124,6 @@ CLimit.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize) ...@@ -125,8 +124,6 @@ CLimit.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
} }
else else
{ {
//this.setDistance();
this.FName.Resize(oMeasure, this, ParaMath, RPI, ArgSize); this.FName.Resize(oMeasure, this, ParaMath, RPI, ArgSize);
var ArgSzIter = ArgSize.Copy(); var ArgSzIter = ArgSize.Copy();
...@@ -150,28 +147,6 @@ CLimit.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize) ...@@ -150,28 +147,6 @@ CLimit.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
width += this.GapLeft + this.GapRight; width += this.GapLeft + this.GapRight;
/*var width = 0;
var height = 0;
var maxWH = this.getWidthsHeights();
this.setDistance();
var Widths = maxWH.widths;
var Heights = maxWH.heights;
for( var j = 0 ; j < this.nRow; j++ )
height += Heights[j];
height += this.dH*(this.nRow - 1);
for(var i=0; i < this.nCol ; i++)
width += Widths[i];
width += this.dW*(this.nCol - 1) + this.GapLeft + this.GapRight;
var ascent = this.getAscent(oMeasure);*/
this.size = {width: width, height: height, ascent: ascent}; this.size = {width: width, height: height, ascent: ascent};
} }
......
...@@ -93,6 +93,9 @@ var ACCENT_ARROW_RIGHT = 27; ...@@ -93,6 +93,9 @@ var ACCENT_ARROW_RIGHT = 27;
var ACCENT_ARROW_LR = 28; var ACCENT_ARROW_LR = 28;
var ACCENT_HALF_ARROW_LEFT = 29; var ACCENT_HALF_ARROW_LEFT = 29;
var ACCENT_HALF_ARROW_RIGHT = 30; var ACCENT_HALF_ARROW_RIGHT = 30;
var PARENTHESIS_TOP = 31;
var PARENTHESIS_BOTTOM = 32;
var BRACKET_SQUARE_TOP = 33;
var ACCENT_ONE_DOT = 31; var ACCENT_ONE_DOT = 31;
var ACCENT_TWO_DOTS = 32; var ACCENT_TWO_DOTS = 32;
......
...@@ -338,7 +338,6 @@ CGlyphOperator.prototype.getCoordinateGlyph = function() ...@@ -338,7 +338,6 @@ CGlyphOperator.prototype.getCoordinateGlyph = function()
}*/ }*/
/*var shW = 0, /*var shW = 0,
shH = 0; shH = 0;
...@@ -406,10 +405,6 @@ CGlyphOperator.prototype.relate = function(parent) ...@@ -406,10 +405,6 @@ CGlyphOperator.prototype.relate = function(parent)
{ {
this.Parent = parent; this.Parent = parent;
} }
CGlyphOperator.prototype.IsArrow = function()
{
return false;
}
function COperatorBracket() function COperatorBracket()
...@@ -421,26 +416,37 @@ COperatorBracket.prototype.calcSize = function( stretch ) ...@@ -421,26 +416,37 @@ COperatorBracket.prototype.calcSize = function( stretch )
{ {
var betta = this.getCtrPrp().FontSize/36; var betta = this.getCtrPrp().FontSize/36;
// перевернутая скобка var heightBr, widthBr;
var minBoxH = 4.917529296874999 *betta, //width of 0x28 var minBoxH = 4.917529296874999 *betta; //width of 0x28
if(this.Parent.type == OPER_GROUP_CHAR)
{
// перевернутая скобка
widthBr = 7.347222222222221*betta;
heightBr = minBoxH;
}
else
{
// перевернутая скобка
widthBr = 12.347222222222221*betta; widthBr = 12.347222222222221*betta;
var maxBoxH; var maxBoxH;
var rx = stretch / widthBr; var rx = stretch / widthBr;
if(rx < 1) if(rx < 1)
rx = 1; rx = 1;
if(rx < 2.1) if(rx < 2.1)
maxBoxH = minBoxH * 1.37; maxBoxH = minBoxH * 1.37;
else if(rx < 3.22) else if(rx < 3.22)
maxBoxH = minBoxH * 1.06; maxBoxH = minBoxH * 1.06;
else else
maxBoxH = 8.74 *betta; maxBoxH = 8.74 *betta;
var delta = maxBoxH - minBoxH; var delta = maxBoxH - minBoxH;
var heightBr = delta/4.3 * (rx - 1) + minBoxH; heightBr = delta/4.3 * (rx - 1) + minBoxH;
heightBr = heightBr > maxBoxH ? maxBoxH : heightBr; heightBr = heightBr > maxBoxH ? maxBoxH : heightBr;
}
return {width: widthBr, height: heightBr}; return {width: widthBr, height: heightBr};
} }
...@@ -848,13 +854,19 @@ COperatorBracket.prototype.calcCoord = function(stretch) ...@@ -848,13 +854,19 @@ COperatorBracket.prototype.calcCoord = function(stretch)
} }
var H = Y[53]*RX[53];
for(var i = 0; i < 54; i++) for(var i = 0; i < 54; i++)
{ {
YY[i] = (H - Y[i]*RX[i])*alpha; //YY[i] = (H - Y[i]*RX[i])*alpha;
if(this.Parent.type == OPER_GROUP_CHAR)
YY[i] = (Y[53] - Y[i])*alpha;
else
YY[i] = (Y[53]*RX[53] - Y[i]*RX[i])*alpha;
XX[i] = XX[i]*alpha; XX[i] = XX[i]*alpha;
} }
for(var i = 0; i < 50; i++) for(var i = 0; i < 50; i++)
YY[54 + i] = YY[51 - i]; YY[54 + i] = YY[51 - i];
...@@ -928,7 +940,6 @@ COperatorBracket.prototype.drawPath = function(pGraphics, XX, YY) ...@@ -928,7 +940,6 @@ COperatorBracket.prototype.drawPath = function(pGraphics, XX, YY)
pGraphics._c(XX[102], YY[102], XX[103], YY[103], XX[0], YY[0]); pGraphics._c(XX[102], YY[102], XX[103], YY[103], XX[0], YY[0]);
} }
// TODO: сделать так, чтобы размер скобки совпадал в начальном случае (плейсхолдер), сейчас по размеру аргумента
function COperatorParenthesis() function COperatorParenthesis()
{ {
...@@ -939,15 +950,29 @@ COperatorParenthesis.prototype.calcSize = function(stretch) ...@@ -939,15 +950,29 @@ COperatorParenthesis.prototype.calcSize = function(stretch)
{ {
var betta = this.getCtrPrp().FontSize/36; var betta = this.getCtrPrp().FontSize/36;
var maxBoxH = 9.63041992187 *betta, //9.63 width of 0x239D var heightBr, widthBr;
minBoxH = 5.27099609375 *betta, //width of 0x28 var minBoxH = 5.27099609375 *betta; //width of 0x28
if(this.Parent.type == OPER_GROUP_CHAR)
{
// перевернутая скобка
widthBr = 6.99444444444*betta;
heightBr = minBoxH;
}
else
{
var maxBoxH = 9.63041992187 *betta; //9.63 width of 0x239D
widthBr = 11.99444444444 *betta; widthBr = 11.99444444444 *betta;
var ry = stretch / widthBr,
delta = maxBoxH - minBoxH;
var heightBr = delta/4.3 * (ry - 1) + minBoxH; var ry = stretch / widthBr,
heightBr = heightBr > maxBoxH ? maxBoxH : heightBr; delta = maxBoxH - minBoxH;
heightBr = delta/4.3 * (ry - 1) + minBoxH;
heightBr = heightBr > maxBoxH ? maxBoxH : heightBr;
}
return {height: heightBr, width : widthBr}; return {height: heightBr, width : widthBr};
} }
...@@ -975,15 +1000,17 @@ COperatorParenthesis.prototype.calcCoord = function(stretch) ...@@ -975,15 +1000,17 @@ COperatorParenthesis.prototype.calcCoord = function(stretch)
var aug = stretch/(X[9]*alpha)/2; //Y[9]*alpha - высота скобки var aug = stretch/(X[9]*alpha)/2; //Y[9]*alpha - высота скобки
var RX, RY; var RX, RY;
var MIN_AUG = this.Parent.type == OPER_GROUP_CHAR ? 0.5 : 1;
if(aug > 6.53) if(aug > 6.53)
{ {
RX = 6.53; RX = 6.53;
RY = 2.05; RY = 2.05;
} }
else if(aug < 1) else if(aug < MIN_AUG)
{ {
RX = 1; RX = MIN_AUG;
RY = 1; RY = MIN_AUG;
} }
else else
{ {
...@@ -991,14 +1018,17 @@ COperatorParenthesis.prototype.calcCoord = function(stretch) ...@@ -991,14 +1018,17 @@ COperatorParenthesis.prototype.calcCoord = function(stretch)
RY = 1 + (aug - 1)*0.19; RY = 1 + (aug - 1)*0.19;
} }
var DistH = []; if(this.Parent.type !== OPER_GROUP_CHAR)
for(var i= 0; i< 5; i++)
DistH[i] = Y[9-i] - Y[i];
for(var i = 5; i < 10; i++)
{ {
Y[i] = Y[i]*RY; //точки правой дуги var DistH = [];
Y[9-i] = Y[i] - DistH[9-i]; //точки левой дуги for(var i= 0; i< 5; i++)
DistH[i] = Y[9-i] - Y[i];
for(var i = 5; i < 10; i++)
{
Y[i] = Y[i]*RY; //точки правой дуги
Y[9-i] = Y[i] - DistH[9-i]; //точки левой дуги
}
} }
// X // X
...@@ -1027,8 +1057,10 @@ COperatorParenthesis.prototype.calcCoord = function(stretch) ...@@ -1027,8 +1057,10 @@ COperatorParenthesis.prototype.calcCoord = function(stretch)
for(var i = 0; i < 10; i++) for(var i = 0; i < 10; i++)
{ {
YY[19 - i] = shiftY - Y[i]*alpha; YY[19 - i] = shiftY - Y[i]*alpha;
YY[i] = shiftY - Y[i]*alpha; YY[i] = shiftY - Y[i]*alpha;
XX[19 - i] = X[i]*alpha; XX[19 - i] = X[i]*alpha;
XX[i] = stretch - X[i]*alpha; XX[i] = stretch - X[i]*alpha;
} }
...@@ -1626,10 +1658,6 @@ CSingleArrow.prototype.drawPath = function(pGraphics, XX, YY) ...@@ -1626,10 +1658,6 @@ CSingleArrow.prototype.drawPath = function(pGraphics, XX, YY)
pGraphics._l(XX[9], YY[9]); pGraphics._l(XX[9], YY[9]);
pGraphics._l(XX[10], YY[10]); pGraphics._l(XX[10], YY[10]);
} }
CSingleArrow.prototype.IsArrow = function()
{
return true;
}
function CLeftRightArrow() function CLeftRightArrow()
{ {
...@@ -1715,10 +1743,6 @@ CLeftRightArrow.prototype.drawPath = function(pGraphics, XX, YY) ...@@ -1715,10 +1743,6 @@ CLeftRightArrow.prototype.drawPath = function(pGraphics, XX, YY)
pGraphics._l(XX[16], YY[16]); pGraphics._l(XX[16], YY[16]);
} }
CLeftRightArrow.prototype.IsArrow = function()
{
return true;
}
function CDoubleArrow() function CDoubleArrow()
{ {
...@@ -1814,10 +1838,7 @@ CDoubleArrow.prototype.drawPath = function(pGraphics, XX, YY) ...@@ -1814,10 +1838,7 @@ CDoubleArrow.prototype.drawPath = function(pGraphics, XX, YY)
pGraphics._m(XX[16], YY[16]); pGraphics._m(XX[16], YY[16]);
pGraphics._l(XX[17], YY[17]); pGraphics._l(XX[17], YY[17]);
} }
CDoubleArrow.prototype.IsArrow = function()
{
return true;
}
function CLR_DoubleArrow() function CLR_DoubleArrow()
{ {
...@@ -1923,11 +1944,6 @@ CLR_DoubleArrow.prototype.drawPath = function(pGraphics, XX, YY) ...@@ -1923,11 +1944,6 @@ CLR_DoubleArrow.prototype.drawPath = function(pGraphics, XX, YY)
pGraphics._l(XX[22], YY[22]); pGraphics._l(XX[22], YY[22]);
pGraphics._l(XX[23], YY[23]); pGraphics._l(XX[23], YY[23]);
} }
CLR_DoubleArrow.prototype.IsArrow = function()
{
return true;
}
function CCombiningArrow() function CCombiningArrow()
...@@ -2749,6 +2765,45 @@ COperator.prototype.mergeProperties = function(properties, defaultProps) // pr ...@@ -2749,6 +2765,45 @@ COperator.prototype.mergeProperties = function(properties, defaultProps) // pr
}; };
operator.init(prp); operator.init(prp);
} }
else if(code === 0x23DC || type === PARENTHESIS_TOP)
{
codeChr = 0x23DC;
typeOper = PARENTHESIS_TOP;
operator = new COperatorParenthesis();
prp =
{
location: location,
turn: TURN_0
};
operator.init(prp);
}
else if(code === 0x23DD || type === PARENTHESIS_BOTTOM)
{
codeChr = 0x23DD;
typeOper = PARENTHESIS_BOTTOM;
operator = new COperatorParenthesis();
prp =
{
location: location,
turn: TURN_MIRROR_0
};
operator.init(prp);
}
else if(code === 0x23E0 || type === BRACKET_SQUARE_TOP)
{
codeChr = 0x23E0;
typeOper = BRACKET_SQUARE_TOP;
operator = new CSquareBracket();
prp =
{
location: location,
turn: TURN_0
};
operator.init(prp);
}
else if(code === 0x2190 || type === ARROW_LEFT) else if(code === 0x2190 || type === ARROW_LEFT)
{ {
codeChr = 0x2190; codeChr = 0x2190;
...@@ -3235,7 +3290,13 @@ COperator.prototype.getChr = function() ...@@ -3235,7 +3290,13 @@ COperator.prototype.getChr = function()
} }
COperator.prototype.IsArrow = function() COperator.prototype.IsArrow = function()
{ {
return this.operator.IsArrow(); //return this.operator.IsArrow();
var bArrow = this.typeOper == ARROW_LEFT || this.typeOper == ARROW_RIGHT || this.typeOper == ARROW_LR,
bDoubleArrow = this.typeOper == DOUBLE_LEFT_ARROW || this.typeOper == DOUBLE_RIGHT_ARROW || this.typeOper == DOUBLE_ARROW_LR,
bAccentArrow = his.typeOper == ACCENT_ARROW_LEFT || this.typeOper == ACCENT_ARROW_RIGHT || this.typeOper == ACCENT_ARROW_LR || this.typeOper == ACCENT_HALF_ARROW_LEFT || this.typeOper == ACCENT_HALF_ARROW_RIGHT;
return bArrow || bDoubleArrow;
} }
function CDelimiter(props) function CDelimiter(props)
......
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