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

1. Прокинула свойства для элементов : fraction, degree, degreeSubSup radical,...

1. Прокинула свойства для элементов : fraction, degree, degreeSubSup radical, N-ary, accent, delimiters (для чтения)
2. Исправила баг при удалении: когда удаляли контент из начала контента, неправильно выставлялся курсор (перед RunPrp), текст из-за этого не отображался
3. Исправила баг при добавлении мат. элемента, не добавлялись RunPrp для текста 
4. Для n-арных операторов добавила возможность вместо n-арного оператора отрисовать любую букву
5. Поправила баг с расстоянием для n-арных операторов с один оператором (они не отрисовывались)

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@52120 954022d7-b5bf-4e40-9824-e11837661b57
parent 565b85fc
......@@ -597,6 +597,10 @@ CSign.prototype.relate = function(parent)
{
this.Parent = parent;
}
CSign.prototype.getCodeAccent = function()
{
return this.sign.value;
}
function old_CAccent()
{
......@@ -845,7 +849,8 @@ CAccent.prototype.draw = function()
function CAccent()
{
this. type = null;
this.code = null; // храним код буквы и тип здесь
this. type = null; // т.к в класах, которые вызываем, не учитываем случаи, когда элементы (стрелки/скобки) переворачиваются
this.loc = LOCATION_TOP;
CCharacter.call(this);
}
......@@ -880,6 +885,7 @@ CAccent.prototype.init = function(props)
if(code === 0x302 || type === ACCENT_CIRCUMFLEX)
{
this.type = ACCENT_CIRCUMFLEX;
this.code = 0x302;
accent = new CCircumflex();
accent.setTurn(TURN_0);
......@@ -887,6 +893,7 @@ CAccent.prototype.init = function(props)
else if(code === 0x30C || type === ACCENT_COMB_CARON)
{
this.type = ACCENT_COMB_CARON;
this.code = 0x30C;
accent = new CCircumflex();
accent.setTurn(TURN_MIRROR_0);
......@@ -894,24 +901,28 @@ CAccent.prototype.init = function(props)
else if(code === 0x332 || type === ACCENT_LINE)
{
this.type = ACCENT_LINE;
this.code = 0x332;
accent = new CLine();
}
else if(code === 0x333 || type === ACCENT_DOUBLE_LINE)
{
this.type = ACCENT_DOUBLE_LINE;
this.code = 0x333;
accent = new CDoubleLine();
}
else if(code === 0x303 || type === ACCENT_TILDE)
{
this.type = ACCENT_TILDE;
this.code = 0x303;
accent = new CTilde();
}
else if(code === 0x306 || type === ACCENT_BREVE)
{
this.type = ACCENT_BREVE;
this.code = 0x306;
accent = new CBreve();
accent.setTurn(TURN_MIRROR_0);
......@@ -919,6 +930,7 @@ CAccent.prototype.init = function(props)
else if(code == 0x311 || type == ACCENT_INVERT_BREVE)
{
this.type = ACCENT_INVERT_BREVE;
this.code = 0x311;
accent = new CBreve();
accent.setTurn(TURN_0);
......@@ -926,141 +938,152 @@ CAccent.prototype.init = function(props)
else if(code === 0x20D6 || type === ACCENT_ARROW_LEFT)
{
this.type = ACCENT_ARROW_LEFT;
this.code = 0x20D6;
glyph = new CCombiningArrow();
props =
var prp =
{
location: LOCATION_TOP,
turn: TURN_0
};
glyph.init(props);
glyph.init(prp);
accent = new COperator(glyph);
}
else if(code === 0x20D7 || type === ACCENT_ARROW_RIGHT)
{
this.type = ACCENT_ARROW_RIGHT;
this.code = 0x20D7;
glyph = new CCombiningArrow();
props =
var prp =
{
location: LOCATION_TOP,
turn: TURN_180
};
glyph.init(props);
glyph.init(prp);
accent = new COperator(glyph);
}
else if(code === 0x20E1 || type === ACCENT_ARROW_LR)
{
this.type = ACCENT_ARROW_LR;
this.code = 0x20E1;
glyph = new CCombining_LR_Arrow();
props =
var prp =
{
location: LOCATION_TOP,
turn: TURN_0
};
glyph.init(props);
glyph.init(prp);
accent = new COperator(glyph);
}
else if(code === 0x20D0 || type === ACCENT_HALF_ARROW_LEFT)
{
this.type = ACCENT_HALF_ARROW_LEFT;
this.code = 0x20D0;
glyph = new CCombiningHalfArrow();
props =
var prp =
{
location: LOCATION_TOP,
turn: TURN_0
};
glyph.init(props);
glyph.init(prp);
accent = new COperator(glyph);
}
else if(code === 0x20D1 || type === ACCENT_HALF_ARROW_RIGHT)
{
this.type = ACCENT_HALF_ARROW_RIGHT;
this.code = 0x20D1;
glyph = new CCombiningHalfArrow();
props =
var prp =
{
location: LOCATION_TOP,
turn: TURN_180
};
glyph.init(props);
glyph.init(prp);
accent = new COperator(glyph);
}
///// group characters /////
else if(code === 0x2190 || type === ARROW_LEFT)
{
this.type = ARROW_LEFT;
this.code = 0x2190;
glyph = new CSingleArrow();
props =
var prp =
{
location: this.loc,
turn: TURN_0
};
glyph.init(props);
glyph.init(prp);
}
else if(code === 0x2192 || type === ARROW_RIGHT)
{
this.type = ARROW_RIGHT;
this.code = 0x2192;
glyph = new CSingleArrow();
props =
var prp =
{
location: this.loc,
turn: TURN_180
};
glyph.init(props);
glyph.init(prp);
}
else if(code === 0x2194 || type === ARROW_LR)
{
this.type = ARROW_LR;
this.code = 0x2194;
glyph = new CLeftRightArrow();
props =
var prp =
{
location: this.loc,
turn: TURN_0
};
glyph.init(props);
glyph.init(prp);
}
else if(code === 0x21D0 || type === DOUBLE_LEFT_ARROW)
{
this.type = DOUBLE_LEFT_ARROW;
this.code = 0x21D0;
glyph = new CDoubleArrow();
props =
var prp =
{
location: this.loc,
turn: TURN_0
};
glyph.init(props);
glyph.init(prp);
}
else if(code === 0x21D2 || type === DOUBLE_RIGHT_ARROW)
{
this.type = DOUBLE_RIGHT_ARROW;
this.code = 0x21D2;
glyph = new CDoubleArrow();
props =
var prp =
{
location: this.loc,
turn: TURN_180
};
glyph.init(props);
glyph.init(prp);
}
else if(code === 0x21D4 || type === DOUBLE_ARROW_LR)
{
this.type = DOUBLE_ARROW_LR;
this.code = 0x21D4;
glyph = new CLR_DoubleArrow();
props =
var prp =
{
location: this.loc,
turn: TURN_0
};
glyph.init(props);
glyph.init(prp);
}
/////
else if(bCode || bType)
......@@ -1068,16 +1091,19 @@ CAccent.prototype.init = function(props)
this.type = ACCENT_SIGN;
accent = new CSign();
var props =
var prp =
{
type: type,
code: code
};
accent.setSign(props);
accent.setSign(prp);
this.code = accent.getCodeAccent();
}
else
{
this.type = ACCENT_COMB_CARON;
this.code = 0x30C;
accent = new CCircumflex();
accent.setTurn(TURN_MIRROR_0);
......@@ -1097,7 +1123,10 @@ CAccent.prototype.getCenter = function()
return center;
}
CAccent.prototype.getProps = function()
CAccent.prototype.getPropsForWrite = function()
{
var prps = {};
var props = {};
props.chr = String.fromCharCode(this.code);
return props;
}
......@@ -305,7 +305,7 @@ CBar.prototype.init = function(props)
var props =
{
location: this.loc,
turn: TURN_0
turn: TURN_0
};
glyph.init(props);
......
......@@ -11,8 +11,13 @@ CDegree.prototype.init = function(props)
}
CDegree.prototype.init_2 = function(props, oBase)
{
if( typeof(props.type)!=="undefined"|| props.type !== null)
this.type = props.type;
/*if( typeof(props.type)!=="undefined"|| props.type !== null)
this.type = props.type;*/
if(props.type === DEGREE_SUPERSCRIPT)
this.type = DEGREE_SUPERSCRIPT;
else if(props.type === DEGREE_SUBSCRIPT)
this.type = DEGREE_SUBSCRIPT;
this.setDimension(1, 2);
......@@ -37,12 +42,12 @@ CDegree.prototype.recalculateSize = function()
_width += this.dW;
if(this.type === DEGREE_SUPERSCRIPT )
if(this.type === DEGREE_SUPERSCRIPT)
{
this.shiftDegree = 0;
_center = _height - (this.elements[0][0].size.height - this.elements[0][0].size.center);
}
else if(this.type === DEGREE_SUBSCRIPT )
else if(this.type === DEGREE_SUBSCRIPT)
{
this.shiftDegree = _height - this.elements[0][1].size.height;
_center = this.elements[0][0].size.center;
......@@ -136,6 +141,13 @@ CDegree.prototype.getBase = function()
{
return this.elements[0][0];
}
CDegree.prototype.getPropsForWrite = function()
{
var props = {};
props.type = this.type;
return props;
}
function old_CDegreeOrdinary()
{
......@@ -372,6 +384,7 @@ CIterators.prototype.getCtrPrp = function()
function CDegreeSubSup()
{
this.type = DEGREE_SubSup;
this.alnScr = false; // не выровнены, итераторы идут в соответствии с наклоном буквы/мат. объекта
CSubMathBase.call(this);
}
extend(CDegreeSubSup, CSubMathBase);
......@@ -382,8 +395,18 @@ CDegreeSubSup.prototype.init = function(props)
}
CDegreeSubSup.prototype.init_2 = function(props, oBase)
{
if( typeof(props.type)!=="undefined"|| props.type !== null)
this.type = props.type;
/*if( typeof(props.type)!=="undefined"|| props.type !== null)
this.type = props.type;*/
if(props.type === DEGREE_SubSup)
this.type = DEGREE_SubSup;
else if(props.type === DEGREE_PreSubSup)
this.type = DEGREE_PreSubSup;
if(props.alnScr === true || props.alnScr === 1)
this.alnScr = true;
else if(props.alnScr === false || props.alnScr === 0)
this.alnScr = false;
this.setDimension(1, 2);
......@@ -404,6 +427,7 @@ CDegreeSubSup.prototype.init_2 = function(props, oBase)
oIters.alignHor(-1, 1);
this.addMCToContent(oIters, oBase);
}
}
CDegreeSubSup.prototype.recalculateSize = function()
{
......@@ -457,6 +481,15 @@ CDegreeSubSup.prototype.getLowerIterator = function()
return iter;
}
CDegreeSubSup.prototype.getPropsForWrite = function()
{
var props = {};
props.type = this.type;
props.alnScr = this.alnScr;
return props;
}
//выяcнить: почему и с этой ф-ией и без нее работает всё ok...
//всё ok, т.к. в контенте 2 элемента, и их center сравниваем
......
......@@ -7,8 +7,17 @@ function CFraction()
extend(CFraction, CMathBase);
CFraction.prototype.init = function(props)
{
if( typeof(props.type) !== "undefined" && props.type !== null )
this.type = props.type;
var bValid = typeof(props.type) !== "undefined" && props.type !== null;
if(bValid)
{
var bBar = props.type === BAR_FRACTION || props.type === NO_BAR_FRACTION,
bSkew = props.type === SKEWED_FRACTION,
bLin = props.type === LINEAR_FRACTION;
if(bBar || bSkew || bLin) // на всякий случай
this.type = props.type;
}
if(this.type == BAR_FRACTION || this.type == NO_BAR_FRACTION)
{
......
......@@ -60,7 +60,6 @@ CLimit.prototype.init = function(props)
this.setDimension(2, 1);
var oBase = new CMathContent();
//oBase.setOwnTPrp({Italic: false});
var oIter = new CMathContent();
oIter.setReduct(DEGR_REDUCT);
......@@ -148,14 +147,6 @@ CMathFunc.prototype.init = function()
{
this.setDimension(1, 2);
this.setContent();
//var runPrp = new CTextPr();
//runPrp.Italic = false;
//this.elements[0][0].addToBeginningRPrp(runPrp);
//this.elements[0][0].setOwnTPrp({Italic: false}); // trigonometrical function
//this.elements[0][0].mergeTxtPrp({Italic: false}); // trigonometrical function
}
CMathFunc.prototype.setDistance = function()
{
......
This diff is collapsed.
......@@ -394,7 +394,12 @@ CMathText.prototype =
setMText: function(flag)
{
this.bMText = flag;
}
},
// заглушка для текста (для n-арных операторов, когда выставляется текст вместо оператора)
setComposition: function() // заглушка
{},
setReferenceComposition: function() // заглушка
{}
/*draw2: function()
{
......
......@@ -44,6 +44,7 @@ var NARY_UNION = 9;
var NARY_INTERSECTION = 10;
var NARY_LOGICAL_OR = 11;
var NARY_LOGICAL_AND = 12;
var NARY_TEXT_OPER = 13;
var NARY_UndOvr = 0;
var NARY_SubSup = 1;
......@@ -80,6 +81,9 @@ var DOUBLE_LEFT_ARROW = 21;
var DOUBLE_RIGHT_ARROW = 22;
var DOUBLE_ARROW_LR = 23;
var DELIM_OPERATOR = 0;
var DELIM_SEPARATOR = 1;
var TURN_0 = 0;
var TURN_180 = 1;
......@@ -112,6 +116,7 @@ var ACCENT_ARROW_LR = 16;
var ACCENT_HALF_ARROW_LEFT = 17;
var ACCENT_HALF_ARROW_RIGHT = 18;
var ACCENT_SIGN = 19;
var ACCENT_TEXT = 20;
var BASEJC_CENTER = 0;
var BASEJC_TOP = 1;
......
......@@ -36,11 +36,6 @@ function CMathMatrix()
CMathBase.call(this);
}
extend(CMathMatrix, CMathBase);
CMathMatrix.prototype.old_init = function(countRow, countCol)
{
this.setDimension(countRow, countCol);
this.setContent();
}
CMathMatrix.prototype.init = function(props)
{
if(typeof(props.row) === "undefined" || props.row === null)
......
This diff is collapsed.
This diff is collapsed.
......@@ -168,14 +168,25 @@ CSignRadical.prototype.relate = function(parent)
function CRadical()
{
this.type = SQUARE_RADICAL; // default
this.degHide = false;
this.signRadical = null;
CMathBase.call(this);
}
extend(CRadical, CMathBase);
CRadical.prototype.init = function(props)
{
if(typeof(props.type) !== "undefined" && props.type !== null)
this.type = props.type;
/*if(typeof(props.type) !== "undefined" && props.type !== null)
this.type = props.type;*/
/*if(props.type === SQUARE_RADICAL)
this.type = SQUARE_RADICAL;
else if(props.type === DEGREE_RADICAL)
this.type = DEGREE_RADICAL;*/
if(props.degHide === true && props.degHide === 1)
this.type = SQUARE_RADICAL;
else if(props.degHide == false && props.degHide === 0)
this.type = DEGREE_RADICAL;
this.setDimension(1, 1);
this.setContent();
......@@ -416,11 +427,23 @@ CRadical.prototype.getBase = function()
}
CRadical.prototype.getDegree = function()
{
var degree = null;
/*var degree = null;
if(this.type == DEGREE_RADICAL)
degree = this.elements[0][0];
else if(this.type = SQUARE_RADICAL)
degree = this.elements[0][0];*/
// для стремной ситуации, когда руками в xml выставили в degHide true, а объект со степенью имеется. Возвращаем основание
return this.elements[0][0];
}
CRadical.prototype.getPropsForWhite = function()
{
var props = {};
props.degHide = this.type == SQUARE_RADICAL ? 1 : 0;
return degree;
return props;
}
function old_CRadical()
......
......@@ -50,7 +50,8 @@ function simulatorRead()
props =
{
begChrType: PARENTHESIS_LEFT,
endChrType: PARENTHESIS_RIGHT,
//endChrType: PARENTHESIS_RIGHT,
endChr: ")",
sepChrType: DELIMITER_LINE,
column: 2
};
......@@ -109,7 +110,8 @@ function simulatorRead()
var integral = new CNary();
props =
{
signType: NARY_INTEGRAL,
//signType: NARY_INTEGRAL,
chr: "B",
limLoc: NARY_SubSup
};
integral.init(props);
......
......@@ -195,6 +195,7 @@
<script type="text/javascript" src = "Math/drawingUnion.js"></script>
<script type="text/javascript" src = "Math/borderBox.js"></script>
<script type="text/javascript" src = "Math/test_for_read.js"></script>
<!---->
......
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