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

degree of root

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@47441 954022d7-b5bf-4e40-9824-e11837661b57
parent 8c48961a
......@@ -306,7 +306,7 @@ CControlComposition.prototype =
{
editor.WordControl.m_oLogicDocument.DrawingDocument.OnRecalculatePage(0, editor.WordControl.m_oLogicDocument.Pages[0]);
this.Content[this.CurPos].Add(code);
this.Content[this.CurPos].AddLetter(code);
return true;
}
......
......@@ -1004,5 +1004,11 @@ CMathBase.prototype =
{
this.recalculateSize();
return this.Parent;
},
hidePlaceholder: function(flag)
{
for(var i=0; i < this.nRow; i++)
for(var j = 0; j < this.nCol; j++)
this.elements[i][j].hidePlaceholder(flag);
}
}
function CBarFraction()
{
CMathBase.call(this,2,1);
......@@ -68,6 +66,54 @@ CNumerator.prototype.recalculateSize = function()
this.size = {width : width, height: height, center: center};
}
CNumerator.prototype.new_recalculateSize = function()
{
var arg = this.elements[0][0].size;
var metrics = this.params.font.metrics;
var penW = this.params.font.FontSize* 25.4/96 * 0.08;
var Descent = arg.height - arg.center - metrics.Placeholder.Height*DIV_CENTER; // baseLine
//var gap = metrics.Height - metrics.Placeholder.Height + metrics.Descender,
var gap = metrics.Descender + 2*penW *1.8,
minGap = 2*penW;
var delta = gap - Descent;
var GapNum = delta > minGap ? delta : minGap;
var width = arg.width;
var height = arg.height + GapNum;
var center = arg.center;
this.size = {width : width, height: height, center: center};
}
CNumerator.prototype.n_recalculateSize = function()
{
var arg = this.elements[0][0].size;
var metrics = this.params.font.metrics;
//var penW = this.params.font.FontSize* 25.4/96 * 0.08;
var DescentFirst = arg.height - arg.center - metrics.Placeholder.Height*DIV_CENTER; // baseLine
//var gap = metrics.Height - 2.8*metrics.Descender; // 8 pt
//var gap = metrics.Height - 1.5*metrics.Descender;
var gap = metrics.Height - (2.96 - 0.02*this.params.font.FontSize)*metrics.Descender;
var penW = this.params.font.FontSize/47;
// 20 7
// 60 21
var gapNum = DescentFirst - 2*penW < 0.55*gap ? 0.55*gap - DescentFirst : 2*penW;
var width = arg.width;
var height = arg.height + gapNum;
var center = arg.center;
this.size = {width : width, height: height, center: center};
}
CNumerator.prototype.findDisposition = function(mCoord)
{
var arg = this.elements[0][0].size;
......@@ -102,7 +148,6 @@ CDenominator.prototype.recalculateSize = function()
Ascent = arg.center - metrics.Placeholder.Height/2,
minGap = this.params.font.FontSize* 25.4/96 * 0.24;
var delta = 0.47*gap - Ascent;
var GapDen = delta > minGap ? delta : minGap;
......@@ -112,6 +157,52 @@ CDenominator.prototype.recalculateSize = function()
this.size = {width : width, height: height, center: center};
}
CDenominator.prototype.new_recalculateSize = function()
{
var arg = this.elements[0][0].size;
var metrics = this.params.font.metrics;
var gap = metrics.Height - metrics.Placeholder.Height - metrics.Descender,
Ascent = arg.center + metrics.Placeholder.Height*DIV_CENTER - metrics.Placeholder.Height,
minGap = this.params.font.FontSize* 25.4/96 * 0.24 * 1.23;
var delta = gap - Ascent;
var GapDen = delta > minGap ? delta : minGap;
var width = arg.width;
var height = arg.height + GapDen;
var center = arg.center + GapDen;
this.size = {width : width, height: height, center: center};
}
CDenominator.prototype.n_recalculateSize = function()
{
var arg = this.elements[0][0].size;
var metrics = this.params.font.metrics;
var AscentSecond = arg.center + metrics.Placeholder.Height*DIV_CENTER;
//var gap = metrics.Height - 2.8*metrics.Descender; // 8 pt
//var gap = metrics.Height - 1.5*metrics.Descender; // 72 pt
var gap = metrics.Height - (2.96 - 0.02*this.params.font.FontSize)*metrics.Descender;
// a*x + b = c
// a*8 + b = 2.8
// a*72 + b = 1.5
// a = - 1.3/64
// b = 2.96
var penW = this.params.font.FontSize/47;
var gapDen = AscentSecond - 3*penW < 0.45*gap ? 0.45*gap - AscentSecond : 3*penW;
var width = arg.width;
var height = arg.height + gapDen;
var center = arg.center + gapDen;
this.size = {width : width, height: height, center: center};
}
CDenominator.prototype.findDisposition = function(mCoord)
{
var arg = this.elements[0][0].size;
......
This diff is collapsed.
......@@ -8,6 +8,8 @@
//api 2212: asc_docs_api.prototype.sync_TextPrFontFamilyCallBack
// возвращает название шрифта
var DIV_CENTER = 0.375;
function CMathText(params)
{
this.pos = null;
......@@ -58,7 +60,7 @@ CMathText.prototype =
var _descent = (metricsTxt.Height - metricsTxt.Ascent);
var _height = _ascent + _descent;
var placeholder = this.metrics.Placeholder;
var _center = _ascent - placeholder.Height*0.375;
var _center = _ascent - placeholder.Height*DIV_CENTER;
this.sizeSymbol = {width: _width, height: _height, center: _center, ascent: _ascent, descent: _descent};
this.size = {width: _width, height: _height, center: _center, ascent: _ascent, descent: _descent, gap: 0 };
......
......@@ -19,6 +19,8 @@ function CMathMatrix( numRow, numCol)
minGap: 0 // minGap / 20 pt
};
this.baseJc = 0;
}
extend(CMathMatrix, CMathBase);
CMathMatrix.prototype.init = function(params)
......@@ -29,6 +31,7 @@ CMathMatrix.prototype.setContent = function()
{
CMathMatrix.superclass.fillPlaceholders.call(this);
}
CMathMatrix.prototype.old_getLineGap = function(spaceLine)
{
var metrs = this.params.font.metrics;
......@@ -74,16 +77,17 @@ CMathMatrix.prototype.old_recalculateSize = function()
this.size = {width: width, height: height, center: height/2};
}
CMathMatrix.prototype.setLineGapColumn = function(coeff)
CMathMatrix.prototype.old_setLineGapColumn = function(coeff)
{
this.lineGapColumn = coeff;
this.recalculateSize();
}
CMathMatrix.prototype.setLineGapRow = function(coeff)
CMathMatrix.prototype.old_setLineGapRow = function(coeff)
{
this.lineGapRow = coeff;
this.recalculateSize();
}
CMathMatrix.prototype.recalculateSize = function()
{
this.gaps = {row: new Array(), column: new Array()};
......@@ -115,7 +119,29 @@ CMathMatrix.prototype.recalculateSize = function()
for(var j = 0; j < this.nRow; j++)
height += this.gaps.row[j] + metrics.ascents[j] + metrics.descents[j];
this.size = {width: width, height: height, center: height/2};
var center = 0;
if(this.baseJc == 1)
{
for(var j = 0; j < this.nCol; j++)
center = this.elements[0][j].size.center > center ? this.elements[0][j].size.center : center;
}
else if(this.baseJc == 2)
{
var descent = 0,
currDsc;
for(var j = 0; j < this.nCol; j++)
{
currDsc = this.elements[this.nRow -1][j].size.height - this.elements[this.nRow -1][j].size.center;
descent = currDsc > descent ? currDsc : descent;
center = height - descent;
}
}
else /*this.baseJc == 0*/
center = height/2;
this.size = {width: width, height: height, center: center};
}
CMathMatrix.prototype.setPosition = function(pos)
......@@ -144,6 +170,7 @@ CMathMatrix.prototype.setPosition = function(pos)
}
}
CMathMatrix.prototype.old_old_findDisposition = function( coord )
{
var pos_x = this.nRow - 1, pos_y = this.nCol - 1,
......@@ -217,6 +244,7 @@ CMathMatrix.prototype.old_old_findDisposition = function( coord )
return {pos: {x: pos_x, y: pos_y }, mCoord: {x: mX, y: mY}, flag: flag};
}
CMathMatrix.prototype.findDisposition = function( coord )
{
var mouseCoord = {x: null, y: null},
......@@ -319,7 +347,7 @@ CMathMatrix.prototype.getMetrics = function()
return {ascents: Ascents, descents: Descents, widths: Widths}
}
CMathMatrix.prototype.findDistance = function()
CMathMatrix.prototype.findDistance = function() // для получения позиции тагета
{
var w = 0, h = 0;
//кол-во элементов gap равно кол-ву элементов в строке/столбце для удобства подсчета
......@@ -393,7 +421,7 @@ CMathMatrix.prototype.getLineGap = function(space)
return lineGap;
}
////
CMathMatrix.prototype.old_getRowSpace = function(space)
{
var spLine;
......@@ -415,9 +443,9 @@ CMathMatrix.prototype.old_getRowSpace = function(space)
var lineGap;
/*if(space.rule == 3)
lineGap = spLine*g_dKoef_pt_to_mm; //pt
else
lineGap = spLine*this.params.font.FontSize*g_dKoef_pt_to_mm; //em*/
lineGap = spLine*g_dKoef_pt_to_mm; //pt
else
lineGap = spLine*this.params.font.FontSize*g_dKoef_pt_to_mm; //em*/
lineGap = spLine*g_dKoef_pt_to_mm; //pt
......@@ -425,7 +453,6 @@ CMathMatrix.prototype.old_getRowSpace = function(space)
return lineGap;
}
CMathMatrix.prototype.getRowSpace = function(space)
{
var spLine;
......@@ -456,3 +483,15 @@ CMathMatrix.prototype.getRowSpace = function(space)
return lineGap;
}
CMathMatrix.prototype.baseJustification = function(type)
{
// 0 - center
// 1 - top
// 2 - bottom
this.baseJc = type;
}
////
......@@ -97,7 +97,6 @@ CBaseBracket.prototype.goToLowerLevel = function(coord){
content = null;
return {bLow: bLow, content: content};
}
function CParenthesis()
......
......@@ -120,13 +120,17 @@ function getStateHeight_2(height, GFont)
return state;
}
function getTypeDegree(IFont)
function getTypeDegree(IFont, flag)
{
var old_CONST_DEG = 0.728;
var CONST_DEG = 0.728;
var fontSize = null;
var sD = IFont.FontSize*CONST_DEG;
if(flag)
CONST_INDEX = 0.62;
else
CONST_INDEX = 0.728;
var sD = IFont.FontSize*CONST_INDEX;
if( sD - Math.floor(sD) > 0.65 )
fontSize = Math.ceil(sD) - 0.5;
else
......@@ -164,13 +168,16 @@ function getStateHeight_3( height, GFont) //for radical
GenHeight;
var gap = metric.Height - metric.Placeholder.Height;
var H1 = metric.Height,
var H0 = metric.Placeholder.Height,
H1 = metric.Height,
H2 = 2*metric.Placeholder.Height + 1.5*gap,
H3 = 3*metric.Placeholder.Height + 2.4*gap,
H4 = 4*metric.Placeholder.Height + 3*gap,
H5 = 5*metric.Placeholder.Height + 4*gap;
if( height < H1 )
if(height < H0)
GenHeight = H1*0.75;
else if( height < H1 )
GenHeight = H1;
else if( height < H2 )
GenHeight = H2;
......
This diff is collapsed.
......@@ -173,6 +173,7 @@
<script type="text/javascript" src ="Math/degree.js"></script>
<script type="text/javascript" src = "Math/matrix.js"></script>
<script type="text/javascript" src = "Math/matrix.js"></script>
<script type="text/javascript" src = "Math/minimax.js"></script>
<script type="text/javascript" src = "Math/logarithm.js"></script>
<script type="text/javascript" src = "Math/nary.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