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

1. gaps for arithmetic signs

2. поправила баг с updateCursor

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@53441 954022d7-b5bf-4e40-9824-e11837661b57
parent f656d523
...@@ -106,13 +106,6 @@ CMathBase.prototype = ...@@ -106,13 +106,6 @@ CMathBase.prototype =
return ctrPrp; return ctrPrp;
}, },
getShiftCenter: function(oMeasure, font)
{
oMeasure.SetFont(font);
var metrics = oMeasure.Measure2Code(8727); // "+"
return 0.6*metrics.Height;
},
// для управляющих символов в приоритете GetFirstPrp // для управляющих символов в приоритете GetFirstPrp
// если первый элемент - мат объект, то берутся его CtrPrp // если первый элемент - мат объект, то берутся его CtrPrp
getPrpToControlLetter: function() getPrpToControlLetter: function()
......
...@@ -52,7 +52,7 @@ CDegree.prototype.recalculateSup = function(oMeasure) ...@@ -52,7 +52,7 @@ CDegree.prototype.recalculateSup = function(oMeasure)
var descIter = iter.height - iter.ascent; var descIter = iter.height - iter.ascent;
var ctrPrp = this.getCtrPrp(); // выставить потом размер шрифта для итератора var ctrPrp = this.getCtrPrp(); // выставить потом размер шрифта для итератора
var shCenter = this.getShiftCenter(oMeasure, ctrPrp); var shCenter = this.Composition.GetShiftCenter(oMeasure, ctrPrp);
var upper = 0; var upper = 0;
...@@ -93,7 +93,7 @@ CDegree.prototype.recalculateSubScript = function(oMeasure) ...@@ -93,7 +93,7 @@ CDegree.prototype.recalculateSubScript = function(oMeasure)
shiftCenter = 0.5*DIV_CENT*FontSize;*/ shiftCenter = 0.5*DIV_CENT*FontSize;*/
var ctrPrp = this.getCtrPrp(); // выставить потом размер шрифта для итератора var ctrPrp = this.getCtrPrp(); // выставить потом размер шрифта для итератора
var shCenter = this.getShiftCenter(oMeasure, ctrPrp); var shCenter = this.Composition.GetShiftCenter(oMeasure, ctrPrp);
var low = 0; var low = 0;
if(iter.ascent - shCenter > 2/3*base.height) if(iter.ascent - shCenter > 2/3*base.height)
...@@ -317,7 +317,7 @@ CIterators.prototype.setDistanceIters = function(oMeasure) ...@@ -317,7 +317,7 @@ CIterators.prototype.setDistanceIters = function(oMeasure)
shCent = DIV_CENT*FontSize;*/ shCent = DIV_CENT*FontSize;*/
var ctrPrp = this.getCtrPrp(); var ctrPrp = this.getCtrPrp();
var shCenter = this.getShiftCenter(oMeasure, ctrPrp); var shCenter = this.Composition.GetShiftCenter(oMeasure, ctrPrp);
var upDesc = upIter.height - upIter.ascent + shCenter, var upDesc = upIter.height - upIter.ascent + shCenter,
lowAsc = lowIter.ascent - shCenter; lowAsc = lowIter.ascent - shCenter;
...@@ -432,7 +432,7 @@ CDegreeSubSup.prototype.init_2 = function(props, oBase) ...@@ -432,7 +432,7 @@ CDegreeSubSup.prototype.init_2 = function(props, oBase)
CDegreeSubSup.prototype.recalculateSize = function(oMeasure) CDegreeSubSup.prototype.recalculateSize = function(oMeasure)
{ {
var ctrPrp = this.getCtrPrp(); var ctrPrp = this.getCtrPrp();
var shCenter = this.getShiftCenter(oMeasure, ctrPrp); var shCenter = this.Composition.GetShiftCenter(oMeasure, ctrPrp);
var width = 0, height = 0, var width = 0, height = 0,
ascent = 0; ascent = 0;
......
...@@ -277,7 +277,7 @@ CFraction.prototype.recalculateBarFraction = function(oMeasure) ...@@ -277,7 +277,7 @@ CFraction.prototype.recalculateBarFraction = function(oMeasure)
var width = num.width > den.width ? num.width : den.width; var width = num.width > den.width ? num.width : den.width;
var height = num.height + den.height; var height = num.height + den.height;
var ascent = num.height + this.getShiftCenter(oMeasure, ctrPrp); var ascent = num.height + this.Composition.GetShiftCenter(oMeasure, ctrPrp);
//var ascent = num.height; //var ascent = num.height;
this.size = {width: width, height: height, ascent: ascent}; this.size = {width: width, height: height, ascent: ascent};
...@@ -288,7 +288,7 @@ CFraction.prototype.recalculateSkewed = function(oMeasure) ...@@ -288,7 +288,7 @@ CFraction.prototype.recalculateSkewed = function(oMeasure)
this.gapSlash = 5.011235894097222 * ctrPrp.FontSize/36; this.gapSlash = 5.011235894097222 * ctrPrp.FontSize/36;
var _width = this.elements[0][0].size.width + this.gapSlash + this.elements[0][1].size.width; var _width = this.elements[0][0].size.width + this.gapSlash + this.elements[0][1].size.width;
var _height = this.elements[0][0].size.height + this.elements[0][1].size.height; var _height = this.elements[0][0].size.height + this.elements[0][1].size.height;
var _ascent = this.elements[0][0].size.height + this.getShiftCenter(oMeasure, ctrPrp); var _ascent = this.elements[0][0].size.height + this.Composition.GetShiftCenter(oMeasure, ctrPrp);
this.size = {width: _width, height: _height, ascent: _ascent}; this.size = {width: _width, height: _height, ascent: _ascent};
} }
......
...@@ -37,6 +37,8 @@ ...@@ -37,6 +37,8 @@
// 1. CAccent ~> COperator // 1. CAccent ~> COperator
// 2. COperator : объединить все классы связанные с отрисовкой и пересчетом операторов в один // 2. COperator : объединить все классы связанные с отрисовкой и пересчетом операторов в один
var TEST_VAL = 0;
/// TODO /// TODO
...@@ -76,7 +78,7 @@ function mathElem(val) ...@@ -76,7 +78,7 @@ function mathElem(val)
{ {
this.value = val; this.value = val;
this.widthToEl = 0; // width to this element this.widthToEl = 0; // width to this element
this.g_mContext = this.gaps =
{ {
left: 0, left: 0,
right: 0, right: 0,
...@@ -4190,7 +4192,7 @@ CMathContent.prototype = ...@@ -4190,7 +4192,7 @@ CMathContent.prototype =
var x = coord.x, y = coord.y; var x = coord.x, y = coord.y;
var bLow = false; var bLow = false;
x += this.content[this.CurPos].widthToEl - this.content[this.CurPos].value.size.width - this.content[this.CurPos].g_mContext.right; x += this.content[this.CurPos].widthToEl - this.content[this.CurPos].value.size.width - this.content[this.CurPos].gaps.right;
y = 0; y = 0;
if( ! this.bRoot ) if( ! this.bRoot )
...@@ -4215,7 +4217,7 @@ CMathContent.prototype = ...@@ -4215,7 +4217,7 @@ CMathContent.prototype =
var x = coord.x, y = coord.y; var x = coord.x, y = coord.y;
var bUp = false; var bUp = false;
x += this.content[this.CurPos].widthToEl - this.content[this.CurPos].value.size.width - this.content[this.CurPos].g_mContext.right; x += this.content[this.CurPos].widthToEl - this.content[this.CurPos].value.size.width - this.content[this.CurPos].gaps.right;
y = 0; y = 0;
if( ! this.bRoot ) if( ! this.bRoot )
...@@ -4594,7 +4596,7 @@ CMathContent.prototype = ...@@ -4594,7 +4596,7 @@ CMathContent.prototype =
for(var i=0; i< this.content.length; i++) for(var i=0; i< this.content.length; i++)
{ {
var Size = this.content[i].value.size; var Size = this.content[i].value.size;
var gps = this.content[i].g_mContext; var gps = this.content[i].gaps;
_width += Size.width + gps.left + gps.right; _width += Size.width + gps.left + gps.right;
_descent = ( _descent < ( Size.height - Size.center + gps.bottom) ) ? ( Size.height - Size.center + gps.bottom): _descent; _descent = ( _descent < ( Size.height - Size.center + gps.bottom) ) ? ( Size.height - Size.center + gps.bottom): _descent;
_center = ( _center < (Size.center + gps.top) ) ? ( Size.center + gps.top) : _center; _center = ( _center < (Size.center + gps.top) ) ? ( Size.center + gps.top) : _center;
...@@ -4609,9 +4611,9 @@ CMathContent.prototype = ...@@ -4609,9 +4611,9 @@ CMathContent.prototype =
_ascent = _ascent > sAscent ? _ascent : sAscent; _ascent = _ascent > sAscent ? _ascent : sAscent;
} }
_width += this.g_mContext.left + this.g_mContext.right; _width += this.gaps.left + this.gaps.right;
_height = _center + _descent + this.g_mContext.top + this.g_mContext.bottom; _height = _center + _descent + this.gaps.top + this.gaps.bottom;
_center += this.g_mContext.top; _center += this.gaps.top;
this.size = {width: _width, height: _height, center: _center, ascent: _ascent}; this.size = {width: _width, height: _height, center: _center, ascent: _ascent};
...@@ -4626,7 +4628,7 @@ CMathContent.prototype = ...@@ -4626,7 +4628,7 @@ CMathContent.prototype =
for(var i = 0; i < this.content.length; i++) for(var i = 0; i < this.content.length; i++)
{ {
var oSize = this.content[i].value.size; var oSize = this.content[i].value.size;
var gps = this.content[i].g_mContext; var gps = this.content[i].gaps;
width += oSize.width + gps.left + gps.right; width += oSize.width + gps.left + gps.right;
...@@ -4651,6 +4653,8 @@ CMathContent.prototype = ...@@ -4651,6 +4653,8 @@ CMathContent.prototype =
{ {
this.content[i].value.setMText(bItalic); this.content[i].value.setMText(bItalic);
this.content[i].value.Resize(oMeasure); this.content[i].value.Resize(oMeasure);
this.checkGapsSign(oMeasure, i);
} }
else if(type == MATH_COMP) else if(type == MATH_COMP)
{ {
...@@ -4688,6 +4692,67 @@ CMathContent.prototype = ...@@ -4688,6 +4692,67 @@ CMathContent.prototype =
this.recalculateSize(); this.recalculateSize();
}, },
checkGapsSign: function(oMeasure, pos)
{
/*var bPlus = this.content[pos].value.code === 0x2B,
bMinus = this.content[pos].value.code === 0x2212,
bMult = this.content[pos].value.code === 0x2217,
bDivision = this.content[pos].value.code === 0x002F;*/
var bPlus = false, bMinus = false,
bMult = false, bDivision = false,
bEqual = false;
if(this.content[pos].value.typeObj == MATH_TEXT)
{
var code = this.content[pos].value.getCodeChr();
bPlus = code === 0x2B;
bMinus = code === 0x2212;
bMult = code === 0x2217;
bDivision = code === 0x002F;
bEqual = code === 0x3D;
}
var leftType = pos > 0 ? this.content[pos - 1].value.typeObj : null,
left2_Type = pos - 1 > 0 ? this.content[pos - 2].value.typeObj : null,
left3_Type = pos - 2 > 0 ? this.content[pos - 3].value.typeObj : null,
rightType = pos < this.content.length - 1 ? this.content[pos + 1].value.typeObj : null,
right2_Type = pos + 1 < this.content.length - 1 ? this.content[pos + 2].value.typeObj : null;
var bLeftComp = leftType == MATH_RUN_PRP && left2_Type == MATH_EMPTY && left3_Type == MATH_COMP,
bLeftLetter = leftType == MATH_TEXT || (leftType == MATH_RUN_PRP && left2_Type == MATH_TEXT);
var bRightComp = rightType == MATH_COMP,
bRightLetter = rightType == MATH_TEXT || rightType == MATH_RUN_PRP && right2_Type == MATH_TEXT;
if(bPlus || bMinus || bEqual)
{
if(bLeftComp || bLeftLetter)
{
var rPrp = this.getRPrpByPosition(pos);
var txtPrp = new CMathTextPrp();
txtPrp.Merge(this.Composition.DEFAULT_RUN_PRP);
txtPrp.Merge(rPrp);
//txtPrp.Italic = false;
this.content[pos].gaps.left = 0.6*this.Composition.GetGapSign(oMeasure, txtPrp);
}
if(bRightComp || bRightLetter)
{
var rPrp = this.getRPrpByPosition(pos);
var txtPrp = new CMathTextPrp();
txtPrp.Merge(this.Composition.DEFAULT_RUN_PRP);
txtPrp.Merge(rPrp);
//txtPrp.Italic = false;
this.content[pos].gaps.right = 0.5*this.Composition.GetGapSign(oMeasure, txtPrp);
}
}
},
old_draw: function(pGraphics) old_draw: function(pGraphics)
{ {
var bHidePlh = this.plhHide && this.IsPlaceholder(); var bHidePlh = this.plhHide && this.IsPlaceholder();
...@@ -4770,7 +4835,7 @@ CMathContent.prototype = ...@@ -4770,7 +4835,7 @@ CMathContent.prototype =
{ {
for(var i = 1; i <this.content.length; i++) for(var i = 1; i <this.content.length; i++)
{ {
this.content[i].widthToEl = this.content[i-1].widthToEl + this.content[i].value.size.width + this.content[i].g_mContext.left + this.content[i].g_mContext.right; this.content[i].widthToEl = this.content[i-1].widthToEl + this.content[i].value.size.width + this.content[i].gaps.left + this.content[i].gaps.right;
} }
}, },
update_Cursor: function() update_Cursor: function()
...@@ -4796,19 +4861,19 @@ CMathContent.prototype = ...@@ -4796,19 +4861,19 @@ CMathContent.prototype =
{ {
var x = msCoord.x; var x = msCoord.x;
var y = msCoord.y; var y = msCoord.y;
if( 0 <= x && x <= this.g_mContext.left ) if( 0 <= x && x <= this.gaps.left )
x = 0; x = 0;
else if( (this.size.width - this.g_mContext.right) <= x && x <= this.size.width) else if( (this.size.width - this.gaps.right) <= x && x <= this.size.width)
x = this.size.width - this.g_mContext.right - this.g_mContext.left; x = this.size.width - this.gaps.right - this.gaps.left;
else else
x -= this.g_mContext.left; x -= this.gaps.left;
if( 0 <= y && y <= this.g_mContext.top ) if( 0 <= y && y <= this.gaps.top )
y = 0; y = 0;
else if( (this.size.height - this.g_mContext.bottom) <= y && y <= this.size.height ) else if( (this.size.height - this.gaps.bottom) <= y && y <= this.size.height )
y = this.size.height - this.g_mContext.top - this.g_mContext.bottom; y = this.size.height - this.gaps.top - this.gaps.bottom;
else else
y -= this.g_mContext.top; y -= this.gaps.top;
return {x: x, y: y}; return {x: x, y: y};
}, },
...@@ -4821,7 +4886,7 @@ CMathContent.prototype = ...@@ -4821,7 +4886,7 @@ CMathContent.prototype =
while( pos < (this.content.length - 1) && this.content[pos].widthToEl < mouseX ) while( pos < (this.content.length - 1) && this.content[pos].widthToEl < mouseX )
pos++; pos++;
var gps = this.content[pos].g_mContext; var gps = this.content[pos].gaps;
var width = this.content[pos].value.size.width; var width = this.content[pos].value.size.width;
var widthToEl = this.content[pos].widthToEl; var widthToEl = this.content[pos].widthToEl;
...@@ -4866,7 +4931,7 @@ CMathContent.prototype = ...@@ -4866,7 +4931,7 @@ CMathContent.prototype =
var X; var X;
var Y; var Y;
var gps = this.content[index].g_mContext; var gps = this.content[index].gaps;
if( widthToPrev <= mCoord.x && mCoord.x <= (widthToPrev + gps.left) ) if( widthToPrev <= mCoord.x && mCoord.x <= (widthToPrev + gps.left) )
X = 0; X = 0;
else if( (widthToCur - gps.right) <= mCoord.x && mCoord.x <= widthToCur ) else if( (widthToCur - gps.right) <= mCoord.x && mCoord.x <= widthToCur )
...@@ -4874,12 +4939,12 @@ CMathContent.prototype = ...@@ -4874,12 +4939,12 @@ CMathContent.prototype =
else else
X = mCoord.x - widthToPrev - gps.left; X = mCoord.x - widthToPrev - gps.left;
if( mCoord.y <= (this.size.center - this.g_mContext.top - this.content[index].value.size.center) ) if( mCoord.y <= (this.size.center - this.gaps.top - this.content[index].value.size.center) )
Y = 0; Y = 0;
else if( mCoord.y >= this.size.center - this.g_mContext.top + this.content[index].value.size.height - this.content[index].value.size.center ) else if( mCoord.y >= this.size.center - this.gaps.top + this.content[index].value.size.height - this.content[index].value.size.center )
Y = this.content[index].value.size.height; Y = this.content[index].value.size.height;
else else
Y = mCoord.y - (this.size.center - this.g_mContext.top - this.content[index].value.size.center); Y = mCoord.y - (this.size.center - this.gaps.top - this.content[index].value.size.center);
return {x: X, y: Y}; return {x: X, y: Y};
}, },
...@@ -4890,7 +4955,7 @@ CMathContent.prototype = ...@@ -4890,7 +4955,7 @@ CMathContent.prototype =
var X; var X;
var Y; var Y;
var gps = this.content[index].g_mContext; var gps = this.content[index].gaps;
if( widthToPrev <= mCoord.x && mCoord.x <= (widthToPrev + gps.left) ) if( widthToPrev <= mCoord.x && mCoord.x <= (widthToPrev + gps.left) )
X = 0; X = 0;
else if( (widthToCur - gps.right) <= mCoord.x && mCoord.x <= widthToCur ) else if( (widthToCur - gps.right) <= mCoord.x && mCoord.x <= widthToCur )
...@@ -5463,7 +5528,7 @@ CMathContent.prototype = ...@@ -5463,7 +5528,7 @@ CMathContent.prototype =
}, },
old_setPosition: function(pos) old_setPosition: function(pos)
{ {
this.pos = { x: pos.x + this.g_mContext.left, y: pos.y}; this.pos = { x: pos.x + this.gaps.left, y: pos.y};
var max_cent = this.size.center; var max_cent = this.size.center;
//var txtPrp = this.getTxtPrp(); //var txtPrp = this.getTxtPrp();
...@@ -5478,7 +5543,7 @@ CMathContent.prototype = ...@@ -5478,7 +5543,7 @@ CMathContent.prototype =
for(var i=1; i < this.content.length;i++) for(var i=1; i < this.content.length;i++)
{ {
var t = {x: this.pos.x + this.content[i-1].widthToEl + this.content[i].g_mContext.left, y: this.pos.y + max_cent }; var t = {x: this.pos.x + this.content[i-1].widthToEl + this.content[i].gaps.left, y: this.pos.y + max_cent };
if( this.content[i].value.typeObj !== MATH_COMP ) if( this.content[i].value.typeObj !== MATH_COMP )
t.y += baseLine; t.y += baseLine;
...@@ -5493,7 +5558,7 @@ CMathContent.prototype = ...@@ -5493,7 +5558,7 @@ CMathContent.prototype =
{ {
var t = var t =
{ {
x: this.pos.x + this.content[i-1].widthToEl + this.content[i].g_mContext.left, x: this.pos.x + this.content[i-1].widthToEl + this.content[i].gaps.left,
y: this.pos.y + this.size.ascent //baseline y: this.pos.y + this.size.ascent //baseline
}; };
...@@ -5676,7 +5741,7 @@ CMathContent.prototype = ...@@ -5676,7 +5741,7 @@ CMathContent.prototype =
{ {
var txtPrp; var txtPrp;
if(this.bRoot) if(this.bRoot)
txtPrp = this.Composition.DefaultTxtPrp; txtPrp = this.Composition.DEFAULT_RUN_PRP;
else else
txtPrp = this.Parent.getCtrPrp(); txtPrp = this.Parent.getCtrPrp();
...@@ -5704,7 +5769,7 @@ CMathContent.prototype = ...@@ -5704,7 +5769,7 @@ CMathContent.prototype =
if(this.bRoot && bEmpty) if(this.bRoot && bEmpty)
{ {
var rPrp = this.Composition.DefaultTxtPrp; var rPrp = this.Composition.DEFAULT_RUN_PRP;
this.addRunPrp(rPrp); this.addRunPrp(rPrp);
} }
else if(bEmpty) else if(bEmpty)
...@@ -5775,7 +5840,7 @@ CMathContent.prototype = ...@@ -5775,7 +5840,7 @@ CMathContent.prototype =
if(this.bRoot && bEmpty) if(this.bRoot && bEmpty)
{ {
var rPrp = this.Composition.DefaultTxtPrp; var rPrp = this.Composition.DEFAULT_RUN_PRP;
this.addRunPrp(rPrp); this.addRunPrp(rPrp);
} }
else if(bEmpty) else if(bEmpty)
...@@ -6274,7 +6339,7 @@ CMathContent.prototype = ...@@ -6274,7 +6339,7 @@ CMathContent.prototype =
end = this.RealSelect.endPos - 1; end = this.RealSelect.endPos - 1;
var beforeSelect = this.content[start].widthToEl, var beforeSelect = this.content[start].widthToEl,
afterSelect = this.content[end].widthToEl + this.content[end].g_mContext.right; afterSelect = this.content[end].widthToEl + this.content[end].gaps.right;
flag = beforeSelect <= x && x <= afterSelect; flag = beforeSelect <= x && x <= afterSelect;
} }
...@@ -6465,6 +6530,20 @@ CMathComposition.prototype = ...@@ -6465,6 +6530,20 @@ CMathComposition.prototype =
{ {
this.Root.setFont(font); this.Root.setFont(font);
}, },
GetShiftCenter: function(oMeasure, font)
{
oMeasure.SetFont(font);
var metrics = oMeasure.Measure2Code(8727); // "+"
return 0.6*metrics.Height;
},
GetGapSign: function(oMeasure, font)
{
oMeasure.SetFont(font);
var metrics = oMeasure.Measure2Code(0x2217); // "+"
return metrics.Height;
},
CheckTarget: function() CheckTarget: function()
{ {
var bSelect = this.SelectContent.selectUse(), var bSelect = this.SelectContent.selectUse(),
...@@ -6921,7 +7000,7 @@ CMathComposition.prototype = ...@@ -6921,7 +7000,7 @@ CMathComposition.prototype =
Init: function() Init: function()
{ {
this.Root = new CMathContent(); this.Root = new CMathContent();
//this.Root.g_mContext = gps; //this.Root.gaps = gps;
this.Root.setComposition(this); this.Root.setComposition(this);
//this.SetTestRunPrp(); //this.SetTestRunPrp();
//this.Root.setTxtPrp(this.TxtPrp); //this.Root.setTxtPrp(this.TxtPrp);
...@@ -6940,7 +7019,7 @@ CMathComposition.prototype = ...@@ -6940,7 +7019,7 @@ CMathComposition.prototype =
},*/ },*/
GetTxtPrp: function() GetTxtPrp: function()
{ {
return this.DefaultTxtPrp; return this.DEFAULT_RUN_PRP;
}, },
//TODO //TODO
// position вычислить естественно до того, как придет Draw, чтобы не пришлось пересчитывать при изменении в тексте документа // position вычислить естественно до того, как придет Draw, чтобы не пришлось пересчитывать при изменении в тексте документа
...@@ -7051,6 +7130,9 @@ CMathComposition.prototype = ...@@ -7051,6 +7130,9 @@ CMathComposition.prototype =
}, },
Remove: function(order, bOnAdd) Remove: function(order, bOnAdd)
{ {
// test
TEST_VAL++;
//
////* History *///// ////* History */////
History.Create_NewPoint(); History.Create_NewPoint();
...@@ -7310,7 +7392,7 @@ function TEST_MATH_EDIT() ...@@ -7310,7 +7392,7 @@ function TEST_MATH_EDIT()
{ {
//MathComposition.test_for_edit(); //MathComposition.test_for_edit();
MathComposition.test_for_edit(); MathComposition.test_for_edit();
MathComposition.RecalculateComposition(g_oTextMeasurer, MathComposition.DefaultTxtPrp); MathComposition.RecalculateComposition(g_oTextMeasurer, MathComposition.DEFAULT_RUN_PRP);
//MathComposition.Draw_2(x, y, ) //MathComposition.Draw_2(x, y, )
......
...@@ -78,10 +78,10 @@ CMathText.prototype = ...@@ -78,10 +78,10 @@ CMathText.prototype =
{ {
add: function(code) add: function(code)
{ {
if(code == 42) // "*" if(code == 0x2A) // "*"
code = 8727; code = 0x2217;
else if(code == 45) // "-" else if(code == 0x2D) // "-"
code = 8722; code = 0x2212;
this.value = code; this.value = code;
}, },
...@@ -145,6 +145,10 @@ CMathText.prototype = ...@@ -145,6 +145,10 @@ CMathText.prototype =
return code; return code;
}, },
getCodeChr: function()
{
return this.value;
},
fillPlaceholders: function() fillPlaceholders: function()
{ {
this.typeObj = MATH_PLACEHOLDER; this.typeObj = MATH_PLACEHOLDER;
......
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