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

1. Реализовала свойство grow для CDelimiters (специально беру собственные...

1. Реализовала свойство grow для CDelimiters (специально беру собственные глифы, а не обычные текстовые символы, 
чтобы учесть небольшое расстяние (н-р, для линий, двойных линий, различных квадратных скобок) )
2. Поправила gaps для Delimiters : если скобки расстягиваются (grow = true), подхватываются gaps Child 
(крайних мат объектов внутреннего контента)
3. Поправила ascent для Delimiters со свойством shape Math, когда в контенте был текст (например, "a")

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@58476 954022d7-b5bf-4e40-9824-e11837661b57
parent cb4d962f
...@@ -503,7 +503,7 @@ CMathBase.prototype = ...@@ -503,7 +503,7 @@ CMathBase.prototype =
{ {
var kind = this.kind; var kind = this.kind;
var gaps = {left: 0, right: 0}; var gaps = {left: 0, right: 0};
var checkBase = kind == MATH_DEGREE || kind == MATH_DEGREESubSup || kind == MATH_ACCENT || kind == MATH_RADICAL|| kind == MATH_BOX || kind == MATH_BORDER_BOX; var checkBase = kind == MATH_DEGREE || kind == MATH_DEGREESubSup || kind == MATH_ACCENT || kind == MATH_RADICAL|| kind == MATH_BOX || kind == MATH_BORDER_BOX || (kind == MATH_DELIMITER && this.Pr.grow == true);
if(checkBase) if(checkBase)
{ {
......
...@@ -734,7 +734,7 @@ CMathGapsInfo.prototype = ...@@ -734,7 +734,7 @@ CMathGapsInfo.prototype =
checkGapKind: function(kind) checkGapKind: function(kind)
{ {
var bEmptyGaps = kind == MATH_DELIMITER || kind == MATH_MATRIX, var bEmptyGaps = kind == MATH_DELIMITER || kind == MATH_MATRIX,
bChildGaps = kind == MATH_DEGREE || kind == MATH_DEGREESubSup || kind == MATH_ACCENT || kind == MATH_RADICAL|| kind == MATH_BOX || kind == MATH_BORDER_BOX; bChildGaps = kind == MATH_DEGREE || kind == MATH_DEGREESubSup || kind == MATH_ACCENT || kind == MATH_RADICAL|| kind == MATH_BOX || kind == MATH_BORDER_BOX || (kind == MATH_DELIMITER);
return {bEmptyGaps: bEmptyGaps, bChildGaps: bChildGaps}; return {bEmptyGaps: bEmptyGaps, bChildGaps: bChildGaps};
} }
......
...@@ -2177,6 +2177,7 @@ function COperator(type) ...@@ -2177,6 +2177,7 @@ function COperator(type)
this.code = null; this.code = null;
this.typeOper = null; // тип скобки : круглая и т.п. this.typeOper = null; // тип скобки : круглая и т.п.
this.defaultType = null; this.defaultType = null;
this.grow = true;
this.Positions = []; this.Positions = [];
this.coordGlyph = null; this.coordGlyph = null;
...@@ -2187,6 +2188,8 @@ COperator.prototype.mergeProperties = function(properties, defaultProps) // pr ...@@ -2187,6 +2188,8 @@ COperator.prototype.mergeProperties = function(properties, defaultProps) // pr
{ {
var props = this.getProps(properties, defaultProps); var props = this.getProps(properties, defaultProps);
this.grow = properties.grow;
var operator = null, var operator = null,
typeOper = null, typeOper = null,
codeChr = null; codeChr = null;
...@@ -2199,7 +2202,15 @@ COperator.prototype.mergeProperties = function(properties, defaultProps) // pr ...@@ -2199,7 +2202,15 @@ COperator.prototype.mergeProperties = function(properties, defaultProps) // pr
////////// delimiters ////////// ////////// delimiters //////////
if( code === 0x28 || type === PARENTHESIS_LEFT) /* if(type == OPERATOR_GROW_TEXT) // для случая grow у Delimiters, чтобы избежать использования собственных глифов
{
codeChr = code;
typeOper = OPERATOR_GROW_TEXT;
operator = new CMathText(true);
operator.add(code);
}
else */if( code === 0x28 || type === PARENTHESIS_LEFT)
{ {
codeChr = 0x28; codeChr = 0x28;
typeOper = PARENTHESIS_LEFT; typeOper = PARENTHESIS_LEFT;
...@@ -2912,11 +2923,6 @@ COperator.prototype.getProps = function(props, defaultProps) ...@@ -2912,11 +2923,6 @@ COperator.prototype.getProps = function(props, defaultProps)
var bDelimiter = this.type == OPER_DELIMITER || this.type == OPER_SEPARATOR, var bDelimiter = this.type == OPER_DELIMITER || this.type == OPER_SEPARATOR,
bNotType = typeof(props.type) == "undefined" || props.type == null, bNotType = typeof(props.type) == "undefined" || props.type == null,
bUnicodeChr = props.chr !== null && props.chr+0 == props.chr; bUnicodeChr = props.chr !== null && props.chr+0 == props.chr;
//bStr = typeof(chr) === "string",
//bEmptyStr = bStr && chr.length == 0,
//bCode = typeof(chr) === "string" && chr.length > 0;
//var code = bCode ? chr.charCodeAt(0) : null;
if(bDelimiter && props.chr == -1) // empty operator if(bDelimiter && props.chr == -1) // empty operator
...@@ -2928,23 +2934,6 @@ COperator.prototype.getProps = function(props, defaultProps) ...@@ -2928,23 +2934,6 @@ COperator.prototype.getProps = function(props, defaultProps)
type = defaultProps.type; type = defaultProps.type;
} }
/*var bDPrpDelim = bDelimiter && bNotType && !bStr,
bDPrpOther = !bDelimiter && bNotType && !bCode;
var bDefault = bDPrpDelim || bDPrpOther,
bEmpty = bDelimiter && bEmptyStr;
if(bDefault)
{
type = defaultProps.type;
}
else if(bEmpty)
{
type = OPERATOR_EMPTY;
}*/
var bLoc = props.loc !== null && typeof(props.loc)!== "undefined"; var bLoc = props.loc !== null && typeof(props.loc)!== "undefined";
var bDefaultLoc = defaultProps.loc !== null && typeof(defaultProps.loc)!== "undefined"; var bDefaultLoc = defaultProps.loc !== null && typeof(defaultProps.loc)!== "undefined";
...@@ -3056,7 +3045,8 @@ COperator.prototype.fixSize = function(ParaMath, oMeasure, stretch) ...@@ -3056,7 +3045,8 @@ COperator.prototype.fixSize = function(ParaMath, oMeasure, stretch)
} }
else else
{ {
this.operator.fixSize(stretch); var StretchLng = this.grow == true ? stretch : 0;
this.operator.fixSize(StretchLng);
dims = this.operator.getCoordinateGlyph(); dims = this.operator.getCoordinateGlyph();
this.coordGlyph = {XX: dims.XX, YY: dims.YY}; this.coordGlyph = {XX: dims.XX, YY: dims.YY};
...@@ -3450,11 +3440,13 @@ CDelimiter.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize) ...@@ -3450,11 +3440,13 @@ CDelimiter.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
{ {
chr: this.Pr.begChr, chr: this.Pr.begChr,
type: this.Pr.begChrType, type: this.Pr.begChrType,
grow: this.Pr.grow,
loc: LOCATION_LEFT loc: LOCATION_LEFT
}; };
var begDefaultPrp = var begDefaultPrp =
{ {
type: PARENTHESIS_LEFT type: PARENTHESIS_LEFT,
chr: 0x28
}; };
this.begOper.mergeProperties(begPrp, begDefaultPrp); this.begOper.mergeProperties(begPrp, begDefaultPrp);
this.begOper.relate(this); this.begOper.relate(this);
...@@ -3463,11 +3455,13 @@ CDelimiter.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize) ...@@ -3463,11 +3455,13 @@ CDelimiter.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
{ {
chr: this.Pr.endChr, chr: this.Pr.endChr,
type: this.Pr.endChrType, type: this.Pr.endChrType,
grow: this.Pr.grow,
loc: LOCATION_RIGHT loc: LOCATION_RIGHT
}; };
var endDefaultPrp = var endDefaultPrp =
{ {
type: PARENTHESIS_RIGHT type: PARENTHESIS_RIGHT,
chr: 0x29
}; };
this.endOper.mergeProperties(endPrp, endDefaultPrp); this.endOper.mergeProperties(endPrp, endDefaultPrp);
...@@ -3477,11 +3471,13 @@ CDelimiter.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize) ...@@ -3477,11 +3471,13 @@ CDelimiter.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
{ {
chr: this.Pr.sepChr, chr: this.Pr.sepChr,
type: this.Pr.sepChrType, type: this.Pr.sepChrType,
grow: this.Pr.grow,
loc: LOCATION_SEP loc: LOCATION_SEP
}; };
var sepDefaultPrp = var sepDefaultPrp =
{ {
type: DELIMITER_LINE type: DELIMITER_LINE,
chr: 0x7C
}; };
if(this.nCol == 1 ) if(this.nCol == 1 )
...@@ -3544,7 +3540,6 @@ CDelimiter.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize) ...@@ -3544,7 +3540,6 @@ CDelimiter.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
// Общие высота и ascent // Общие высота и ascent
var height, ascent, descent; var height, ascent, descent;
if(this.Pr.shp == DELIMITER_SHAPE_CENTERED) if(this.Pr.shp == DELIMITER_SHAPE_CENTERED)
{ {
var deltaHeight = heightG - maxDimOper.height; var deltaHeight = heightG - maxDimOper.height;
...@@ -3557,15 +3552,15 @@ CDelimiter.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize) ...@@ -3557,15 +3552,15 @@ CDelimiter.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
var deltaMinAD = (heightG - maxAD) - maxDimOper.height/2; var deltaMinAD = (heightG - maxAD) - maxDimOper.height/2;
var bLHeight = deltaHeight < 0.001, var bLHeight = deltaHeight < 0.001,
bLMaxAD = deltaMaxAD > 0.001, bLMaxAD = deltaMaxAD > 0.001,
bLMinAD = deltaMinAD > 0.001, bLMinAD = deltaMinAD > 0.001,
bLText = deltaMinAD < - 0.001; bLText = deltaMinAD < - 0.001;
var bEqualOper = bLHeight, var bEqualOper = bLHeight,
bMiddleOper = bLMaxAD && !bLMinAD, bMiddleOper = bLMaxAD && !bLMinAD,
bLittleOper = bLMinAD, bLittleOper = bLMinAD,
bText = bLText; bText = bLText;
if(bEqualOper) if(bEqualOper)
{ {
...@@ -3592,8 +3587,19 @@ CDelimiter.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize) ...@@ -3592,8 +3587,19 @@ CDelimiter.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
} }
else else
{ {
ascent = ascentG; g_oTextMeasurer.SetFont(mgCtrPrp);
height = ascentG + descentG; var Height = g_oTextMeasurer.GetHeight();
if(heightG < Height)
{
ascent = ascentG > maxDimOper.ascent ? ascentG : maxDimOper.ascent;
height = maxDimOper.height;
}
else
{
ascent = ascentG;
height = ascentG + descentG;
}
} }
this.size = {width: width, height: height, ascent: ascent}; this.size = {width: width, height: height, ascent: ascent};
......
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