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

1. Поправила баг с позициями : элементы в Run могли заехать друг на друга...

1. Поправила баг с позициями : элементы в Run могли заехать друг на друга (случалось рандомно) => CMathPosition
2. Избавилась от старых классов для отрисовки глифов для CAccent
3. Добавила constructor в prototype CMathBase, CMathContent, CMathText

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@56398 954022d7-b5bf-4e40-9824-e11837661b57
parent 85630444
......@@ -399,7 +399,11 @@ ParaMath.prototype =
//this.Math.RecalculateComposition(g_oTextMeasurer, TextPr);
this.Root.Resize(null, this, g_oTextMeasurer, TextPr);
this.Root.setPosition({x: 0, y: 0});
var pos = new CMathPosition();
pos.x = 0;
pos.y = 0;
this.Root.setPosition(pos);
this.Width = this.Root.size.width;
this.Height = this.Root.size.height;
......
......@@ -7069,7 +7069,10 @@ function CRunCollaborativeRange(PosS, PosE, Color)
ParaRun.prototype.Math_SetPosition = function(_pos)
{
var pos = {x: _pos.x, y: _pos.y - this.size.ascent};
var pos = new CMathPosition();
pos.x = _pos.x;
pos.y = _pos.y - this.size.ascent;
for(var i = 0; i < this.Content.length; i++)
{
......
This diff is collapsed.
......@@ -6,7 +6,7 @@ function CMathBase()
CENTER = -1;
this.pos = null;
this.pos = new CMathPosition();
this.size = null;
// Properties
......@@ -69,6 +69,7 @@ function CMathBase()
}
CMathBase.prototype =
{
constructor: CMathBase,
setContent: function()
{
this.elements = new Array();
......
......@@ -30,8 +30,9 @@ function CBorderBox(props)
CMathBase.call(this);
this.init(props);
this.setCtrPrp(props.ctrPrp);
if(props !== null && typeof(props) !== "undefined")
this.init(props);
g_oTableId.Add(this, this.Id);
}
extend(CBorderBox, CMathBase);
......@@ -65,6 +66,9 @@ CBorderBox.prototype.init = function(props)
this.setDimension(1, 1);
this.setContent();
if(props.ctrPrp !== null && typeof(props.ctrPrp) !== "undefined")
this.setCtrPrp(props.ctrPrp);
}
CBorderBox.prototype.setBorders = function(props)
{
......@@ -574,7 +578,8 @@ function CBox(props)
CMathBase.call(this);
this.init(props);
if(props !== null && typeof(props) !== "undefined")
this.init(props);
g_oTableId.Add( this, this.Id );
}
......@@ -712,7 +717,8 @@ function CBar(props)
CCharacter.call(this);
this.init(props);
if(props !== null && typeof(props) !== "undefined")
this.init(props);
g_oTableId.Add( this, this.Id );
}
......@@ -823,7 +829,8 @@ CBar.prototype.Read_FromBinary2 = function( Reader )
var Flags = Reader.GetLong();
if ( Flags & 1 )
this.pos = Reader.GetString2();
this.loc = Reader.GetString2();
//this.pos = Reader.GetString2();
}
CBar.prototype.Get_Id = function()
{
......@@ -837,7 +844,10 @@ function CPhantom(props)
CMathBase.call(this);
this.init(props);
this.setCtrPrp(props.ctrPrp);
if(props !== null && typeof(props) !== "undefined")
this.setCtrPrp(props.ctrPrp);
g_oTableId.Add( this, this.Id );
}
extend(CPhantom, CMathBase);
......@@ -846,6 +856,9 @@ CPhantom.prototype.init = function(props)
this.props = props;
this.setDimension(1, 1);
this.setContent();
if(props.ctrPrp !== null && typeof(props.ctrPrp) !== "undefined")
this.setCtrPrp(props.ctrPrp);
}
CPhantom.prototype.getPropsForWrite = function()
{
......
......@@ -914,6 +914,7 @@ function CMathContent()
}
CMathContent.prototype =
{
constructor: CMathContent,
init: function()
{
......
......@@ -52,16 +52,21 @@ CMathTextPrp.prototype =
this.Italic = prp.Italic;
}
}*/
function CMathPosition()
{
this.x = 0;
this.y = 0;
}
function CMathText(bJDraw)
{
this.typeObj = MATH_TEXT;
this.pos = null;
this.bJDraw = false;
this.size = null;
this.value = null;
this.pos = new CMathPosition();
this.bJDraw = false;
if(bJDraw === false || bJDraw === true)
this.bJDraw = bJDraw;
......@@ -91,6 +96,7 @@ function CMathText(bJDraw)
}
CMathText.prototype =
{
constructor: CMathText,
add: function(code)
{
if(code == 0x2A) // "*"
......@@ -233,10 +239,6 @@ CMathText.prototype =
this.typeObj = MATH_PLACEHOLDER;
this.value = StartTextElement;
},
setLIterator: function(bIterator)
{
this.bIterator = bIterator; // символы другие , чуть толще
},
Resize: function(Run, oMeasure)
{
/*
......@@ -277,12 +279,9 @@ CMathText.prototype =
},
draw: function(x, y, pGraphics)
{
var X = this.pos.x + x,
Y = this.pos.y + y;
//console.log(String.fromCharCode(this.getCode()) + ": X " + X);
/*var tx = 0;
var ty = 0;
......@@ -314,13 +313,16 @@ CMathText.prototype =
setPosition: function(pos)
{
if( ! this.bJDraw) // for text
this.pos = {x : pos.x + this.GapLeft, y: pos.y};
else // for symbol only drawing
{
var x = pos.x - this.rasterOffsetX,
y = pos.y - this.rasterOffsetY;
this.pos.x = pos.x + this.GapLeft;
this.pos.y = pos.y;
this.pos = {x: x, y: y};
//this.pos = {x : pos.x + this.GapLeft, y: pos.y};
}
else // for symbol only drawing
{
this.pos.x = pos.x - this.rasterOffsetX;
this.pos.y = pos.y - this.rasterOffsetY;
}
},
setCoeffTransform: function(sx, shx, shy, sy)
......
......@@ -200,5 +200,4 @@ var extend = function(Child, Parent)
Child.prototype = new F();
Child.prototype.constructor = Child;
Child.superclass = Parent.prototype;
}
......@@ -410,7 +410,6 @@ CMathMatrix.prototype.findDistance = function() // для получения п
return {w : w, h: h };
}
CMathMatrix.prototype.addRow = function()
{
this.nRow++;
......
......@@ -4414,7 +4414,8 @@ CGroupCharacter.prototype.Read_FromBinary2 = function( Reader )
if ( Flags & 1 )
this.chr = Reader.GetLong();
if ( Flags & 2 )
this.pos = Reader.GetLong();
this.loc = Reader.GetLong();
//this.pos = Reader.GetLong();
if ( Flags & 4 )
this.vertJc = Reader.GetLong();
}
......
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