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++)
{ {
......
...@@ -13,176 +13,6 @@ ...@@ -13,176 +13,6 @@
// 0x20D0 half left arrow (harpoon) // 0x20D0 half left arrow (harpoon)
// 0x20D1 half right arrow (harpoon) // 0x20D1 half right arrow (harpoon)
function CCircumflex()
{
//this.incline = 0;
this.Parent = null;
this.turn = TURN_0;
}
CCircumflex.prototype.init = function(props)
{
this.turn = props.turn;
}
CCircumflex.prototype.fixSize = function(oMeasure, stretch, bIncl)
{
var alpha = this.Parent.Get_CompiledCtrPrp().FontSize/36;
var width = 3.88*alpha;
var height = 3.175*alpha;
var augm = 0.9*stretch/width;
if(augm < 1)
augm = 1;
else if (augm > 5)
augm = 5;
/*var angle = 0.1;
if( bIncl )
this.incline = mSize.height*angle;*/
width *= augm;
/*var Arg = this.elements[0][0].size,
Accent = {width: augm*this.accentSize.width, height: this.accentSize.height};
var _height = Arg.height + Accent.height;
var _center = Arg.center + Accent.height;
var incline = 0;
if( this.IsIncline() )
incline = Arg.height*this.ANGLE;
if(Arg.width < Accent.width)
{
this.shiftAccent = incline;
this.shiftArg = (Arg.width - Accent.width)/2;
_width = Accent.width + incline;
}
else
{
var align = (Arg.width - Accent.width)/2 + incline;
_width = Arg.width > Accent.width + align ? Arg.width : Accent.width + align ;
this.shiftAccent = align;
this.shiftArg = 0;
}*/
this.size = {width: width, height: height};
}
CCircumflex.prototype.draw = function(x, y, pGraphics)
{
var xx = this.pos.x + x,
yy = this.pos.y + y;
var fontSize = this.Parent.Get_CompiledCtrPrp().FontSize;
var penW = fontSize*g_dKoef_pt_to_mm*this.PEN_W;
penW *= 96/25.4;
// g_dKoef_px_to_mm = 25.4/96
var textScale = fontSize/1000, // 1000 pt
alpha = textScale*25.4/96 /64;
var X = new Array(),
Y = new Array();
X[0] = 0; Y[0] = 2373;
X[1] = 9331; Y[1] = 15494;
X[2] = 14913; Y[2] = 15494;
X[3] = 23869; Y[3] = 2373;
X[4] = 20953; Y[4] = 0;
X[5] = 12122; Y[5] = 10118;
X[6] = 11664; Y[6] = 10118;
X[7] = 2833; Y[7] = 0;
X[8] = 0; Y[8] = 2373;
var XX = new Array(),
YY = new Array();
var W = this.size.width/alpha;
var a1 = X[3] - X[0], b1 = W, c1 = X[2] - X[1],
a2 = X[4] - X[7], b2 = W - 2*X[7], c2 = X[5] - X[6] ; //X[8] = 0
var RX = new Array();
for(var i = 0; i < X.length; i++)
RX[i] = 1;
RX[0] = RX[2] = (b1 - c1)/(a1-c1);
RX[4] = RX[6] = (b2 - c2)/(a2-c2);
XX[0] = XX[8] = X[0];
YY[0] = YY[8] = Y[0];
for(var i = 0; i< 4; i++)
{
XX[1 + i] = XX[i] + RX[i]*(X[1+i] - X[i]);
XX[7-i] = XX[8 - i] + RX[7-i]*(X[7-i] - X[8-i]);
YY[1+i] = Y[1+i];
YY[7-i] = Y[7-i];
}
var a,b;
if(this.turn == TURN_0) // вверх
{
a = 0;
b = 1;
}
else if(this.turn == TURN_MIRROR_0)
{
a = YY[1];
b = -1;
}
for(var i = 0; i < XX.length; i++)
{
XX[i] = xx + XX[i]*alpha ;
YY[i] = yy + (a + b*YY[i])*alpha;
}
var intGrid = pGraphics.GetIntegerGrid();
pGraphics.SetIntegerGrid(false);
pGraphics.p_width(penW*1000);
pGraphics.b_color1(0,0,0, 255);
pGraphics._s();
pGraphics._m(XX[0], YY[0]);
pGraphics._l(XX[1], YY[1]);
pGraphics._l(XX[2], YY[2]);
pGraphics._l(XX[3], YY[3]);
pGraphics._l(XX[4], YY[4]);
pGraphics._l(XX[5], YY[5]);
pGraphics._l(XX[6], YY[6]);
pGraphics._l(XX[7], YY[7]);
pGraphics._l(XX[8], YY[8]);
pGraphics._l(XX[9], YY[9]);
pGraphics._l(XX[10], YY[10]);
pGraphics._l(XX[11], YY[11]);
pGraphics.df();
pGraphics.SetIntegerGrid(intGrid);
}
CCircumflex.prototype.setPosition = function(pos)
{
this.pos = pos;
}
CCircumflex.prototype.relate = function(parent)
{
this.Parent = parent;
}
function CAccentCircumflex() function CAccentCircumflex()
{ {
CGlyphOperator.call(this); CGlyphOperator.call(this);
...@@ -286,61 +116,6 @@ CAccentCircumflex.prototype.drawPath = function(pGraphics, XX, YY) ...@@ -286,61 +116,6 @@ CAccentCircumflex.prototype.drawPath = function(pGraphics, XX, YY)
pGraphics._l(XX[11], YY[11]); pGraphics._l(XX[11], YY[11]);
} }
function CLine()
{
this.PEN_W = 0.04;
this.Parent = null;
}
CLine.prototype.init = function(props)
{
}
CLine.prototype.fixSize = function(oMeasure, stretch)
{
var alpha = this.Parent.Get_CompiledCtrPrp().FontSize/36;
var height = 1.68*alpha;
var width = 4.938*alpha;
width = stretch > width ? stretch : width;
this.size = {width: width, height: height}
}
CLine.prototype.draw = function(x, y, pGraphics)
{
var fontSize = this.Parent.Get_CompiledCtrPrp().FontSize;
var penW = fontSize*g_dKoef_pt_to_mm*this.PEN_W;
//penW *= 96/25.4;
//var penY = penW/2*25.4/96; //для того чтобы линии совпадали (для одинарной и двойной черты)
var penY = penW/2; //для того чтобы линии совпадали (для одинарной и двойной черты)
// g_dKoef_px_to_mm = 25.4/96
var shY = this.size.height * 0.15386904761904763; // чтобы линии совпадали
var x1 = this.pos.x + x,
y1 = this.pos.y + y + penY + shY,
x2 = x1 + this.size.width,
y2 = y1;
pGraphics.p_width(penW*1000);
pGraphics.p_color(0,0,0, 255);
pGraphics._s();
pGraphics._m(x1, y1);
pGraphics._l(x2, y2);
pGraphics.ds();
}
CLine.prototype.setPosition = function(pos)
{
this.pos = pos;
}
CLine.prototype.relate = function(parent)
{
this.Parent = parent;
}
function CAccentLine() function CAccentLine()
{ {
CGlyphOperator.call(this); CGlyphOperator.call(this);
...@@ -384,62 +159,6 @@ CAccentLine.prototype.drawPath = function(pGraphics, XX, YY) ...@@ -384,62 +159,6 @@ CAccentLine.prototype.drawPath = function(pGraphics, XX, YY)
pGraphics._l(XX[4], YY[4]); pGraphics._l(XX[4], YY[4]);
} }
function CDoubleLine()
{
this.PEN_W = 0.04;
this.Parent = null;
}
CDoubleLine.prototype.init = function(props)
{
}
CDoubleLine.prototype.fixSize = function(oMeasure, stretch)
{
var alpha = this.Parent.Get_CompiledCtrPrp().FontSize/36;
var height = 2.843*alpha;
var width = 4.938*alpha;
width = stretch > width ? stretch : width;
this.size = {width: width, height: height}
}
CDoubleLine.prototype.setPosition = function(pos)
{
this.pos = pos;
}
CDoubleLine.prototype.draw = function(x, y, pGraphics)
{
var fontSize = this.Parent.Get_CompiledCtrPrp().FontSize;
var penW = fontSize*g_dKoef_pt_to_mm*this.PEN_W;
//penW *= 96/25.4;
//var penY = penW/2*25.4/96; //для того чтобы линии совпадали (для одинарной и двойной черты)
var penY = penW/2; //для того чтобы линии совпадали (для одинарной и двойной черты)
var x1 = this.pos.x + x,
y1 = this.pos.y + y + penY,
x2 = x1 + this.size.width,
y2 = y1,
x3 = x1,
y3 = y1 + this.size.height/2,
x4 = x2,
y4 = y3;
pGraphics.p_width(penW*1000);
pGraphics.p_color(0,0,0, 255);
pGraphics._s();
pGraphics._m(x1, y1);
pGraphics._l(x2, y2);
pGraphics._m(x3, y3);
pGraphics._l(x4, y4);
pGraphics.ds();
}
CDoubleLine.prototype.relate = function(parent)
{
this.Parent = parent;
}
function CAccentDoubleLine() function CAccentDoubleLine()
{ {
...@@ -499,113 +218,6 @@ CAccentDoubleLine.prototype.drawPath = function(pGraphics, XX, YY) ...@@ -499,113 +218,6 @@ CAccentDoubleLine.prototype.drawPath = function(pGraphics, XX, YY)
} }
function CTilde()
{
}
CTilde.prototype.init = function(props)
{
}
CTilde.prototype.fixSize = function()
{
var betta = this.Parent.Get_CompiledCtrPrp().FontSize/36;
var width = 9.047509765625*betta; // реальная на отрисовке width 7.495282031249999
var height = 2.469444444444444*betta;
this.size = {width: width, height: height};
}
CTilde.prototype.draw = function(x, y, pGraphics)
{
var X = new Array(),
Y = new Array();
X[0] = 0; Y[0] = 3066;
X[1] = 2125; Y[1] = 7984;
X[2] = 5624; Y[2] = 11256;
X[3] = 9123; Y[3] = 14528;
X[4] = 13913; Y[4] = 14528;
X[5] = 18912; Y[5] = 14528;
X[6] = 25827; Y[6] = 10144;
X[7] = 32742; Y[7] = 5760;
X[8] = 36324; Y[8] = 5760;
X[9] = 39865; Y[9] = 5760;
X[10] = 42239; Y[10] = 7641;
X[11] = 44614; Y[11] = 9522;
X[12] = 47030; Y[12] = 13492;
X[13] = 50362; Y[13] = 11254;
X[14] = 48571; Y[14] = 7544;
X[15] = 44697; Y[15] = 3772;
X[16] = 40823; Y[16] = 0;
X[17] = 35283; Y[17] = 0;
X[18] = 29951; Y[18] = 0;
X[19] = 23098; Y[19] = 4384;
X[20] = 16246; Y[20] = 8768;
X[21] = 12622; Y[21] = 8768;
X[22] = 9581; Y[22] = 8768;
X[23] = 7290; Y[23] = 6845;
X[24] = 4999; Y[24] = 4922;
X[25] = 3249; Y[25] = 1243;
X[26] = 0; Y[26] = 3066;
var XX = new Array(),
YY = new Array();
var fontSize = this.Parent.Get_CompiledCtrPrp().FontSize;
var textScale = fontSize/1000, // 1000 pt
alpha = textScale*25.4/96 /64 ; // g_dKoef_px_to_mm = 25.4/96
var align = this.size.width - X[13]*alpha;
var xx = this.pos.x + x + align/2,
yy = this.pos.y + y;
for(var i = 0; i < X.length; i++)
{
XX[i] = xx + X[i]*alpha;
YY[i] = yy + (Y[5] - Y[i])*alpha*0.65; // сжали !
}
var penW = fontSize*g_dKoef_pt_to_mm*this.PEN_W;
penW *= 96/25.4;
var intGrid = pGraphics.GetIntegerGrid();
pGraphics.SetIntegerGrid(false);
pGraphics.p_width(penW*1000);
pGraphics.b_color1(0,0,0, 255);
pGraphics._s();
pGraphics._m(XX[0], YY[0]);
pGraphics._c(XX[0], YY[0], XX[1], YY[1], XX[2], YY[2] );
pGraphics._c(XX[2], YY[2], XX[3], YY[3], XX[4], YY[4] );
pGraphics._c(XX[4], YY[4], XX[5], YY[5], XX[6], YY[6] );
pGraphics._c(XX[6], YY[6], XX[7], YY[7], XX[8], YY[8] );
pGraphics._c(XX[8], YY[8], XX[9], YY[9], XX[10], YY[10] );
pGraphics._c(XX[10], YY[10], XX[11], YY[11], XX[12], YY[12] );
pGraphics._l(XX[13], YY[13]);
pGraphics._c(XX[13], YY[13], XX[14], YY[14], XX[15], YY[15] );
pGraphics._c(XX[15], YY[15], XX[16], YY[16], XX[17], YY[17] );
pGraphics._c(XX[17], YY[17], XX[18], YY[18], XX[19], YY[19] );
pGraphics._c(XX[19], YY[19], XX[20], YY[20], XX[21], YY[21] );
pGraphics._c(XX[21], YY[21], XX[22], YY[22], XX[23], YY[23] );
pGraphics._c(XX[23], YY[23], XX[24], YY[24], XX[25], YY[25] );
pGraphics._l(XX[26], YY[26]);
pGraphics.df();
pGraphics.SetIntegerGrid(intGrid);
}
CTilde.prototype.setPosition = function(pos)
{
this.pos = pos;
}
CTilde.prototype.relate = function(parent)
{
this.Parent = parent;
}
function CAccentTilde() function CAccentTilde()
{ {
...@@ -693,121 +305,6 @@ CAccentTilde.prototype.drawPath = function(pGraphics, XX, YY) ...@@ -693,121 +305,6 @@ CAccentTilde.prototype.drawPath = function(pGraphics, XX, YY)
pGraphics._l(XX[26], YY[26]); pGraphics._l(XX[26], YY[26]);
} }
function CBreve()
{
this.turn = TURN_MIRROR_0;
}
CBreve.prototype.init = function(props)
{
this.turn = props.turn;
}
CBreve.prototype.fixSize = function()
{
var betta = this.Parent.Get_CompiledCtrPrp().FontSize/36;
var width = 4.2333333333333325*betta;
var height = 2.469444444444445*betta;
this.size = {width: width, height: height};
}
CBreve.prototype.setPosition = function(pos)
{
this.pos = pos;
}
CBreve.prototype.draw = function(x, y, pGraphics)
{
var X = new Array(),
Y = new Array();
X[0] = 25161; Y[0] = 11372;
X[1] = 24077; Y[1] = 5749;
X[2] = 20932; Y[2] = 2875;
X[3] = 17787; Y[3] = 0;
X[4] = 12247; Y[4] = 0;
X[5] = 7082; Y[5] = 0;
X[6] = 4083; Y[6] = 2854;
X[7] = 1083; Y[7] = 5707;
X[8] = 0; Y[8] = 11372;
X[9] = 3208; Y[9] = 12371;
X[10] = 4249; Y[10] = 9623;
X[11] = 5561; Y[11] = 8083;
X[12] = 6873; Y[12] = 6542;
X[13] = 8456; Y[13] = 5959;
X[14] = 10039; Y[14] = 5376;
X[15] = 12414; Y[15] = 5376;
X[16] = 14746; Y[16] = 5376;
X[17] = 16454; Y[17] = 5980;
X[18] = 18162; Y[18] = 6583;
X[19] = 19558; Y[19] = 8124;
X[20] = 20953; Y[20] = 9665;
X[21] = 21953; Y[21] = 12371;
X[22] = 25161; Y[22] = 11372;
var XX = new Array(),
YY = new Array();
var fontSize = this.Parent.Get_CompiledCtrPrp().FontSize;
var textScale = fontSize/1000, // 1000 pt
alpha = textScale*25.4/96 /64 ; // g_dKoef_px_to_mm = 25.4/96
var align = this.size.width - X[22]*alpha;
var xx = this.pos.x + x + align/2,
yy = this.pos.y + y;
var a, b;
if(this.turn == TURN_0)
{
a = 0; b = 1;
}
else
{
a = Y[22]; // height
b = -1;
}
for(var i = 0; i < X.length; i++)
{
XX[i] = xx + X[i]*alpha ;
YY[i] = yy + (a + b*Y[i])*alpha ;
}
var penW = fontSize*g_dKoef_pt_to_mm*this.PEN_W;
penW *= 96/25.4;
var intGrid = pGraphics.GetIntegerGrid();
pGraphics.SetIntegerGrid(false);
pGraphics.p_width(penW*1000);
pGraphics.b_color1(0,0,0, 255);
pGraphics._s();
pGraphics._m(XX[0], YY[0]);
pGraphics._c(XX[0], YY[0], XX[1], YY[1], XX[2], YY[2] );
pGraphics._c(XX[2], YY[2], XX[3], YY[3], XX[4], YY[4] );
pGraphics._c(XX[4], YY[4], XX[5], YY[5], XX[6], YY[6] );
pGraphics._c(XX[6], YY[6], XX[7], YY[7], XX[8], YY[8] );
pGraphics._l(XX[9], YY[9]);
pGraphics._c(XX[9], YY[9], XX[10], YY[10], XX[11], YY[11] );
pGraphics._c(XX[11], YY[11], XX[12], YY[12], XX[13], YY[13] );
pGraphics._c(XX[13], YY[13], XX[14], YY[14], XX[15], YY[15] );
pGraphics._c(XX[15], YY[15], XX[16], YY[16], XX[17], YY[17] );
pGraphics._c(XX[17], YY[17], XX[18], YY[18], XX[19], YY[19] );
pGraphics._c(XX[19], YY[19], XX[20], YY[20], XX[21], YY[21] );
pGraphics._l(XX[22], YY[22]);
pGraphics.df();
pGraphics.SetIntegerGrid(intGrid);
}
CBreve.prototype.relate = function(parent)
{
this.Parent = parent;
}
function CAccentBreve() function CAccentBreve()
{ {
...@@ -1026,6 +523,7 @@ function CAccent(props) ...@@ -1026,6 +523,7 @@ function CAccent(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 );
...@@ -1576,13 +1074,16 @@ CAccent.prototype.old_init = function(properties) ...@@ -1576,13 +1074,16 @@ CAccent.prototype.old_init = function(properties)
} }
CAccent.prototype.setPosition = function(pos) CAccent.prototype.setPosition = function(pos)
{ {
this.pos = {x: pos.x, y: pos.y - this.size.ascent}; this.pos.x = pos.x;
this.pos.y = pos.y - this.size.ascent;
var alignOp = (this.size.width - this.operator.size.width)/2, var alignOp = (this.size.width - this.operator.size.width)/2,
alignCnt = (this.size.width - this.elements[0][0].size.width)/2; alignCnt = (this.size.width - this.elements[0][0].size.width)/2;
var x1 = this.pos.x + this.GapLeft + alignOp, var PosOper = new CMathPosition();
y1 = this.pos.y;
PosOper.x = this.pos.x + this.GapLeft + alignOp;
PosOper.y = this.pos.y;
// TODO // TODO
// выставить правильно смещение для остальных значков // выставить правильно смещение для остальных значков
...@@ -1595,12 +1096,14 @@ CAccent.prototype.setPosition = function(pos) ...@@ -1595,12 +1096,14 @@ CAccent.prototype.setPosition = function(pos)
y1 = this.pos.y;*/ y1 = this.pos.y;*/
this.operator.setPosition({x: x1, y: y1}); this.operator.setPosition(PosOper);
var PosBase = new CMathPosition();
var x2 = this.pos.x + this.GapLeft + alignCnt, PosBase.x = this.pos.x + this.GapLeft + alignCnt;
y2 = this.pos.y + this.operator.size.height; PosBase.y = this.pos.y + this.operator.size.height;
this.elements[0][0].setPosition({x: x2, y: y2}); this.elements[0][0].setPosition(PosBase);
} }
CAccent.prototype.getAscent = function() CAccent.prototype.getAscent = function()
{ {
......
...@@ -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