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