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,8 +3085,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
......@@ -3156,8 +3156,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
};
......@@ -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,700 +1006,406 @@ 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 =
//-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)
{
location: location,
turn: TURN_0
};
operator.init(props);
nRow = 2;
nCol = 1;
tturn1 = params.turn1;
}
else if( chr.value === ")" || chr.type === PARENTHESIS_RIGHT)
{
operator = new COperatorParenthesis();
var props =
else if(this.loc == 1)
{
location: location,
turn: TURN_180
};
operator.init(props);
nRow = 2;
nCol = 1;
tturn2 = params.turn1;
}
else if( chr.value == "{" || chr.type === BRACKET_CURLY_LEFT)
{
operator = new COperatorBracket();
var props =
else if(this.loc == 2)
{
location: location,
turn: TURN_0
};
operator.init(props);
nRow = 1;
nCol = 2;
tturn1 = params.turn1;
}
else if( chr.value === "}" || chr.type === BRACKET_CURLY_RIGHT)
{
operator = new COperatorBracket();
var props =
else if(this.loc == 3)
{
location: location,
turn: TURN_180
};
operator.init(props);
nRow = 1;
nCol = 2;
tturn2 = params.turn1;
}
else if( chr.value === "[" || chr.type === BRACKET_SQUARE_LEFT)
{
operator = new CSquareBracket();
var props =
else if(this.loc == 4)
{
location: location,
turn: TURN_0
};
operator.init(props);
nRow = 1;
nCol = 3;
tturn1 = params.turn1;
tturn2 = params.turn2;
}
else if( chr.value === "]" || chr.type === BRACKET_SQUARE_RIGHT)
{
operator = new CSquareBracket();
var props =
else
{
location: location,
turn: TURN_180
};
operator.init(props);
nRow = 3;
nCol = 1;
tturn1 = params.turn1;
tturn2 = params.turn2;
}
else if( chr.value === "<" || chr.type === BRACKET_ANGLE_LEFT)
{
operator = new COperatorAngleBracket();
var props =
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)
{
location: location,
//location: DELIMITER_LOCATION_LEFT,
turn: TURN_0
};
operator.init(props);
loc1 = 2;
loc2 = 3;
}
else if( chr.value === ">" || chr.type === BRACKET_ANGLE_RIGHT)
{
operator = new COperatorAngleBracket();
var props =
else
{
//location: DELIMITER_LOCATION_RIGHT,
location: location,
turn: TURN_180
};
operator.init(props);
loc1 = 0;
loc2 = 1;
}
else if(chr.value === "|" || chr.type === DELIMITER_LINE)
{
operator = new COperatorLine();
var props =
if(this.type == 0)
{
location: location,
//location: DELIMITER_LOCATION_LEFT,
turn: TURN_0
};
operator.init(props);
operator1 = new COperatorParenthesis();
operator2 = new COperatorParenthesis();
}
else if(chr.value === "" || chr.type === HALF_SQUARE_LEFT)
else if(this.type == 1)
{
operator = new CHalfSquareBracket();
var props =
operator1 = new COperatorBracket();
operator2 = new COperatorBracket();
}
else if(this.type == 2)
{
//location: DELIMITER_LOCATION_LEFT,
location: location,
turn: TURN_0
};
operator.init(props);
operator1 = new CSquareBracket();
operator2 = new CSquareBracket();
}
else if(chr.value === "" || chr.type == HALF_SQUARE_RIGHT)
else if(this.type == 3)
{
operator = new CHalfSquareBracket();
var props =
operator1 = new COperatorAngleBracket();
operator2 = new COperatorAngleBracket();
}
else if(this.type == 4)
{
//location: DELIMITER_LOCATION_LEFT,
location: location,
turn: TURN_180
};
operator.init(props);
operator1 = new CHalfSquareBracket();
operator2 = new CHalfSquareBracket();
}
else if(chr.value === "" || chr.type == HALF_SQUARE_LEFT_UPPER)
else if(this.type == 5)
{
operator = new CHalfSquareBracket();
var props =
operator1 = new COperatorLine();
operator2 = new COperatorLine();
}
else if(this.type == 6)
{
//location: DELIMITER_LOCATION_LEFT,
location: location,
turn: TURN_MIRROR_0
};
operator.init(props);
operator1 = new COperatorDoubleLine();
operator2 = new COperatorDoubleLine();
}
else if(chr.value === "" || chr.type == HALF_SQUARE_RIGHT_UPPER)
else
{
operator = new CHalfSquareBracket();
var props =
operator1 = new CWhiteSquareBracket();
operator2 = new CWhiteSquareBracket();
}
operator1.setLocation(loc1, tturn1);
operator1.relate(this);
operator2.setLocation(loc2, tturn2);
operator2.relate(this);
if(this.loc == 0 || this.loc == 2)
{
//location: DELIMITER_LOCATION_LEFT,
location: location,
turn: TURN_MIRROR_180
};
operator.init(props);
this.addMCToContent(operator1, base);
}
else if(chr.value === "" || chr.type == DELIMITER_DOUBLE_LINE)
else if(this.loc == 1 || this.loc == 3)
{
operator = new COperatorDoubleLine();
var props =
this.addMCToContent(base, operator2);
}
else
{
location: location,
//location: DELIMITER_LOCATION_LEFT,
turn: TURN_0
};
operator.init(props);
this.addMCToContent(operator1, base, operator2);
}
else if(chr.value === "" || chr.type == WHITE_SQUARE_LEFT)
//выравнивание для случая когда центр смещен (не середина), для вложенных дробей и т.п.
if(this.loc == 2)
{
operator = new CWhiteSquareBracket();
var props =
this.alignVer(0, 0.5);
}
else if(this.loc == 3)
{
//location: DELIMITER_LOCATION_LEFT,
location: location,
turn: TURN_0
};
operator.init(props);
this.alignVer(1, 0.5);
}
else if(chr.value === "" || chr.type == WHITE_SQUARE_RIGHT)
if(this.loc == 4)
{
operator = new CWhiteSquareBracket();
var props =
this.alignVer(0, 0.5);
this.alignVer(2, 0.5);
}
}
CBaseDelimiter.prototype.recalculateSize = function()
{
var width, height, center;
if(this.loc == 0)
{
//location: DELIMITER_LOCATION_LEFT,
location: location,
turn: TURN_180
};
operator.init(props);
oper = this.elements[0][0];
arg = this.elements[1][0];
oper.recalculateSize(arg.size.width);
width = oper.size.width > arg.size.width ? oper.size.width : arg.size.width;
height = oper.size.height + arg.size.height;
center = oper.size.height + arg.size.center;
}
else if( chr.value === "" || chr.type === BRACKET_EMPTY)
operator = -1;
else
else if(this.loc == 1)
{
operator = new CMathText();
operator.add(chr.value.charCodeAt(0));
arg = this.elements[0][0];
oper = this.elements[1][0];
oper.recalculateSize(arg.size.width);
width = oper.size.width > arg.size.width ? oper.size.width : arg.size.width;
height = oper.size.height + arg.size.height;
center = arg.size.center;
}
else if(this.loc == 2)
{
arg = this.elements[0][1];
oper = this.elements[0][0];
oper.recalculateSize(arg.size.height);
return operator;
width = arg.size.width + oper.size.width;
height = oper.size.height > arg.size.height ? oper.size.height : arg.size.height;
center = oper.size.center > arg.size.center ? oper.size.center : arg.size.center;
}
else if(this.loc == 3)
{
arg = this.elements[0][0];
oper = this.elements[0][1];
oper.recalculateSize(arg.size.height);
width = arg.size.width + oper.size.width;
height = oper.size.height > arg.size.height ? oper.size.height : arg.size.height;
center = oper.size.center > arg.size.center ? oper.size.center : arg.size.center;
}
else if(this.loc == 4)
{
oper1 = this.elements[0][0];
arg = this.elements[0][1];
oper2 = this.elements[0][2];
oper1.recalculateSize(arg.size.height);
oper2.recalculateSize(arg.size.height);
width = oper1.size.width + arg.size.width + oper2.size.width;
height = oper1.size.height > arg.size.height ? oper1.size.height : arg.size.height; // oper1.size.height and oper2.size.height are equals
center = oper1.size.center > arg.size.center ? oper1.size.center : arg.size.center;
}
else
{
oper1 = this.elements[0][0];
arg = this.elements[1][0];
oper2 = this.elements[2][0];
oper1.recalculateSize(arg.size.width);
oper2.recalculateSize(arg.size.width);
width = oper1.size.width > arg.size.width ? oper1.size.width : arg.size.width; // oper1.size.width and oper2.size.width are equals
height = oper1.size.height + arg.size.height + oper2.size.height;
center = oper1.size.height + arg.size.center;
}
this.size = {width: width, height: height, center: center};
}
CBaseDelimiter.prototype.getBase = function()
{
return this.base;
}
CBaseDelimiter.prototype.Resize = function()
{
for(var i=0; i < this.nRow; i++)
for(var j = 0; j < this.nCol; j++)
if(! this.elements[i][j].IsJustDraw() )
this.elements[i][j].Resize();
function GetGlyph_GrChr(chr, location)
this.recalculateSize();
}
CBaseDelimiter.prototype.getOperator = function(chr)
{
var operator;
if(typeof(chr) === "undefined" ||chr === null)
{
if( chr.value === "(" || chr.type === PARENTHESIS_LEFT)
{
operator = new COperatorBracket();
operator = new COperatorParenthesis();
var props =
{
location: LOCATION_BOT,
turn: TURN_MIRROR_0
location: DELIMITER_LOCATION_LEFT,
turn: TURN_0
};
operator.init(props);
}
operator.ini(props);
}
else if(chr.value === "" || chr.type == BRACKET_CURLY_TOP)
else if( chr.value === ")" || chr.type === PARENTHESIS_RIGHT)
{
operator = new COperatorBracket();
operator = new COperatorParenthesis();
var props =
{
location: location,
turn: TURN_0
location: DELIMITER_LOCATION_RIGHT,
turn: TURN_180
};
operator.init(props);
operator.ini(props);
}
else if(chr.value === "" || chr.type === BRACKET_CURLY_BOTTOM )
else if( chr.value == "{" || chr.type === BRACKET_CURLY_LEFT)
{
operator = new COperatorBracket();
var props =
{
location: location,
turn: TURN_MIRROR_0
location: DELIMITER_LOCATION_LEFT,
turn: TURN_0
};
operator.init(props);
operator.ini(props);
}
else if(chr.value === "" || chr.type === ARROW_LEFT)
else if( chr.value === "}" || chr.type === BRACKET_CURLY_RIGHT)
{
operator = new CSingleArrow();
operator = new COperatorBracket();
var props =
{
location: location,
turn: TURN_0
location: DELIMITER_LOCATION_RIGHT,
turn: TURN_180
};
operator.init(props);
operator.ini(props);
}
else if(chr.value === "" || chr.type === ARROW_RIGHT)
else if( chr.value === "[" || chr.type === BRACKET_SQUARE_LEFT)
{
operator = new CSingleArrow();
operator = new CSquareBracket();
var props =
{
location: location,
turn: TURN_180
location: DELIMITER_LOCATION_LEFT,
turn: TURN_0
};
operator.init(props);
operator.ini(props);
}
else if(chr.value === "" || chr.type === ARROW_LR)
else if( chr.value === "]" || chr.type === BRACKET_SQUARE_RIGHT)
{
operator = new CLeftRightArrow();
operator = new CSquareBracket();
var props =
{
location: location,
turn: TURN_0
location: DELIMITER_LOCATION_RIGHT,
turn: TURN_180
};
operator.init(props);
operator.ini(props);
}
else if(chr.value === "" || chr.type === HALF_ARROW_LEFT)
else if( chr.value === "<" || chr.type === BRACKET_SQUARE_LEFT)
{
operator = new CCombiningHalfArrow();
operator = new CSquareBracket();
var props =
{
location: location,
location: DELIMITER_LOCATION_LEFT,
turn: TURN_0
};
operator.init(props);
operator.ini(props);
}
else if(chr.value === "" || chr.type === HALF_ARROW_RIGHT)
else if( chr.value === ">" || chr.type === BRACKET_SQUARE_RIGHT)
{
operator = new CCombiningHalfArrow();
operator = new CSquareBracket();
var props =
{
location: location,
location: DELIMITER_LOCATION_RIGHT,
turn: TURN_180
};
operator.init(props);
}
else
{
operator = new CMathText();
operator.add(chr.value.charCodeAt(0));
operator.ini(props);
}
else if( chr.value === "" || chr.type === BRACKET_EMPTY)
operator = -1;
return operator;
}
}*/
function CBaseDelimiter()
function COperatorBracket()
{
// location
CGlyphOperator.call(this);
}
extend(COperatorBracket, CGlyphOperator);
COperatorBracket.prototype.calcSize = function( measure )
{
var betta = this.getTxtPrp().FontSize/36;
//-1 - absence
// 0 - up
// 1 - down
// 2 - left
// 3 - right
// 4 - left/right
// 5 - up/down
// перевернутая скобка
var minBoxH = 4.917529296874999 *betta, //width of 0x28
widthBr = 12.347222222222221*betta;
this.begOper = null;
this.endOper = null;
//this.base = null;
var rx = measure / widthBr;
if(rx < 1)
rx = 1;
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;
if(rx < 2.1)
maxBoxH = minBoxH * 1.37;
else if(rx < 3.22)
maxBoxH = minBoxH * 1.06;
else
this.grow = true;
this.begOper = this.getOperator(props.begChr);
this.endOper = this.getOperator(props.endChr);
maxBoxH = 8.74 *betta;
/*var base = new CMathContent();
var delta = maxBoxH - minBoxH;
var params =
{
type: type,
loc: loc,
turn1: turn1,
turn2: turn2
};
var heightBr = delta/4.3 * (rx - 1) + minBoxH;
heightBr = heightBr > maxBoxH ? maxBoxH : heightBr;
this.init_2(params, base);*/
return {width: widthBr, height: heightBr};
}
CBaseDelimiter.prototype.init_2 = function(params, base)
COperatorBracket.prototype.calcCoord = function(measure)
{
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);
if(this.loc == 0 || this.loc == 2)
{
this.addMCToContent(operator1, base);
}
else if(this.loc == 1 || this.loc == 3)
{
this.addMCToContent(base, operator2);
}
else
{
this.addMCToContent(operator1, base, operator2);
}
//выравнивание для случая когда центр смещен (не середина), для вложенных дробей и т.п.
if(this.loc == 2)
{
this.alignVer(0, 0.5);
}
else if(this.loc == 3)
{
this.alignVer(1, 0.5);
}
if(this.loc == 4)
{
this.alignVer(0, 0.5);
this.alignVer(2, 0.5);
}
}
CBaseDelimiter.prototype.recalculateSize = function()
{
var width, height, center;
if(this.loc == 0)
{
oper = this.elements[0][0];
arg = this.elements[1][0];
oper.recalculateSize(arg.size.width);
width = oper.size.width > arg.size.width ? oper.size.width : arg.size.width;
height = oper.size.height + arg.size.height;
center = oper.size.height + arg.size.center;
}
else if(this.loc == 1)
{
arg = this.elements[0][0];
oper = this.elements[1][0];
oper.recalculateSize(arg.size.width);
width = oper.size.width > arg.size.width ? oper.size.width : arg.size.width;
height = oper.size.height + arg.size.height;
center = arg.size.center;
}
else if(this.loc == 2)
{
arg = this.elements[0][1];
oper = this.elements[0][0];
oper.recalculateSize(arg.size.height);
width = arg.size.width + oper.size.width;
height = oper.size.height > arg.size.height ? oper.size.height : arg.size.height;
center = oper.size.center > arg.size.center ? oper.size.center : arg.size.center;
}
else if(this.loc == 3)
{
arg = this.elements[0][0];
oper = this.elements[0][1];
oper.recalculateSize(arg.size.height);
width = arg.size.width + oper.size.width;
height = oper.size.height > arg.size.height ? oper.size.height : arg.size.height;
center = oper.size.center > arg.size.center ? oper.size.center : arg.size.center;
}
else if(this.loc == 4)
{
oper1 = this.elements[0][0];
arg = this.elements[0][1];
oper2 = this.elements[0][2];
oper1.recalculateSize(arg.size.height);
oper2.recalculateSize(arg.size.height);
width = oper1.size.width + arg.size.width + oper2.size.width;
height = oper1.size.height > arg.size.height ? oper1.size.height : arg.size.height; // oper1.size.height and oper2.size.height are equals
center = oper1.size.center > arg.size.center ? oper1.size.center : arg.size.center;
}
else
{
oper1 = this.elements[0][0];
arg = this.elements[1][0];
oper2 = this.elements[2][0];
oper1.recalculateSize(arg.size.width);
oper2.recalculateSize(arg.size.width);
width = oper1.size.width > arg.size.width ? oper1.size.width : arg.size.width; // oper1.size.width and oper2.size.width are equals
height = oper1.size.height + arg.size.height + oper2.size.height;
center = oper1.size.height + arg.size.center;
}
this.size = {width: width, height: height, center: center};
}
CBaseDelimiter.prototype.getBase = function()
{
return this.base;
}
CBaseDelimiter.prototype.Resize = function()
{
for(var i=0; i < this.nRow; i++)
for(var j = 0; j < this.nCol; j++)
if(! this.elements[i][j].IsJustDraw() )
this.elements[i][j].Resize();
this.recalculateSize();
}
CBaseDelimiter.prototype.getOperator = function(chr)
{
var operator;
if( chr.value === "(" || chr.type === PARENTHESIS_LEFT)
{
operator = new COperatorParenthesis();
var props =
{
location: DELIMITER_LOCATION_LEFT,
turn: TURN_0
};
operator.ini(props);
}
else if( chr.value === ")" || chr.type === PARENTHESIS_RIGHT)
{
operator = new COperatorParenthesis();
var props =
{
location: DELIMITER_LOCATION_RIGHT,
turn: TURN_180
};
operator.ini(props);
}
else if( chr.value == "{" || chr.type === BRACKET_CURLY_LEFT)
{
operator = new COperatorBracket();
var props =
{
location: DELIMITER_LOCATION_LEFT,
turn: TURN_0
};
operator.ini(props);
}
else if( chr.value === "}" || chr.type === BRACKET_CURLY_RIGHT)
{
operator = new COperatorBracket();
var props =
{
location: DELIMITER_LOCATION_RIGHT,
turn: TURN_180
};
operator.ini(props);
}
else if( chr.value === "[" || chr.type === BRACKET_SQUARE_LEFT)
{
operator = new CSquareBracket();
var props =
{
location: DELIMITER_LOCATION_LEFT,
turn: TURN_0
};
operator.ini(props);
}
else if( chr.value === "]" || chr.type === BRACKET_SQUARE_RIGHT)
{
operator = new CSquareBracket();
var props =
{
location: DELIMITER_LOCATION_RIGHT,
turn: TURN_180
};
operator.ini(props);
}
else if( chr.value === "<" || chr.type === BRACKET_SQUARE_LEFT)
{
operator = new CSquareBracket();
var props =
{
location: DELIMITER_LOCATION_LEFT,
turn: TURN_0
};
operator.ini(props);
}
else if( chr.value === ">" || chr.type === BRACKET_SQUARE_RIGHT)
{
operator = new CSquareBracket();
var props =
{
location: DELIMITER_LOCATION_RIGHT,
turn: TURN_180
};
operator.ini(props);
}
else if( chr.value === "" || chr.type === BRACKET_EMPTY)
operator = -1;
return operator;
}
function COperatorBracket()
{
CGlyphOperator.call(this);
}
extend(COperatorBracket, CGlyphOperator);
COperatorBracket.prototype.calcSize = function( measure )
{
var betta = this.getTxtPrp().FontSize/36;
// перевернутая скобка
var minBoxH = 4.917529296874999 *betta, //width of 0x28
widthBr = 12.347222222222221*betta;
var rx = measure / widthBr;
if(rx < 1)
rx = 1;
if(rx < 2.1)
maxBoxH = minBoxH * 1.37;
else if(rx < 3.22)
maxBoxH = minBoxH * 1.06;
else
maxBoxH = 8.74 *betta;
var delta = maxBoxH - minBoxH;
var heightBr = delta/4.3 * (rx - 1) + minBoxH;
heightBr = heightBr > maxBoxH ? maxBoxH : heightBr;
return {width: widthBr, height: heightBr};
}
COperatorBracket.prototype.calcCoord = function(measure)
{
var X = new Array(),
Y = new Array();
var X = new Array(),
Y = new Array();
X[0] = 26467; Y[0] = 18871;
X[1] = 25967; Y[1] = 18871;
......@@ -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;
......@@ -3969,57 +3676,168 @@ old_CSeparator.prototype.init = function(sepChr, column)
}
old_CSeparator.prototype.setDistance = function()
{
this.dW = this.getTxtPrp().FontSize/3*g_dKoef_pt_to_mm;
this.dW = this.getTxtPrp().FontSize/3*g_dKoef_pt_to_mm;
}
old_CSeparator.prototype.draw = function()
{
//if(this.sepChr == )
old_CSeparator.superclass.draw.call(this);
}
old_CSeparator.prototype.drawHorLine = function()
{
var x = this.pos.x,
y = this.pos.y;
var w = this.elements[0][0].size.width + this.dW/2;
var intGrid = MathControl.pGraph.GetIntegerGrid();
MathControl.pGraph.SetIntegerGrid(false);
MathControl.pGraph.p_width(1000);
MathControl.pGraph.b_color1(0,0,0, 255);
pW = this.getTxtPrp().FontSize/18*g_dKoef_pt_to_mm;
for(var i = 0; i < this.nCol - 1; i++)
{
var x1 = x + w - pW/2, y1 = y,
x2 = x + pW/2 + w, y2 = y,
x3 = x2, y3 = y + this.size.height,
x4 = x1, y4 = y3;
MathControl.pGraph._s();
MathControl.pGraph._m(x1, y1);
MathControl.pGraph._l(x2, y2);
MathControl.pGraph._l(x3, y3);
MathControl.pGraph._l(x4, y4);
MathControl.pGraph._l(x1, y1);
MathControl.pGraph.df();
w += this.elements[0][i+1].size.width + this.dW;
}
MathControl.pGraph.SetIntegerGrid(intGrid);
}
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);
}
}
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;
}
old_CSeparator.prototype.draw = function()
COperator.prototype.setTxtPrp = function(txtPrp)
{
//if(this.sepChr == )
this.TxtPrp = txtPrp;
if(this.glyph !== -1)
this.glyph.setTxtPrp(txtPrp);
}
old_CSeparator.superclass.draw.call(this);
function CSeparator(glyph)
{
COperator.call(this, glyph);
}
old_CSeparator.prototype.drawHorLine = function()
extend(CSeparator, COperator);
CSeparator.prototype.draw = function()
{
var x = this.pos.x,
y = this.pos.y;
var w = this.elements[0][0].size.width + this.dW/2;
var intGrid = MathControl.pGraph.GetIntegerGrid();
MathControl.pGraph.SetIntegerGrid(false);
MathControl.pGraph.p_width(1000);
MathControl.pGraph.b_color1(0,0,0, 255);
pW = this.getTxtPrp().FontSize/18*g_dKoef_pt_to_mm;
for(var i = 0; i < this.nCol - 1; i++)
if(this.glyph !== -1)
{
var x1 = x + w - pW/2, y1 = y,
x2 = x + pW/2 + w, y2 = y,
x3 = x2, y3 = y + this.size.height,
x4 = x1, y4 = y3;
MathControl.pGraph._s();
MathControl.pGraph._m(x1, y1);
MathControl.pGraph._l(x2, y2);
MathControl.pGraph._l(x3, y3);
MathControl.pGraph._l(x4, y4);
MathControl.pGraph._l(x1, y1);
MathControl.pGraph.df();
var lng = this.coordGlyph.XX.length;
w += this.elements[0][i+1].size.width + this.dW;
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]);
}
MathControl.pGraph.SetIntegerGrid(intGrid);
this.glyph.draw(X, Y);
}
}
}
function CSeparator()
CSeparator.prototype.setPosition = function(pos)
{
this.positions = pos;
}
extend(CSeparator, CMathBase);
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);
......@@ -4250,194 +4073,368 @@ CDelimiter.prototype.findDisposition = function(pos)
for(var j = 0; j < this.nCol; j++)
{
if(xx + this.elements[0][j].size.width + this.sepOper.size.width/2 > pos.x)
if(xx + this.elements[0][j].size.width + this.sepOper.size.width/2 > pos.x)
{
curs_Y = j;
if( pos.x < xx + this.elements[0][j].size.width)
X = pos.x - xx;
else
X = xx + this.elements[0][j].size.width;
break;
}
xx += this.elements[0][j].size.width + this.sepOper.size.width;
}
}
var align = this.align( this.elements[0][curs_Y]);
if(align > pos.y)
{
Y = 0;
inside_flag = 2;
}
else if(this.elements[0][curs_Y].size.height + align < pos.y)
{
Y = this.elements[0][curs_Y].size.height;
inside_flag = 2;
}
else
Y = pos.y - align;
var mouseCoord = {x: X, y: Y},
posCurs = {x: curs_X, y: curs_Y};
return {pos: posCurs, mCoord: mouseCoord, inside_flag: inside_flag};
}
CDelimiter.prototype.draw = function()
{
this.begOper.draw();
this.sepOper.draw();
this.endOper.draw();
for(var j = 0; j < this.nCol; j++)
this.elements[0][j].draw();
}
CDelimiter.prototype.drawOperator = function(pos, coord, glyph)
{
var X = new Array(),
Y = new Array();
for(var i = 0; i < coord.XX.length; i++)
{
X[i] = pos.x + coord.XX[i];
Y[i] = pos.y + coord.YY[i];
}
glyph.drawGlyph(X, Y);
}
CDelimiter.prototype.align = function(element)
{
var align = 0;
if(!element.IsJustDraw())
align = this.size.center - element.size.center;
else
align = (this.size.height - element.size.height)/2;
//align = (this.size.height - element.size.height)/2;
return align;
}
CDelimiter.prototype.getBase = function(numb)
{
if(numb !== numb - 0)
numb = 0;
return this.elements[0][numb];
}
CDelimiter.prototype.getGlyph = function(chr, type, location)
{
var operator;
var code = typeof(chr) === "string" ? chr.charCodeAt(0) : null;
if( code === 0x28 || type === PARENTHESIS_LEFT)
{
operator = new COperatorParenthesis();
var props =
{
location: location,
turn: TURN_0
};
operator.init(props);
}
else if( code === 0x29 || type === PARENTHESIS_RIGHT)
{
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 =
{
curs_Y = j;
if( pos.x < xx + this.elements[0][j].size.width)
X = pos.x - xx;
else
X = xx + this.elements[0][j].size.width;
break;
}
xx += this.elements[0][j].size.width + this.sepOper.size.width;
//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);
}
var align = this.align( this.elements[0][curs_Y]);
if(align > pos.y)
else if(code === 0x27E6 || type == WHITE_SQUARE_LEFT)
{
Y = 0;
inside_flag = 2;
operator = new CWhiteSquareBracket();
var props =
{
//location: DELIMITER_LOCATION_LEFT,
location: location,
turn: TURN_0
};
operator.init(props);
}
else if(this.elements[0][curs_Y].size.height + align < pos.y)
else if(code === 0x27E7 || type == WHITE_SQUARE_RIGHT)
{
Y = this.elements[0][curs_Y].size.height;
inside_flag = 2;
operator = new CWhiteSquareBracket();
var props =
{
//location: DELIMITER_LOCATION_LEFT,
location: location,
turn: TURN_180
};
operator.init(props);
}
else
Y = pos.y - align;
var mouseCoord = {x: X, y: Y},
posCurs = {x: curs_X, y: curs_Y};
return {pos: posCurs, mCoord: mouseCoord, inside_flag: inside_flag};
}
CDelimiter.prototype.draw = function()
{
this.begOper.draw();
this.sepOper.draw();
this.endOper.draw();
for(var j = 0; j < this.nCol; j++)
this.elements[0][j].draw();
}
CDelimiter.prototype.drawOperator = function(pos, coord, glyph)
{
var X = new Array(),
Y = new Array();
for(var i = 0; i < coord.XX.length; i++)
else if( code === "" || type === BRACKET_EMPTY)
operator = -1;
else if(code !== null)
{
X[i] = pos.x + coord.XX[i];
Y[i] = pos.y + coord.YY[i];
operator = new CMathText();
operator.add(code.charCodeAt(0));
}
glyph.drawGlyph(X, Y);
}
CDelimiter.prototype.align = function(element)
{
var align = 0;
if(!element.IsJustDraw())
align = this.size.center - element.size.center;
else
align = (this.size.height - element.size.height)/2;
//align = (this.size.height - element.size.height)/2;
return align;
}
CDelimiter.prototype.getBase = function(numb)
{
if(numb !== numb - 0)
numb = 0;
operator = -1;
return this.elements[0][numb];
return operator;
}
function COperator(glyph)
/*function GetGlyph_GrChr(chr, location)
{
this.glyph = glyph;
var operator;
this.pos = null;
this.coordGlyph = null;
this.size = {width: 0, height: 0};
}
COperator.prototype.draw = function()
{
/*if(this.glyph !== -1)
if(typeof(chr) === "undefined" ||chr === null)
{
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++)
operator = new COperatorBracket();
var props =
{
X.push(this.positions[i].x + this.coordGlyph.XX[j]);
Y.push(this.positions[i].y + this.coordGlyph.YY[j]);
location: LOCATION_BOT,
turn: TURN_MIRROR_0
};
operator.init(props);
}
this.glyph.draw(X, Y);
}
}*/
if(this.glyph !== -1)
else if(chr.value === "⏞" || chr.type == BRACKET_CURLY_TOP)
{
var lng = this.coordGlyph.XX.length;
var X = new Array(),
Y = new Array();
for(var j = 0; j < lng; j++)
operator = new COperatorBracket();
var props =
{
X.push(this.pos.x + this.coordGlyph.XX[j]);
Y.push(this.pos.y + this.coordGlyph.YY[j]);
location: location,
turn: TURN_0
};
operator.init(props);
}
this.glyph.draw(X, Y);
else if(chr.value === "⏟" || chr.type === BRACKET_CURLY_BOTTOM )
{
operator = new COperatorBracket();
var props =
{
location: location,
turn: TURN_MIRROR_0
};
operator.init(props);
}
}
COperator.prototype.fixSize = function(measure)
{
if(this.glyph !== -1)
else if(chr.value === "⃖" || chr.type === ARROW_LEFT)
{
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)
operator = new CSingleArrow();
var props =
{
//width = measure > this.glyph.size.width ? measure : this.glyph.size.width;
width = dims.Width;
height = this.glyph.size.height;
location: location,
turn: TURN_0
};
operator.init(props);
}
else
else if(chr.value === "⃗" || chr.type === ARROW_RIGHT)
{
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;
operator = new CSingleArrow();
var props =
{
location: location,
turn: TURN_180
};
operator.init(props);
}
var betta = this.TxtPrp.FontSize/36;
var center = height/2 + 0.2*betta;
this.size = { width: width, height: height, center: center};
else if(chr.value === "⃡" || chr.type === ARROW_LR)
{
operator = new CLeftRightArrow();
var props =
{
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 === HALF_ARROW_LEFT)
{
var bHor = this.glyph.loc == 0 || this.glyph.loc == 1;
if(bHor)
this.fixSize(this.size.width);
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
this.fixSize(this.size.height);
{
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