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

delimiters: баг с baseline

заполнила createEquation недостающие формулы c  delimiters

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@49981 954022d7-b5bf-4e40-9824-e11837661b57
parent d133f2b0
......@@ -459,7 +459,7 @@ CMathContent.prototype =
mathElem = new CBox();
break;
case MATH_EQ_ARRAY:
mathElem = new CEqArray()
mathElem = new CEqArray();
break;
}
......@@ -3085,9 +3085,9 @@ CMathContent.prototype =
var delim = base.addMComponent(MATH_DELIMITER);
props =
{
begChr: {type: PARENTHESIS_LEFT},
endChr: {type: PARENTHESIS_RIGHT},
shapeType: DELIMITER_SHAPE_MATH,
begChrType: PARENTHESIS_LEFT,
endChrType: PARENTHESIS_RIGHT,
shapeType: DELIMITER_SHAPE_MATH,
column: 1
};
......@@ -3156,10 +3156,10 @@ CMathContent.prototype =
var delim = base.addMComponent(MATH_DELIMITER);
props =
{
begChr: {type: PARENTHESIS_LEFT},
endChr: {type: PARENTHESIS_RIGHT},
shapeType: DELIMITER_SHAPE_MATH,
column: 1
begChrType: PARENTHESIS_LEFT,
endChrType: PARENTHESIS_RIGHT,
shapeType: DELIMITER_SHAPE_MATH,
column: 1
};
delim.init(props);
var base2 = delim.getBase();
......@@ -3169,7 +3169,6 @@ CMathContent.prototype =
var eqqArray = iter.addMComponent(MATH_EQ_ARRAY);
props =
{
column: 1,
row: 2
};
eqqArray.init(props);
......@@ -3197,8 +3196,8 @@ CMathContent.prototype =
var delim = base.addMComponent(MATH_DELIMITER);
props =
{
begChr: {type: PARENTHESIS_LEFT},
endChr: {type: PARENTHESIS_RIGHT},
begChrType: PARENTHESIS_LEFT,
endChrType: PARENTHESIS_RIGHT,
shapeType: DELIMITER_SHAPE_MATH,
column: 1
};
......@@ -3239,8 +3238,8 @@ CMathContent.prototype =
};*/
var props =
{
begChr: {type: PARENTHESIS_LEFT},
endChr: {type: PARENTHESIS_RIGHT},
begChrType: PARENTHESIS_LEFT,
endChrType: PARENTHESIS_RIGHT,
shapeType: DELIMITER_SHAPE_MATH,
column: 1
};
......@@ -3251,8 +3250,8 @@ CMathContent.prototype =
var delim = this.addMComponent(MATH_DELIMITER);
var props =
{
begChr: {type: BRACKET_SQUARE_LEFT},
endChr: {type: BRACKET_SQUARE_RIGHT},
begChrType: BRACKET_SQUARE_LEFT,
endChrType: BRACKET_SQUARE_RIGHT,
shapeType: DELIMITER_SHAPE_MATH,
column: 1
};
......@@ -3263,8 +3262,8 @@ CMathContent.prototype =
var delim = this.addMComponent(MATH_DELIMITER);
var props =
{
begChr: {type: BRACKET_CURLY_LEFT},
endChr: {type: BRACKET_CURLY_RIGHT},
begChrType: BRACKET_CURLY_LEFT,
endChrType: BRACKET_CURLY_RIGHT,
shapeType: DELIMITER_SHAPE_MATH,
column: 1
};
......@@ -3275,8 +3274,8 @@ CMathContent.prototype =
var delim = this.addMComponent(MATH_DELIMITER);
var props =
{
begChr: {type: BRACKET_ANGLE_LEFT},
endChr: {type: BRACKET_ANGLE_RIGHT},
begChrType: BRACKET_ANGLE_LEFT,
endChrType: BRACKET_ANGLE_RIGHT,
shapeType: DELIMITER_SHAPE_MATH,
column: 1
};
......@@ -3287,8 +3286,8 @@ CMathContent.prototype =
var delim = this.addMComponent(MATH_DELIMITER);
var props =
{
begChr: {type: HALF_SQUARE_LEFT},
endChr: {type: HALF_SQUARE_RIGHT},
begChrType: HALF_SQUARE_LEFT,
endChrType: HALF_SQUARE_RIGHT,
shapeType: DELIMITER_SHAPE_MATH,
column: 1
};
......@@ -3299,8 +3298,8 @@ CMathContent.prototype =
var delim = this.addMComponent(MATH_DELIMITER);
var props =
{
begChr: {type: HALF_SQUARE_LEFT_UPPER},
endChr: {type: HALF_SQUARE_RIGHT_UPPER},
begChrType: HALF_SQUARE_LEFT_UPPER,
endChrType: HALF_SQUARE_RIGHT_UPPER,
shapeType: DELIMITER_SHAPE_MATH,
column: 1
};
......@@ -3311,8 +3310,8 @@ CMathContent.prototype =
var delim = this.addMComponent(MATH_DELIMITER);
var props =
{
begChr: {type: DELIMITER_LINE},
endChr: {type: DELIMITER_LINE},
begChrType: DELIMITER_LINE,
endChrType: DELIMITER_LINE,
shapeType: DELIMITER_SHAPE_MATH,
column: 1
};
......@@ -3323,8 +3322,8 @@ CMathContent.prototype =
var delim = this.addMComponent(MATH_DELIMITER);
var props =
{
begChr: {type: DELIMITER_DOUBLE_LINE},
endChr: {type: DELIMITER_DOUBLE_LINE},
begChrType: DELIMITER_DOUBLE_LINE,
endChrType: DELIMITER_DOUBLE_LINE,
shapeType: DELIMITER_SHAPE_MATH,
column: 1
};
......@@ -3335,8 +3334,8 @@ CMathContent.prototype =
var delim = this.addMComponent(MATH_DELIMITER);
var props =
{
begChr: {type: BRACKET_SQUARE_LEFT},
endChr: {type: BRACKET_SQUARE_LEFT},
begChrType: BRACKET_SQUARE_LEFT,
endChrType: BRACKET_SQUARE_LEFT,
shapeType: DELIMITER_SHAPE_MATH,
column: 1
};
......@@ -3347,8 +3346,8 @@ CMathContent.prototype =
var delim = this.addMComponent(MATH_DELIMITER);
var props =
{
begChr: {type: BRACKET_SQUARE_RIGHT},
endChr: {type: BRACKET_SQUARE_RIGHT},
begChrType: BRACKET_SQUARE_RIGHT,
endChrType: BRACKET_SQUARE_RIGHT,
shapeType: DELIMITER_SHAPE_MATH,
column: 1
};
......@@ -3359,8 +3358,8 @@ CMathContent.prototype =
var delim = this.addMComponent(MATH_DELIMITER);
var props =
{
begChr: {type: BRACKET_SQUARE_RIGHT},
endChr: {type: BRACKET_SQUARE_LEFT},
begChrType: BRACKET_SQUARE_RIGHT,
endChrType: BRACKET_SQUARE_LEFT,
shapeType: DELIMITER_SHAPE_MATH,
column: 1
};
......@@ -3371,8 +3370,8 @@ CMathContent.prototype =
var delim = this.addMComponent(MATH_DELIMITER);
var props =
{
begChr: {type: WHITE_SQUARE_LEFT},
endChr: {type: WHITE_SQUARE_RIGHT},
begChrType: WHITE_SQUARE_LEFT,
endChrType: WHITE_SQUARE_RIGHT,
shapeType: DELIMITER_SHAPE_MATH,
column: 1
};
......@@ -3381,7 +3380,7 @@ CMathContent.prototype =
break;
case 96:
var delim = this.addMComponent(MATH_DELIMITER);
/* var props =
/*var props =
{
begChr: {type: PARENTHESIS_LEFT},
sepChr: {type: BRACKET_ANGLE_LEFT},
......@@ -3390,9 +3389,9 @@ CMathContent.prototype =
};*/
var props =
{
begChr: {type: PARENTHESIS_LEFT},
sepChr: {type: DELIMITER_LINE},
endChr: {type: PARENTHESIS_RIGHT},
begChrType: PARENTHESIS_LEFT,
sepChrType: DELIMITER_LINE,
endChrType: PARENTHESIS_RIGHT,
shapeType: DELIMITER_SHAPE_MATH,
column: 2
};
......@@ -3403,9 +3402,9 @@ CMathContent.prototype =
var delim = this.addMComponent(MATH_DELIMITER);
var props =
{
begChr: {type: BRACKET_CURLY_LEFT},
sepChr: {type: DELIMITER_LINE},
endChr: {type: BRACKET_CURLY_RIGHT},
begChrType: BRACKET_CURLY_LEFT,
sepChrType: DELIMITER_LINE,
endChrType: BRACKET_CURLY_RIGHT,
shapeType: DELIMITER_SHAPE_MATH,
column: 2
};
......@@ -3417,9 +3416,9 @@ CMathContent.prototype =
var delim = this.addMComponent(MATH_DELIMITER);
var props =
{
begChr: {type: BRACKET_ANGLE_LEFT},
sepChr: {type: DELIMITER_LINE},
endChr: {type: BRACKET_ANGLE_RIGHT},
begChrType: BRACKET_ANGLE_LEFT,
sepChrType: DELIMITER_LINE,
endChrType: BRACKET_ANGLE_RIGHT,
shapeType: DELIMITER_SHAPE_MATH,
column: 2
};
......@@ -3430,9 +3429,9 @@ CMathContent.prototype =
var delim = this.addMComponent(MATH_DELIMITER);
var props =
{
begChr: {type: BRACKET_ANGLE_LEFT},
sepChr: {type: DELIMITER_LINE},
endChr: {type: BRACKET_ANGLE_RIGHT},
begChrType: BRACKET_ANGLE_LEFT,
sepChrType: DELIMITER_LINE,
endChrType: BRACKET_ANGLE_RIGHT,
shapeType: DELIMITER_SHAPE_MATH,
column: 3
};
......@@ -3443,7 +3442,7 @@ CMathContent.prototype =
var delim = this.addMComponent(MATH_DELIMITER);
var props =
{
begChr: {type: PARENTHESIS_LEFT},
begChrType: PARENTHESIS_LEFT,
shapeType: DELIMITER_SHAPE_MATH,
column: 1
};
......@@ -3454,7 +3453,7 @@ CMathContent.prototype =
var delim = this.addMComponent(MATH_DELIMITER);
var props =
{
endChr: {type: PARENTHESIS_RIGHT},
endChrType: PARENTHESIS_RIGHT,
shapeType: DELIMITER_SHAPE_MATH,
column: 1
};
......@@ -3465,7 +3464,7 @@ CMathContent.prototype =
var delim = this.addMComponent(MATH_DELIMITER);
var props =
{
begChr: {type: BRACKET_SQUARE_LEFT},
begChrType: BRACKET_SQUARE_LEFT,
shapeType: DELIMITER_SHAPE_MATH,
column: 1
};
......@@ -3476,7 +3475,7 @@ CMathContent.prototype =
var delim = this.addMComponent(MATH_DELIMITER);
var props =
{
endChr: {type: BRACKET_SQUARE_RIGHT},
endChrType: BRACKET_SQUARE_RIGHT,
shapeType: DELIMITER_SHAPE_MATH,
column: 1
};
......@@ -3487,7 +3486,7 @@ CMathContent.prototype =
var delim = this.addMComponent(MATH_DELIMITER);
var props =
{
begChr: {type: BRACKET_CURLY_LEFT},
begChrType: BRACKET_CURLY_LEFT,
shapeType: DELIMITER_SHAPE_MATH,
column: 1
};
......@@ -3498,7 +3497,7 @@ CMathContent.prototype =
var delim = this.addMComponent(MATH_DELIMITER);
var props =
{
endChr: {type: BRACKET_CURLY_RIGHT},
endChrType: BRACKET_CURLY_RIGHT,
shapeType: DELIMITER_SHAPE_MATH,
column: 1
};
......@@ -3509,7 +3508,7 @@ CMathContent.prototype =
var delim = this.addMComponent(MATH_DELIMITER);
var props =
{
begChr: {type: BRACKET_ANGLE_LEFT},
begChrType: BRACKET_ANGLE_LEFT,
shapeType: DELIMITER_SHAPE_MATH,
column: 1
};
......@@ -3520,7 +3519,7 @@ CMathContent.prototype =
var delim = this.addMComponent(MATH_DELIMITER);
var props =
{
endChr: {type: BRACKET_ANGLE_RIGHT},
endChrType: BRACKET_ANGLE_RIGHT,
shapeType: DELIMITER_SHAPE_MATH,
column: 1
};
......@@ -3531,7 +3530,7 @@ CMathContent.prototype =
var delim = this.addMComponent(MATH_DELIMITER);
var props =
{
begChr: {type: HALF_SQUARE_LEFT},
begChrType: HALF_SQUARE_LEFT,
shapeType: DELIMITER_SHAPE_MATH,
column: 1
};
......@@ -3542,7 +3541,7 @@ CMathContent.prototype =
var delim = this.addMComponent(MATH_DELIMITER);
var props =
{
endChr: {type: HALF_SQUARE_RIGHT},
endChrType: HALF_SQUARE_RIGHT,
shapeType: DELIMITER_SHAPE_MATH,
column: 1
};
......@@ -3553,7 +3552,7 @@ CMathContent.prototype =
var delim = this.addMComponent(MATH_DELIMITER);
var props =
{
begChr: {type: HALF_SQUARE_LEFT_UPPER},
begChrType: HALF_SQUARE_LEFT_UPPER,
shapeType: DELIMITER_SHAPE_MATH,
column: 1
};
......@@ -3564,7 +3563,7 @@ CMathContent.prototype =
var delim = this.addMComponent(MATH_DELIMITER);
var props =
{
endChr: {type: HALF_SQUARE_RIGHT_UPPER},
endChrType: HALF_SQUARE_RIGHT_UPPER,
shapeType: DELIMITER_SHAPE_MATH,
column: 1
};
......@@ -3575,7 +3574,7 @@ CMathContent.prototype =
var delim = this.addMComponent(MATH_DELIMITER);
var props =
{
begChr: {type: DELIMITER_LINE},
begChrType: DELIMITER_LINE,
shapeType: DELIMITER_SHAPE_MATH,
column: 1
};
......@@ -3586,7 +3585,7 @@ CMathContent.prototype =
var delim = this.addMComponent(MATH_DELIMITER);
var props =
{
endChr: {type: DELIMITER_LINE},
endChrType: DELIMITER_LINE,
shapeType: DELIMITER_SHAPE_MATH,
column: 1
};
......@@ -3597,7 +3596,7 @@ CMathContent.prototype =
var delim = this.addMComponent(MATH_DELIMITER);
var props =
{
begChr: {type: DELIMITER_DOUBLE_LINE},
begChrType: DELIMITER_DOUBLE_LINE,
shapeType: DELIMITER_SHAPE_MATH,
column: 1
};
......@@ -3608,7 +3607,7 @@ CMathContent.prototype =
var delim = this.addMComponent(MATH_DELIMITER);
var props =
{
endChr: {type: DELIMITER_DOUBLE_LINE},
endChrType: DELIMITER_DOUBLE_LINE,
shapeType: DELIMITER_SHAPE_MATH,
column: 1
};
......@@ -3619,7 +3618,7 @@ CMathContent.prototype =
var delim = this.addMComponent(MATH_DELIMITER);
var props =
{
begChr: {type: WHITE_SQUARE_LEFT},
begChrType: WHITE_SQUARE_LEFT,
shapeType: DELIMITER_SHAPE_MATH,
column: 1
};
......@@ -3630,7 +3629,7 @@ CMathContent.prototype =
var delim = this.addMComponent(MATH_DELIMITER);
var props =
{
endChr: {type: WHITE_SQUARE_RIGHT},
endChrType: WHITE_SQUARE_RIGHT,
shapeType: DELIMITER_SHAPE_MATH,
column: 1
};
......@@ -3641,7 +3640,7 @@ CMathContent.prototype =
var delim = this.addMComponent(MATH_DELIMITER);
var props =
{
begChr: {type: BRACKET_CURLY_LEFT},
begChrType: BRACKET_CURLY_LEFT,
shapeType: DELIMITER_SHAPE_MATH,
column: 1
};
......@@ -3660,7 +3659,7 @@ CMathContent.prototype =
var delim = this.addMComponent(MATH_DELIMITER);
var props =
{
begChr: {type: BRACKET_CURLY_LEFT},
begChrType: BRACKET_CURLY_LEFT,
shapeType: DELIMITER_SHAPE_MATH,
column: 1
};
......@@ -3684,8 +3683,8 @@ CMathContent.prototype =
var delim = this.addMComponent(MATH_DELIMITER);
var props =
{
begChr: {type: PARENTHESIS_LEFT},
endChr: {type: PARENTHESIS_RIGHT},
begChrType: PARENTHESIS_LEFT,
endChrType: PARENTHESIS_RIGHT,
shapeType: DELIMITER_SHAPE_MATH,
column: 1
};
......@@ -3696,13 +3695,44 @@ CMathContent.prototype =
fract.fillPlaceholders();
break;
case 122:
this.addTxt("f");
var delim = this.addMComponent(MATH_DELIMITER);
var props =
{
begChrType: PARENTHESIS_LEFT,
endChrType: PARENTHESIS_RIGHT,
column: 1
};
delim.init(props);
var base = delim.getBase();
base.addTxt("x");
this.addTxt("=");
var bracket = this.addMComponent(MATH_DELIMITER);
props =
{
begChrType: BRACKET_CURLY_LEFT,
column: 1
};
bracket.init(props);
var base2 = bracket.getBase();
var eqArr = base2.addMComponent(MATH_EQ_ARRAY);
props =
{
row: 2
};
eqArr.init(props);
var firstRow = eqArr.getElement(0, 0);
firstRow.addTxt("-x, x<0");
var secRow = eqArr.getElement(1, 0);
secRow.addTxt(" x, x≥0");
break;
case 123:
var delim = this.addMComponent(MATH_DELIMITER);
var props =
{
begChr: {type: PARENTHESIS_LEFT},
endChr: {type: PARENTHESIS_RIGHT},
begChrType: PARENTHESIS_LEFT,
endChrType: PARENTHESIS_RIGHT,
shapeType: DELIMITER_SHAPE_MATH,
column: 1
};
......@@ -3720,8 +3750,8 @@ CMathContent.prototype =
var delim = this.addMComponent(MATH_DELIMITER);
var props =
{
begChr: {type: BRACKET_ANGLE_LEFT},
endChr: {type: BRACKET_ANGLE_RIGHT},
begChrType: BRACKET_ANGLE_LEFT,
endChrType: BRACKET_ANGLE_RIGHT,
shapeType: DELIMITER_SHAPE_MATH,
column: 1
};
......@@ -4401,8 +4431,8 @@ CMathContent.prototype =
var delim = base.addMComponent(MATH_DELIMITER);
props =
{
begChr: {type: PARENTHESIS_LEFT},
endChr: {type: PARENTHESIS_RIGHT},
begChrType: PARENTHESIS_LEFT,
endChrType: PARENTHESIS_RIGHT,
shapeType: DELIMITER_SHAPE_MATH,
column: 1
};
......@@ -4807,7 +4837,6 @@ CMathContent.prototype =
break;
case 222:
var matrix = this.addMComponent(21);
var matrix = this.addMComponent(MATH_MATRIX);
var props =
{
......@@ -4845,43 +4874,98 @@ CMathContent.prototype =
elem9.addTxt("1");
break;
case 223:
var delim = this.addMComponent(9);
delim.init(0, 4, 0, 1);
base = delim.getBase();
var matrix = base.addMComponent(21);
matrix.init(2, 2);
var delim = this.addMComponent(MATH_DELIMITER);
var props =
{
begChrType: PARENTHESIS_LEFT,
endChrType: PARENTHESIS_RIGHT,
column: 1
};
delim.init(props);
var base = delim.getBase();
var matrix = base.addMComponent(MATH_MATRIX);
props =
{
row : 2,
column: 2
};
matrix.init(props);
matrix.fillPlaceholders();
break;
case 224:
var delim = this.addMComponent(9);
delim.init(2, 4, 0, 1);
base = delim.getBase();
var matrix = base.addMComponent(21);
matrix.init(2, 2);
var delim = this.addMComponent(MATH_DELIMITER);
var props =
{
begChrType: BRACKET_SQUARE_LEFT,
endChrType: BRACKET_SQUARE_RIGHT,
column: 1
};
delim.init(props);
var base = delim.getBase();
var matrix = base.addMComponent(MATH_MATRIX);
props =
{
row : 2,
column: 2
};
matrix.init(props);
matrix.fillPlaceholders();
break;
case 225:
var delim = this.addMComponent(9);
delim.init(5, 4, 0, 1);
base = delim.getBase();
var matrix = base.addMComponent(21);
matrix.init(2, 2);
var delim = this.addMComponent(MATH_DELIMITER);
var props =
{
begChrType: DELIMITER_LINE,
endChrType: DELIMITER_LINE,
column: 1
};
delim.init(props);
var base = delim.getBase();
var matrix = base.addMComponent(MATH_MATRIX);
props =
{
row : 2,
column: 2
};
matrix.init(props);
matrix.fillPlaceholders();
break;
case 226:
var delim = this.addMComponent(9);
delim.init(6, 4, 0, 1);
base = delim.getBase();
var matrix = base.addMComponent(21);
matrix.init(2, 2);
var delim = this.addMComponent(MATH_DELIMITER);
var props =
{
begChrType: DELIMITER_DOUBLE_LINE,
endChrType: DELIMITER_DOUBLE_LINE,
column: 1
};
delim.init(props);
var base = delim.getBase();
var matrix = base.addMComponent(MATH_MATRIX);
props =
{
row : 2,
column: 2
};
matrix.init(props);
matrix.fillPlaceholders();
break;
case 227:
var delim = this.addMComponent(9);
delim.init(0, 4, 0, 1);
base = delim.getBase();
var matrix = base.addMComponent(21);
matrix.init(3, 3);
var delim = this.addMComponent(MATH_DELIMITER);
var props =
{
begChrType: PARENTHESIS_LEFT,
endChrType: PARENTHESIS_RIGHT,
column: 1
};
delim.init(props);
var base = delim.getBase();
var matrix = base.addMComponent(MATH_MATRIX);
props =
{
row : 3,
column: 3
};
matrix.init(props);
elem1 = matrix.getElement(0,0);
elem1.fillPlaceholders();
......@@ -4912,11 +4996,22 @@ CMathContent.prototype =
break;
case 228:
var delim = this.addMComponent(9);
delim.init(2, 4, 0, 1);
base = delim.getBase();
var matrix = base.addMComponent(21);
matrix.init(3, 3);
var delim = this.addMComponent(MATH_DELIMITER);
var props =
{
begChrType: BRACKET_SQUARE_LEFT,
endChrType: BRACKET_SQUARE_RIGHT,
column: 1
};
delim.init(props);
var base = delim.getBase();
var matrix = base.addMComponent(MATH_MATRIX);
props =
{
row : 3,
column: 3
};
matrix.init(props);
elem1 = matrix.getElement(0,0);
elem1.fillPlaceholders();
......
......@@ -72,11 +72,9 @@ var BRACKET_CURLY_BOTTOM = 17;
var ARROW_LEFT = 18;
var ARROW_RIGHT = 19;
var ARROW_LR = 20;
var HALF_ARROW_LEFT = 21;
var HALF_ARROW_RIGHT = 22;
var DOUBLE_LEFT_ARROW = 23;
var DOUBLE_RIGHT_ARROW = 24;
var DOUBLE_ARROW_LR = 25;
var DOUBLE_LEFT_ARROW = 21;
var DOUBLE_RIGHT_ARROW = 22;
var DOUBLE_ARROW_LR = 23;
var TURN_0 = 0;
var TURN_180 = 1;
......
......@@ -462,7 +462,7 @@ CEqArray.prototype.init = function(props)
{
var prps =
{
column: props.column,
column: 1,
row: props.row,
baseJc: "center",
rSpRule: 4,
......
......@@ -1006,454 +1006,160 @@ old_CDelimiter.prototype.Resize = function()
this.recalculateSize();
}
function GetGlyph(chr, location)
/*function CBaseDelimiter()
{
var operator;
// location
if(chr == null || typeof(chr) == "undefined")
operator = -1;
else if( chr.value === "(" || chr.type === PARENTHESIS_LEFT)
{
operator = new COperatorParenthesis();
var props =
{
location: location,
turn: TURN_0
};
operator.init(props);
}
else if( chr.value === ")" || chr.type === PARENTHESIS_RIGHT)
//-1 - absence
// 0 - up
// 1 - down
// 2 - left
// 3 - right
// 4 - left/right
// 5 - up/down
this.begOper = null;
this.endOper = null;
//this.base = null;
CMathBase.call(this);
}
extend(CBaseDelimiter, CMathBase);
CBaseDelimiter.prototype.init = function(props)
{
if(props.grow == "1" || props.grow == true)
this.grow = true;
else if(props.grow == "0" || props.grow == false)
this.grow = false;
else
this.grow = true;
this.begOper = this.getOperator(props.begChr);
this.endOper = this.getOperator(props.endChr);
}
CBaseDelimiter.prototype.init_2 = function(params, base)
{
this.type = params.type;
this.loc = params.loc;
this.base = base;
var nRow, nCol,
tturn1, tturn2;
if(this.loc== 0)
{
operator = new COperatorParenthesis();
var props =
{
location: location,
turn: TURN_180
};
operator.init(props);
nRow = 2;
nCol = 1;
tturn1 = params.turn1;
}
else if( chr.value == "{" || chr.type === BRACKET_CURLY_LEFT)
else if(this.loc == 1)
{
operator = new COperatorBracket();
var props =
{
location: location,
turn: TURN_0
};
operator.init(props);
nRow = 2;
nCol = 1;
tturn2 = params.turn1;
}
else if( chr.value === "}" || chr.type === BRACKET_CURLY_RIGHT)
else if(this.loc == 2)
{
operator = new COperatorBracket();
var props =
{
location: location,
turn: TURN_180
};
operator.init(props);
nRow = 1;
nCol = 2;
tturn1 = params.turn1;
}
else if( chr.value === "[" || chr.type === BRACKET_SQUARE_LEFT)
else if(this.loc == 3)
{
operator = new CSquareBracket();
var props =
{
location: location,
turn: TURN_0
};
operator.init(props);
nRow = 1;
nCol = 2;
tturn2 = params.turn1;
}
else if( chr.value === "]" || chr.type === BRACKET_SQUARE_RIGHT)
else if(this.loc == 4)
{
operator = new CSquareBracket();
var props =
{
location: location,
turn: TURN_180
};
operator.init(props);
nRow = 1;
nCol = 3;
tturn1 = params.turn1;
tturn2 = params.turn2;
}
else if( chr.value === "<" || chr.type === BRACKET_ANGLE_LEFT)
else
{
operator = new COperatorAngleBracket();
var props =
{
location: location,
//location: DELIMITER_LOCATION_LEFT,
turn: TURN_0
};
operator.init(props);
nRow = 3;
nCol = 1;
tturn1 = params.turn1;
tturn2 = params.turn2;
}
else if( chr.value === ">" || chr.type === BRACKET_ANGLE_RIGHT)
this.setDimension(nRow, nCol);
var operator1, operator2,
loc1, loc2;
if(this.loc == 0)
loc1 = 0;
else if(this.loc == 1)
loc2 = 1;
else if(this.loc == 2)
loc1 = 2;
else if(this.loc == 3)
loc2 = 3;
else if(this.loc == 4)
{
operator = new COperatorAngleBracket();
var props =
{
//location: DELIMITER_LOCATION_RIGHT,
location: location,
turn: TURN_180
};
operator.init(props);
loc1 = 2;
loc2 = 3;
}
else if(chr.value === "|" || chr.type === DELIMITER_LINE)
else
{
operator = new COperatorLine();
var props =
{
location: location,
//location: DELIMITER_LOCATION_LEFT,
turn: TURN_0
};
operator.init(props);
loc1 = 0;
loc2 = 1;
}
else if(chr.value === "" || chr.type === HALF_SQUARE_LEFT)
if(this.type == 0)
{
operator = new CHalfSquareBracket();
var props =
{
//location: DELIMITER_LOCATION_LEFT,
location: location,
turn: TURN_0
};
operator.init(props);
operator1 = new COperatorParenthesis();
operator2 = new COperatorParenthesis();
}
else if(chr.value === "" || chr.type == HALF_SQUARE_RIGHT)
else if(this.type == 1)
{
operator = new CHalfSquareBracket();
var props =
{
//location: DELIMITER_LOCATION_LEFT,
location: location,
turn: TURN_180
};
operator.init(props);
operator1 = new COperatorBracket();
operator2 = new COperatorBracket();
}
else if(chr.value === "" || chr.type == HALF_SQUARE_LEFT_UPPER)
else if(this.type == 2)
{
operator = new CHalfSquareBracket();
var props =
{
//location: DELIMITER_LOCATION_LEFT,
location: location,
turn: TURN_MIRROR_0
};
operator.init(props);
operator1 = new CSquareBracket();
operator2 = new CSquareBracket();
}
else if(chr.value === "" || chr.type == HALF_SQUARE_RIGHT_UPPER)
else if(this.type == 3)
{
operator = new CHalfSquareBracket();
var props =
{
//location: DELIMITER_LOCATION_LEFT,
location: location,
turn: TURN_MIRROR_180
};
operator.init(props);
operator1 = new COperatorAngleBracket();
operator2 = new COperatorAngleBracket();
}
else if(chr.value === "" || chr.type == DELIMITER_DOUBLE_LINE)
else if(this.type == 4)
{
operator = new COperatorDoubleLine();
var props =
{
location: location,
//location: DELIMITER_LOCATION_LEFT,
turn: TURN_0
};
operator.init(props);
operator1 = new CHalfSquareBracket();
operator2 = new CHalfSquareBracket();
}
else if(chr.value === "" || chr.type == WHITE_SQUARE_LEFT)
else if(this.type == 5)
{
operator = new CWhiteSquareBracket();
var props =
{
//location: DELIMITER_LOCATION_LEFT,
location: location,
turn: TURN_0
};
operator.init(props);
operator1 = new COperatorLine();
operator2 = new COperatorLine();
}
else if(chr.value === "" || chr.type == WHITE_SQUARE_RIGHT)
else if(this.type == 6)
{
operator = new CWhiteSquareBracket();
var props =
{
//location: DELIMITER_LOCATION_LEFT,
location: location,
turn: TURN_180
};
operator.init(props);
operator1 = new COperatorDoubleLine();
operator2 = new COperatorDoubleLine();
}
else if( chr.value === "" || chr.type === BRACKET_EMPTY)
operator = -1;
else
{
operator = new CMathText();
operator.add(chr.value.charCodeAt(0));
operator1 = new CWhiteSquareBracket();
operator2 = new CWhiteSquareBracket();
}
return operator;
}
function GetGlyph_GrChr(chr, location)
{
var operator;
if(typeof(chr) === "undefined" ||chr === null)
{
{
operator = new COperatorBracket();
var props =
{
location: LOCATION_BOT,
turn: TURN_MIRROR_0
};
operator.init(props);
}
}
else if(chr.value === "" || chr.type == BRACKET_CURLY_TOP)
{
operator = new COperatorBracket();
var props =
{
location: location,
turn: TURN_0
};
operator.init(props);
}
else if(chr.value === "" || chr.type === BRACKET_CURLY_BOTTOM )
{
operator = new COperatorBracket();
var props =
{
location: location,
turn: TURN_MIRROR_0
};
operator.init(props);
}
else if(chr.value === "" || chr.type === ARROW_LEFT)
{
operator = new CSingleArrow();
var props =
{
location: location,
turn: TURN_0
};
operator.init(props);
}
else if(chr.value === "" || chr.type === ARROW_RIGHT)
{
operator = new CSingleArrow();
var props =
{
location: location,
turn: TURN_180
};
operator.init(props);
}
else if(chr.value === "" || chr.type === ARROW_LR)
{
operator = new CLeftRightArrow();
var props =
{
location: location,
turn: TURN_0
};
operator.init(props);
}
else if(chr.value === "" || chr.type === HALF_ARROW_LEFT)
{
operator = new CCombiningHalfArrow();
var props =
{
location: location,
turn: TURN_0
};
operator.init(props);
}
else if(chr.value === "" || chr.type === HALF_ARROW_RIGHT)
{
operator = new CCombiningHalfArrow();
var props =
{
location: location,
turn: TURN_180
};
operator.init(props);
}
else
{
operator = new CMathText();
operator.add(chr.value.charCodeAt(0));
}
return operator;
}
function CBaseDelimiter()
{
// location
//-1 - absence
// 0 - up
// 1 - down
// 2 - left
// 3 - right
// 4 - left/right
// 5 - up/down
this.begOper = null;
this.endOper = null;
//this.base = null;
CMathBase.call(this);
}
extend(CBaseDelimiter, CMathBase);
CBaseDelimiter.prototype.init = function(props)
{
if(props.grow == "1" || props.grow == true)
this.grow = true;
else if(props.grow == "0" || props.grow == false)
this.grow = false;
else
this.grow = true;
this.begOper = this.getOperator(props.begChr);
this.endOper = this.getOperator(props.endChr);
/*var base = new CMathContent();
var params =
{
type: type,
loc: loc,
turn1: turn1,
turn2: turn2
};
this.init_2(params, base);*/
}
CBaseDelimiter.prototype.init_2 = function(params, base)
{
this.type = params.type;
this.loc = params.loc;
this.base = base;
var nRow, nCol,
tturn1, tturn2;
if(this.loc== 0)
{
nRow = 2;
nCol = 1;
tturn1 = params.turn1;
}
else if(this.loc == 1)
{
nRow = 2;
nCol = 1;
tturn2 = params.turn1;
}
else if(this.loc == 2)
{
nRow = 1;
nCol = 2;
tturn1 = params.turn1;
}
else if(this.loc == 3)
{
nRow = 1;
nCol = 2;
tturn2 = params.turn1;
}
else if(this.loc == 4)
{
nRow = 1;
nCol = 3;
tturn1 = params.turn1;
tturn2 = params.turn2;
}
else
{
nRow = 3;
nCol = 1;
tturn1 = params.turn1;
tturn2 = params.turn2;
}
this.setDimension(nRow, nCol);
var operator1, operator2,
loc1, loc2;
if(this.loc == 0)
loc1 = 0;
else if(this.loc == 1)
loc2 = 1;
else if(this.loc == 2)
loc1 = 2;
else if(this.loc == 3)
loc2 = 3;
else if(this.loc == 4)
{
loc1 = 2;
loc2 = 3;
}
else
{
loc1 = 0;
loc2 = 1;
}
if(this.type == 0)
{
operator1 = new COperatorParenthesis();
operator2 = new COperatorParenthesis();
}
else if(this.type == 1)
{
operator1 = new COperatorBracket();
operator2 = new COperatorBracket();
}
else if(this.type == 2)
{
operator1 = new CSquareBracket();
operator2 = new CSquareBracket();
}
else if(this.type == 3)
{
operator1 = new COperatorAngleBracket();
operator2 = new COperatorAngleBracket();
}
else if(this.type == 4)
{
operator1 = new CHalfSquareBracket();
operator2 = new CHalfSquareBracket();
}
else if(this.type == 5)
{
operator1 = new COperatorLine();
operator2 = new COperatorLine();
}
else if(this.type == 6)
{
operator1 = new COperatorDoubleLine();
operator2 = new COperatorDoubleLine();
}
else
{
operator1 = new CWhiteSquareBracket();
operator2 = new CWhiteSquareBracket();
}
operator1.setLocation(loc1, tturn1);
operator1.relate(this);
operator2.setLocation(loc2, tturn2);
operator2.relate(this);
operator1.setLocation(loc1, tturn1);
operator1.relate(this);
operator2.setLocation(loc2, tturn2);
operator2.relate(this);
if(this.loc == 0 || this.loc == 2)
......@@ -1662,7 +1368,7 @@ CBaseDelimiter.prototype.getOperator = function(chr)
operator = -1;
return operator;
}
}*/
function COperatorBracket()
......@@ -2658,7 +2364,8 @@ COperatorAngleBracket.prototype.calcCoord = function(measure)
hh2 = X[1] - X[2],
hh3 = X[3] - X[2],
hh4 = X[0] - X[1],
HH = augm*(X[0] - X[2]);
//HH = augm*(X[0] - X[2]);
HH = augm*X[5]/2;
var k2 = (HH - hh1)/hh3,
k3 = (HH - hh2)/hh4;
......@@ -4014,12 +3721,123 @@ old_CSeparator.prototype.drawHorLine = function()
MathControl.pGraph.SetIntegerGrid(intGrid);
}
function CSeparator()
function COperator(glyph)
{
this.glyph = glyph;
this.pos = null;
this.coordGlyph = null;
this.size = {width: 0, height: 0};
}
COperator.prototype.draw = function()
{
if(this.glyph !== -1)
{
var lng = this.coordGlyph.XX.length;
var X = new Array(),
Y = new Array();
for(var j = 0; j < lng; j++)
{
X.push(this.pos.x + this.coordGlyph.XX[j]);
Y.push(this.pos.y + this.coordGlyph.YY[j]);
}
this.glyph.draw(X, Y);
}
}
extend(CSeparator, CMathBase);
COperator.prototype.fixSize = function(measure)
{
if(this.glyph !== -1)
{
this.glyph.fixSize(measure);
var dims = this.glyph.getCoordinateGlyph();
this.coordGlyph = {XX: dims.XX, YY: dims.YY};
var width, height;
if(this.glyph.loc == 0 || this.glyph.loc == 1)
{
//width = measure > this.glyph.size.width ? measure : this.glyph.size.width;
width = dims.Width;
height = this.glyph.size.height;
}
else
{
width = this.glyph.size.width;
//height = measure > this.glyph.size.height ? measure : this.glyph.size.height;
height = dims.Height;
//height = dims.Height > measure ? measure : dims.Height;
}
var betta = this.TxtPrp.FontSize/36;
var center = height/2 + 0.2*betta;
this.size = { width: width, height: height, center: center};
}
}
COperator.prototype.setPosition = function(pos)
{
this.pos = pos;
}
COperator.prototype.IsJustDraw = function()
{
return true;
}
COperator.prototype.Resize = function()
{
if(this.glyph !== -1)
{
var bHor = this.glyph.loc == 0 || this.glyph.loc == 1;
if(bHor)
this.fixSize(this.size.width);
else
this.fixSize(this.size.height);
}
}
COperator.prototype.relate = function(parent)
{
this.Parent = parent;
}
COperator.prototype.setTxtPrp = function(txtPrp)
{
this.TxtPrp = txtPrp;
if(this.glyph !== -1)
this.glyph.setTxtPrp(txtPrp);
}
function CSeparator(glyph)
{
COperator.call(this, glyph);
}
extend(CSeparator, COperator);
CSeparator.prototype.draw = function()
{
if(this.glyph !== -1)
{
var lng = this.coordGlyph.XX.length;
for(var i = 0; i < this.positions.length; i++)
{
var X = new Array(),
Y = new Array();
for(var j = 0; j < lng; j++)
{
X.push(this.positions[i].x + this.coordGlyph.XX[j]);
Y.push(this.positions[i].y + this.coordGlyph.YY[j]);
}
this.glyph.draw(X, Y);
}
}
}
CSeparator.prototype.setPosition = function(pos)
{
this.positions = pos;
}
function CDelimiter()
{
......@@ -4040,9 +3858,14 @@ CDelimiter.prototype.init = function(props)
else
this.grow = true;
this.begOper = new COperator ( GetGlyph(props.begChr, LOCATION_LEFT) );
this.endOper = new COperator ( GetGlyph(props.endChr, LOCATION_RIGHT) );
this.sepOper = new COperator ( GetGlyph(props.sepChr, LOCATION_SEP) );
var begGlyph = this.getGlyph(props.begChr, props.begChrType, LOCATION_LEFT);
this.begOper = new COperator (begGlyph);
var endGlyph = this.getGlyph(props.endChr, props.endChrType, LOCATION_RIGHT);
this.endOper = new COperator ( endGlyph );
var sepGlyph = this.getGlyph(props.sepChr, props.sepChrType, LOCATION_SEP);
this.sepOper = new CSeparator (sepGlyph);
var tPrp = this.getTxtPrp();
this.begOper.setTxtPrp(tPrp);
......@@ -4328,116 +4151,290 @@ CDelimiter.prototype.getBase = function(numb)
return this.elements[0][numb];
}
function COperator(glyph)
CDelimiter.prototype.getGlyph = function(chr, type, location)
{
this.glyph = glyph;
var operator;
var code = typeof(chr) === "string" ? chr.charCodeAt(0) : null;
this.pos = null;
this.coordGlyph = null;
this.size = {width: 0, height: 0};
}
COperator.prototype.draw = function()
{
/*if(this.glyph !== -1)
if( code === 0x28 || type === PARENTHESIS_LEFT)
{
var lng = this.coordGlyph.XX.length;
for(var i = 0; i < this.positions.length; i++)
operator = new COperatorParenthesis();
var props =
{
var X = new Array(),
Y = new Array();
for(var j = 0; j < lng; j++)
{
X.push(this.positions[i].x + this.coordGlyph.XX[j]);
Y.push(this.positions[i].y + this.coordGlyph.YY[j]);
}
this.glyph.draw(X, Y);
}
}*/
if(this.glyph !== -1)
location: location,
turn: TURN_0
};
operator.init(props);
}
else if( code === 0x29 || type === PARENTHESIS_RIGHT)
{
var lng = this.coordGlyph.XX.length;
var X = new Array(),
Y = new Array();
for(var j = 0; j < lng; j++)
{
X.push(this.pos.x + this.coordGlyph.XX[j]);
Y.push(this.pos.y + this.coordGlyph.YY[j]);
}
this.glyph.draw(X, Y);
operator = new COperatorParenthesis();
var props =
{
location: location,
turn: TURN_180
};
operator.init(props);
}
else if( code == 0x7B || type === BRACKET_CURLY_LEFT)
{
operator = new COperatorBracket();
var props =
{
location: location,
turn: TURN_0
};
operator.init(props);
}
else if( code === 0x7D || type === BRACKET_CURLY_RIGHT)
{
operator = new COperatorBracket();
var props =
{
location: location,
turn: TURN_180
};
operator.init(props);
}
else if( code === 0x5B || type === BRACKET_SQUARE_LEFT)
{
operator = new CSquareBracket();
var props =
{
location: location,
turn: TURN_0
};
operator.init(props);
}
else if( code === 0x5D || type === BRACKET_SQUARE_RIGHT)
{
operator = new CSquareBracket();
var props =
{
location: location,
turn: TURN_180
};
operator.init(props);
}
else if( code === 0x3C || type === BRACKET_ANGLE_LEFT)
{
operator = new COperatorAngleBracket();
var props =
{
location: location,
//location: DELIMITER_LOCATION_LEFT,
turn: TURN_0
};
operator.init(props);
}
else if( code === 0x3E || type === BRACKET_ANGLE_RIGHT)
{
operator = new COperatorAngleBracket();
var props =
{
//location: DELIMITER_LOCATION_RIGHT,
location: location,
turn: TURN_180
};
operator.init(props);
}
else if(code === 0x7C || type === DELIMITER_LINE)
{
operator = new COperatorLine();
var props =
{
location: location,
//location: DELIMITER_LOCATION_LEFT,
turn: TURN_0
};
operator.init(props);
}
else if(code === 0x230A || type === HALF_SQUARE_LEFT)
{
operator = new CHalfSquareBracket();
var props =
{
//location: DELIMITER_LOCATION_LEFT,
location: location,
turn: TURN_0
};
operator.init(props);
}
else if(code === 0x230B || type == HALF_SQUARE_RIGHT)
{
operator = new CHalfSquareBracket();
var props =
{
//location: DELIMITER_LOCATION_LEFT,
location: location,
turn: TURN_180
};
operator.init(props);
}
else if(code === 0x2308 || type == HALF_SQUARE_LEFT_UPPER)
{
operator = new CHalfSquareBracket();
var props =
{
//location: DELIMITER_LOCATION_LEFT,
location: location,
turn: TURN_MIRROR_0
};
operator.init(props);
}
else if(code === 0x2309 || type == HALF_SQUARE_RIGHT_UPPER)
{
operator = new CHalfSquareBracket();
var props =
{
//location: DELIMITER_LOCATION_LEFT,
location: location,
turn: TURN_MIRROR_180
};
operator.init(props);
}
else if(code === 0x2016 || type == DELIMITER_DOUBLE_LINE)
{
operator = new COperatorDoubleLine();
var props =
{
location: location,
//location: DELIMITER_LOCATION_LEFT,
turn: TURN_0
};
operator.init(props);
}
else if(code === 0x27E6 || type == WHITE_SQUARE_LEFT)
{
operator = new CWhiteSquareBracket();
var props =
{
//location: DELIMITER_LOCATION_LEFT,
location: location,
turn: TURN_0
};
operator.init(props);
}
else if(code === 0x27E7 || type == WHITE_SQUARE_RIGHT)
{
operator = new CWhiteSquareBracket();
var props =
{
//location: DELIMITER_LOCATION_LEFT,
location: location,
turn: TURN_180
};
operator.init(props);
}
else if( code === "" || type === BRACKET_EMPTY)
operator = -1;
else if(code !== null)
{
operator = new CMathText();
operator.add(code.charCodeAt(0));
}
else
operator = -1;
return operator;
}
COperator.prototype.fixSize = function(measure)
{
if(this.glyph !== -1)
{
this.glyph.fixSize(measure);
var dims = this.glyph.getCoordinateGlyph();
this.coordGlyph = {XX: dims.XX, YY: dims.YY};
var width, height;
/*function GetGlyph_GrChr(chr, location)
{
var operator;
if(this.glyph.loc == 0 || this.glyph.loc == 1)
if(typeof(chr) === "undefined" ||chr === null)
{
{
//width = measure > this.glyph.size.width ? measure : this.glyph.size.width;
width = dims.Width;
height = this.glyph.size.height;
operator = new COperatorBracket();
var props =
{
location: LOCATION_BOT,
turn: TURN_MIRROR_0
};
operator.init(props);
}
else
}
else if(chr.value === "⏞" || chr.type == BRACKET_CURLY_TOP)
{
operator = new COperatorBracket();
var props =
{
width = this.glyph.size.width;
//height = measure > this.glyph.size.height ? measure : this.glyph.size.height;
//height = dims.Height;
height = dims.Height > measure ? measure : dims.Height;
}
var betta = this.TxtPrp.FontSize/36;
var center = height/2 + 0.2*betta;
this.size = { width: width, height: height, center: center};
location: location,
turn: TURN_0
};
operator.init(props);
}
}
COperator.prototype.setPosition = function(pos)
{
this.pos = pos;
//this.positions = positions;
}
COperator.prototype.IsJustDraw = function()
{
return true;
}
COperator.prototype.Resize = function()
{
if(this.glyph !== -1)
else if(chr.value === "⏟" || chr.type === BRACKET_CURLY_BOTTOM )
{
var bHor = this.glyph.loc == 0 || this.glyph.loc == 1;
if(bHor)
this.fixSize(this.size.width);
else
this.fixSize(this.size.height);
operator = new COperatorBracket();
var props =
{
location: location,
turn: TURN_MIRROR_0
};
operator.init(props);
}
else if(chr.value === "⃖" || chr.type === ARROW_LEFT)
{
operator = new CSingleArrow();
var props =
{
location: location,
turn: TURN_0
};
operator.init(props);
}
else if(chr.value === "⃗" || chr.type === ARROW_RIGHT)
{
operator = new CSingleArrow();
var props =
{
location: location,
turn: TURN_180
};
operator.init(props);
}
else if(chr.value === "⃡" || chr.type === ARROW_LR)
{
operator = new CLeftRightArrow();
var props =
{
location: location,
turn: TURN_0
};
operator.init(props);
}
else if(chr.value === "⃐" || chr.type === HALF_ARROW_LEFT)
{
operator = new CCombiningHalfArrow();
var props =
{
location: location,
turn: TURN_0
};
operator.init(props);
}
else if(chr.value === "⃑" || chr.type === HALF_ARROW_RIGHT)
{
operator = new CCombiningHalfArrow();
var props =
{
location: location,
turn: TURN_180
};
operator.init(props);
}
else
{
operator = new CMathText();
operator.add(chr.value.charCodeAt(0));
}
}
COperator.prototype.relate = function(parent)
{
this.Parent = parent;
}
COperator.prototype.setTxtPrp = function(txtPrp)
{
this.TxtPrp = txtPrp;
if(this.glyph !== -1)
this.glyph.setTxtPrp(txtPrp);
}
return operator;
}*/
function old_CGroupCharacter()
{
this.operator = null;
......
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