Commit be388a72 authored by Ilya.Kirillov's avatar Ilya.Kirillov Committed by Alexander.Trofimov

Исправлен баг в чтении класса CDegree в совместном редкатировании. Исправлен...

Исправлен баг в чтении класса CDegree в совместном редкатировании. Исправлен баг с копированием не текстовых элементов в формулах. Переделаны функции копирования для классов CEqArray, CNary, CDelimiter, CRadical. Переделаны функции корректировки контента для классов CDelimiter, CRadical, CNary. Исправлены баги при передаче типа управляемого символа для классов CDelimiter и CNary.

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@58801 954022d7-b5bf-4e40-9824-e11837661b57
parent 5b2406dc
......@@ -267,15 +267,14 @@ CDegree.prototype.Write_ToBinary2 = function( Writer )
};
CDegree.prototype.Read_FromBinary2 = function( Reader )
{
this.Id = Reader.GetLong();
this.baseContent = g_oTableId.Get_ById(Reader.GetLong());
this.iterContent = g_oTableId.Get_ById(Reader.GetLong());
this.Id = Reader.GetString2();
this.baseContent = g_oTableId.Get_ById(Reader.GetString2());
this.iterContent = g_oTableId.Get_ById(Reader.GetString2());
var props = {ctrPrp: new CTextPr()};
props.ctrPrp.Read_FromBinary(Reader);
props.type = Reader.GetLong();
this.CtrPrp.Read_FromBinary(Reader);
this.Pr.type = Reader.GetLong();
this.init(props);
this.fillContent();
};
CDegree.prototype.Get_Id = function()
{
......
......@@ -899,6 +899,10 @@ CMathAmp.prototype =
IsAlignPoint: function()
{
return this.Type == para_Math_Ampersand;
},
Copy : function()
{
return new CMathAmp();
},
Write_ToBinary : function(Writer)
{
......
......@@ -21,6 +21,16 @@ CMathMatrixColumnPr.prototype.Set_FromObject = function(Obj)
this.mcJc = MCJC_CENTER;
};
CMathMatrixColumnPr.prototype.Copy = function()
{
var NewPr = new CMathMatrixColumnPr();
NewPr.count = this.count;
NewPr.mcJc = this.mcJc;
return NewPr;
};
CMathMatrixColumnPr.prototype.Write_ToBinary = function(Writer)
{
// Long : count
......@@ -103,6 +113,27 @@ CMathMatrixPr.prototype.Set_FromObject = function(Obj)
return nColumnsCount;
};
CMathMatrixPr.prototype.Copy = function()
{
var NewPr = new CMathMatrixPr();
NewPr.row = this.row ;
NewPr.cGp = this.cGp ;
NewPr.cGpRule = this.cGpRule;
NewPr.cSp = this.cSp ;
NewPr.rSp = this.rSp ;
NewPr.rSpRule = this.rSpRule;
NewPr.baseJc = this.baseJc ;
NewPr.plcHide = this.plcHide;
var nCount = this.mcs.length;
for (var nMcsIndex = 0; nMcsIndex < nCount; nMcsIndex++)
{
NewPr.mcs[nMcsIndex] = this.mcs[nMcsIndex].Copy();
}
return NewPr;
};
CMathMatrixPr.prototype.Get_ColumnsCount = function()
{
var nColumnsCount = 0;
......@@ -626,6 +657,26 @@ CMathMatrix.prototype.getPropsForWrite = function()
return props;
};
CMathMatrix.prototype.Copy = function()
{
var oProps = this.Pr.Copy();
oProps.ctrPrp = this.CtrPrp.Copy();
var NewMatrix = new CMathMatrix(oProps);
var nRowsCount = this.getRowsCount();
var nColsCount = this.getColsCount();
for(var nRowIndex = 0; nRowIndex < nRowsCount; nRowIndex++)
{
for (var nColIndex = 0; nColIndex < nColsCount; nColIndex++)
{
this.elements[nRowIndex][nColIndex].CopyTo(NewMatrix.elements[nRowIndex][nColIndex], false);
}
}
return NewMatrix;
};
CMathMatrix.prototype.Refresh_RecalcData = function(Data)
{
};
......@@ -726,6 +777,19 @@ CMathEqArrPr.prototype.Set_FromObject = function(Obj)
this.baseJc = Obj.baseJc;
};
CMathEqArrPr.prototype.Copy = function()
{
var NewPr = new CMathEqArrPr();
NewPr.maxDist = this.maxDist;
NewPr.objDist = this.objDist;
NewPr.rSp = this.rSp ;
NewPr.rSpRule = this.rSpRule;
NewPr.baseJc = this.baseJc ;
return NewPr;
};
CMathEqArrPr.prototype.Write_ToBinary = function(Writer)
{
// Long : maxDist
......@@ -971,13 +1035,21 @@ CEqArray.prototype.getPropsForWrite = function()
{
return this.Pr;
}
CEqArray.prototype.Save_Changes = function(Data, Writer)
CEqArray.prototype.Copy = function()
{
Writer.WriteLong( historyitem_type_eqArr );
}
CEqArray.prototype.Load_Changes = function(Reader)
{
}
var oProps = this.Pr.Copy();
var NewEqArray = new CEqArray(oProps);
var nRowsCount = this.elements.length;
NewEqArray.setDimension(nRowsCount, 1);
NewEqArray.setContent();
for (var nRowIndex = 0; nRowIndex < nRowsCount; nRowIndex++)
{
this.elements[nRowIndex][0].CopyTo(NewEqArray.elements[nRowIndex][0], false);
}
return NewEqArray;
};
CEqArray.prototype.Refresh_RecalcData = function(Data)
{
}
......
......@@ -6,10 +6,10 @@
function CMathNaryPr()
{
this.chr = null;
this.chr = undefined;
this.chrType = NARY_INTEGRAL;
this.grow = false;
this.limLoc = null;
this.limLoc = undefined;
this.subHide = false;
this.supHide = false;
}
......@@ -32,44 +32,96 @@ CMathNaryPr.prototype.Set_FromObject = function(Obj)
this.supHide = true;
};
CMathNaryPr.prototype.Copy = function()
{
var NewPr = new CMathNaryPr();
NewPr.chr = this.chr ;
NewPr.chrType = this.chrType;
NewPr.grow = this.grow ;
NewPr.limLoc = this.limLoc ;
NewPr.subHide = this.subHide;
NewPr.supHide = this.supHide;
return NewPr;
};
CMathNaryPr.prototype.Write_ToBinary = function(Writer)
{
// Long : flags
// Long : chr
// Long : chrType
// Bool : grow
// Long : limLoc
// Bool : grow
// Bool : subHide
// Bool : supHide
Writer.WriteLong(this.chr === null ? -1 : this.chr);
Writer.WriteLong(this.chrType);
var StartPos = Writer.GetCurPosition();
Writer.Skip(4);
var Flags = 0;
if (undefined !== this.chr)
{
Writer.WriteLong(this.chr);
Flags |= 1;
}
if (undefined !== this.chrType)
{
Writer.WriteLong(this.chrType);
Flags |= 2;
}
if (undefined !== this.limLoc)
{
Writer.WriteLong(this.limLoc);
Flags |= 4;
}
var EndPos = Writer.GetCurPosition();
Writer.Seek(StartPos);
Writer.WriteLong(Flags);
Writer.Seek(EndPos);
Writer.WriteBool(this.grow);
Writer.WriteLong(this.limLoc === null ? -1 : this.limLoc);
Writer.WriteBool(this.subHide);
Writer.WriteBool(this.supHide);
};
CMathNaryPr.prototype.Read_FromBinary = function(Reader)
{
// Long : flags
// Long : chr
// Long : chrType
// Bool : grow
// Long : limLoc
// Bool : grow
// Bool : subHide
// Bool : supHide
this.chr = Reader.GetLong();
this.chrType = Reader.GetLong();
var Flags = Reader.GetLong();
if (Flags & 1)
this.chr = Reader.GetLong();
else
this.chr = undefined;
if (Flags & 2)
this.chrType = Reader.GetLong();
else
this.chrType = undefined;
if (Flags & 4)
this.limLoc = Reader.GetLong();
else
this.limLoc = undefined;
this.grow = Reader.GetBool();
this.limLoc = Reader.GetLong();
this.subHide = Reader.GetBool();
this.supHide = Reader.GetBool();
if (-1 === this.chr)
this.chr = null;
if (-1 === this.limLoc)
this.limLoc = null;
};
function CNary(props)
......@@ -379,6 +431,25 @@ CNary.prototype.getPropsForWrite = function()
{
return this.Pr;
}
CNary.prototype.Correct_Content = function(bInnerCorrection)
{
this.LowerIterator.Correct_Content(bInnerCorrection);
this.UpperIterator.Correct_Content(bInnerCorrection);
this.Arg.Correct_Content(bInnerCorrection);
};
CNary.prototype.Copy = function()
{
var oProps = this.Pr.Copy();
oProps.ctrPrp = this.CtrPrp.Copy();
var NewNAry = new CNary(oProps);
this.LowerIterator.CopyTo(NewNAry.LowerIterator, false);
this.UpperIterator.CopyTo(NewNAry.UpperIterator, false);
this.Arg.CopyTo(NewNAry.Arg, false);
return NewNAry;
};
CNary.prototype.Refresh_RecalcData = function(Data)
{
}
......
......@@ -3211,12 +3211,12 @@ COperator.prototype.IsArrow = function()
function CMathDelimiterPr()
{
this.begChr = null;
this.begChrType = null;
this.endChr = null;
this.endChrType = null;
this.sepChr = null;
this.sepChrType = null;
this.begChr = undefined;
this.begChrType = undefined;
this.endChr = undefined;
this.endChrType = undefined;
this.sepChr = undefined;
this.sepChrType = undefined;
this.shp = DELIMITER_SHAPE_CENTERED;
this.grow = true;
......@@ -3244,24 +3244,83 @@ CMathDelimiterPr.prototype.Set_FromObject = function(Obj)
this.column = 1;
};
CMathDelimiterPr.prototype.Copy = function()
{
var NewPr = new CMathDelimiterPr();
NewPr.begChr = this.begChr ;
NewPr.begChrType = this.begChrType;
NewPr.endChr = this.endChr ;
NewPr.endChrType = this.endChrType;
NewPr.sepChr = this.sepChr ;
NewPr.sepChrType = this.sepChrType;
NewPr.shp = this.shp ;
NewPr.grow = this.grow ;
NewPr.column = this.column ;
return NewPr;
};
CMathDelimiterPr.prototype.Write_ToBinary = function(Writer)
{
// Long : Flag
// Long : begChr
// Long : begChrType
// Long : endChr
// Long : endChrType
// Long : sepChr
// Long : sepChrType
// Long : shp
// Bool : grow
// Long : column
Writer.WriteLong(null === this.begChr ? -1 : this.begChr);
Writer.WriteLong(null === this.begChrType ? -1 : this.begChrType);
Writer.WriteLong(null === this.endChr ? -1 : this.endChr);
Writer.WriteLong(null === this.endChrType ? -1 : this.endChrType);
Writer.WriteLong(null === this.sepChr ? -1 : this.sepChr);
Writer.WriteLong(null === this.sepChrType ? -1 : this.sepChrType);
var StartPos = Writer.GetCurPosition();
Writer.Skip(4);
var Flags = 0;
if (undefined !== this.begChr)
{
Writer.WriteLong(this.begChr);
Flags |= 1;
}
if (undefined !== this.begChrType)
{
Writer.WriteLong(this.begChrType);
Flags |= 2;
}
if (undefined !== this.endChr)
{
Writer.WriteLong(this.endChr);
Flags |= 4;
}
if (undefined !== this.endChrType)
{
Writer.WriteLong(this.endChrType);
Flags |= 8;
}
if (undefined !== this.sepChr)
{
Writer.WriteLong(this.sepChr);
Flags |= 16;
}
if (undefined !== this.sepChrType)
{
Writer.WriteLong(this.sepChrType);
Flags |= 32;
}
var EndPos = Writer.GetCurPosition();
Writer.Seek(StartPos);
Writer.WriteLong(Flags);
Writer.Seek(EndPos);
Writer.WriteLong(this.shp);
Writer.WriteBool(this.grow);
Writer.WriteLong(this.column);
......@@ -3269,43 +3328,54 @@ CMathDelimiterPr.prototype.Write_ToBinary = function(Writer)
CMathDelimiterPr.prototype.Read_FromBinary = function(Reader)
{
// Long : Flags
// Long : begChr
// Long : begChrType
// Long : endChr
// Long : endChrType
// Long : sepChr
// Long : sepChrType
// Long : shp
// Bool : grow
// Long : column
this.begChr = Reader.GetLong();
this.begChrType = Reader.GetLong();
this.endChr = Reader.GetLong();
this.endChrType = Reader.GetLong();
this.sepChr = Reader.GetLong();
this.sepChrType = Reader.GetLong();
this.shp = Reader.GetLong();
this.grow = Reader.GetBool();
this.column = Reader.GetLong();
var Flags = Reader.GetLong();
if (Flags & 1)
this.begChr = Reader.GetLong();
else
this.begChr = undefined;
if (-1 === this.begChr)
this.begChr = null;
if (Flags & 2)
this.begChrType = Reader.GetLong();
else
this.begChrType = undefined;
if (-1 === this.begChrType)
this.begChrType = null;
if (Flags & 4)
this.endChr = Reader.GetLong();
else
this.endChr = undefined;
if (-1 === this.endChr)
this.endChr = null;
if (Flags & 8)
this.endChrType = Reader.GetLong();
else
this.endChrType = undefined;
if (-1 === this.endChrType)
this.endChrType = null;
if (Flags & 16)
this.sepChr = Reader.GetLong();
else
this.sepChr = undefined;
if (-1 === this.sepChr)
this.sepChr = null;
if (Flags & 32)
this.sepChrType = Reader.GetLong();
else
this.sepChrType = undefined;
if (-1 === this.sepChrType)
this.sepChrType = null;
this.shp = Reader.GetLong();
this.grow = Reader.GetBool();
this.column = Reader.GetLong();
};
function CDelimiter(props)
......@@ -3335,9 +3405,7 @@ CDelimiter.prototype.init = function(props)
CDelimiter.prototype.setProperties = function(props)
{
this.Pr.Set_FromObject(props);
if(props.ctrPrp !== null && typeof(props.ctrPrp) !== "undefined")
this.setCtrPrp(props.ctrPrp);
this.setCtrPrp(props.ctrPrp);
}
CDelimiter.prototype.getColumnsCount = function()
{
......@@ -3691,6 +3759,23 @@ CDelimiter.prototype.getPropsForWrite = function()
{
return this.Pr;
}
CDelimiter.prototype.Copy = function()
{
var oProps = this.Pr.Copy();
oProps.ctrPrp = this.CtrPrp.Copy();
var NewDelimiter = new CDelimiter(oProps);
var nColsCount = this.getColumnsCount();
NewDelimiter.setDimension(1, nColsCount);
NewDelimiter.setContent();
for (var nColIndex = 0; nColIndex < nColsCount; nColIndex++)
this.elements[0][nColIndex].CopyTo(NewDelimiter.elements[0][nColIndex], false);
return NewDelimiter;
};
CDelimiter.prototype.Refresh_RecalcData = function(Data)
{
}
......
"use strict";
var GAP_TOP = 0.094492;
var SIGN_GAP = 0.077108;
var RADICAL_H0 = 1.2;
var RADICAL_H1 = 1.50732421875;
var RADICAL_H2 = 2.8;
var RADICAL_H3 = 4.08;
var RADICAL_H4 = 5.7;
var RADICAL_H5 = 7.15;
/// Gap = 0.2513
function CSignRadical()
{
this.Parent = null;
......@@ -347,505 +334,66 @@ CSignRadical.prototype.recalculateSize = function(oMeasure, sizeArg)
this.size = {height: height, width: width};
}
CSignRadical.prototype.old_recalculateSize = function()
CSignRadical.prototype.setPosition = function(pos)
{
var txtPrp = this.Parent.Get_CompiledCtrPrp();
var sizeArg = this.Parent.getBase().size;
var height, width;
var plH = 9.877777777777776 * txtPrp.FontSize/36;
var SUM = 0.1216 + 0.05;
SIGN_GAP = SUM - GAP_TOP;
var gapSign = txtPrp.FontSize*g_dKoef_pt_to_mm*SIGN_GAP,
heightArg = sizeArg.height + gapSign,
widthArg = sizeArg.width;
this.gapTop = txtPrp.FontSize*g_dKoef_pt_to_mm*GAP_TOP;
this.gapSign = gapSign;
// this.gapTop = txtPrp.FontSize*g_dKoef_pt_to_mm*SIGN_GAP;
//console.log("Gap sign : " + gapSign);
///// height //////
/*var H0 = plH*1.2,
H1 = plH*1.50732421875,
H2 = plH*2.760986328125,
H3 = plH*4.217578125,
H4 = plH*5.52197265625,
H5 = plH*7.029296875;*/
var H0 = RADICAL_H0*plH,
H1 = RADICAL_H1*plH,
H2 = RADICAL_H2*plH,
H3 = RADICAL_H3*plH,
H4 = RADICAL_H4*plH,
H5 = RADICAL_H5*plH;
// RADICAL_GAP =0.1216;
// SIGN_GAP = 0.05;
/*var H0 = plH*1.0992;
var H1 = plH*1.56542421875;
var H2 = plH*2.8275863281249998;
var H3 = plH*4.154778125;
var H4 = plH*5.7241726562499995;
var H5 = plH*7.167896874999999;*/
/*H0 += gapSign - txtPrp.FontSize*g_dKoef_pt_to_mm*0.2;
H1 += gapSign - txtPrp.FontSize*g_dKoef_pt_to_mm*0.2;
H2 += gapSign - txtPrp.FontSize*g_dKoef_pt_to_mm*0.2;
H3 += gapSign - txtPrp.FontSize*g_dKoef_pt_to_mm*0.2;
H4 += gapSign - txtPrp.FontSize*g_dKoef_pt_to_mm*0.2;
H5 += gapSign - txtPrp.FontSize*g_dKoef_pt_to_mm*0.2;*/
/*H0 += gapSign;
H1 += gapSign;
H2 += gapSign;
H3 += gapSign;
H4 += gapSign;
H5 += gapSign;*/
this.measure.bHigh = false;
if( heightArg < H0 )
height = H0*1.058;
else if( heightArg < H1 )
height = H1;
else if( heightArg < H2 )
height = H2;
else if( heightArg < H3 )
height = H3*1.04;
else if( heightArg < H4 )
height = H4;
else if( heightArg < H5 )
height = H5;
else
{
height = heightArg;
this.measure.bHigh = true;
}
/*if(this.gapTop < g_dKoef_pt_to_mm)
{
this.gapTop = g_dKoef_pt_to_mm;
height += g_dKoef_pt_to_mm;
}*/
//////
/*console.log("H0: "+ H0);
console.log("H1: "+ H1);
console.log("H2: "+ H2);
console.log("H3: "+ H3);
console.log("H4: "+ H4);
console.log("H5: "+ H5);*/
console.log("SIGN_GAP :" + SIGN_GAP);
console.log("GAP_TOP : " + GAP_TOP);
console.log("RADICAL_H0: "+ H0/plH);
console.log("RADICAL_H1: "+ H1/plH);
console.log("RADICAL_H2: "+ H2/plH);
console.log("RADICAL_H3: "+ H3/plH);
console.log("RADICAL_H4: "+ H4/plH);
console.log("RADICAL_H5: "+ H5/plH);
///// Size of tick //////
var minHgtRad = plH * 1.130493164,
maxHgtRad = plH * 7.029296875;
var minHgtTick = plH*0.6,
maxHgtTick = 1.2*plH;
var heightTick, widthSlash,
gapLeft;
if ( heightArg > maxHgtRad )
{
heightTick = maxHgtTick;
widthSlash = plH * 0.67;
gapLeft = 0.2*plH;
}
else
{
var H;
if(heightArg < H1)
{
H = H1;
var zetta = height < H1 ? 0.75 : 0.82;
widthSlash = plH *zetta;
}
else
{
H = height;
widthSlash = plH * 0.8681086138556986;
}
var alpha = (H - minHgtRad)/(2*maxHgtRad);
heightTick = minHgtTick*(1 + alpha);
gapLeft = 0.12683105468750022* plH;
}
this.measure.widthSlash = widthSlash;
this.measure.heightTick = heightTick;
this.measure.widthTick = 0.1196002747872799*txtPrp.FontSize;
////// width, height //////
width = widthSlash + gapLeft + widthArg;
height += this.gapTop;
//////
//console.log("Gap top : " + this.gapTop);
/*console.log("SIGN_GAP: " + SIGN_GAP);
console.log("RADICAL_GAP: " + RADICAL_GAP);
console.log("RADICAL_H0: " + RADICAL_H0);
console.log("RADICAL_H1: " + RADICAL_H1);
console.log("RADICAL_H2: " + RADICAL_H2);
console.log("RADICAL_H3: " + RADICAL_H3);
console.log("RADICAL_H4: " + RADICAL_H4);
console.log("RADICAL_H5: " + RADICAL_H5);*/
//console.log("Height: " + height);
this.size = {height: height, width: width};
this.pos = pos;
}
CSignRadical.prototype.old_old_recalculateSize = function()
CSignRadical.prototype.relate = function(parent)
{
var txtPrp = this.Parent.Get_CompiledCtrPrp();
var sizeArg = this.Parent.getBase().size;
var height, width;
var plH = 9.877777777777776 * txtPrp.FontSize/36;
var SUM = 0.1216 + 0.05;
SIGN_GAP = SUM - GAP_TOP;
var gapSign = txtPrp.FontSize*g_dKoef_pt_to_mm*SIGN_GAP,
heightArg = sizeArg.height + gapSign,
widthArg = sizeArg.width;
this.gapTop = txtPrp.FontSize*g_dKoef_pt_to_mm*GAP_TOP;
this.gapSign = gapSign;
// this.gapTop = txtPrp.FontSize*g_dKoef_pt_to_mm*SIGN_GAP;
//console.log("Gap sign : " + gapSign);
///// height //////
var H0 = plH*1.2,
H1 = plH*1.50732421875,
H2 = plH*2.760986328125,
H3 = plH*4.217578125,
H4 = plH*5.52197265625,
H5 = plH*7.029296875;
// RADICAL_GAP =0.1216;
// SIGN_GAP = 0.05;
/*var H0 = plH*1.0992;
var H1 = plH*1.56542421875;
var H2 = plH*2.8275863281249998;
var H3 = plH*4.154778125;
var H4 = plH*5.7241726562499995;
var H5 = plH*7.167896874999999;*/
H0 += gapSign - txtPrp.FontSize*g_dKoef_pt_to_mm*0.2;
H1 += gapSign - txtPrp.FontSize*g_dKoef_pt_to_mm*0.2;
H2 += gapSign - txtPrp.FontSize*g_dKoef_pt_to_mm*0.2;
H3 += gapSign - txtPrp.FontSize*g_dKoef_pt_to_mm*0.2;
H4 += gapSign - txtPrp.FontSize*g_dKoef_pt_to_mm*0.2;
H5 += gapSign - txtPrp.FontSize*g_dKoef_pt_to_mm*0.2;
/*H0 += gapSign;
H1 += gapSign;
H2 += gapSign;
H3 += gapSign;
H4 += gapSign;
H5 += gapSign;*/
this.Parent = parent;
}
function CMathRadicalPr()
{
this.type = DEGREE_RADICAL;
this.degHide = false;
}
this.measure.bHigh = false;
CMathRadicalPr.prototype.Set_FromObject = function(Obj)
{
if(SQUARE_RADICAL === Obj.type || DEGREE_RADICAL === Obj.type)
this.type = Obj.type;
if( heightArg < H0 )
height = H0*1.058;
else if( heightArg < H1 )
height = H1;
else if( heightArg < H2 )
height = H2;
else if( heightArg < H3 )
height = H3;
else if( heightArg < H4 )
height = H4;
else if( heightArg < H5 )
height = H5;
else
if(true === Obj.degHide || 1 === Obj.degHide)
{
height = heightArg;
this.measure.bHigh = true;
this.degHide = true;
this.type = SQUARE_RADICAL;
}
//////
/*console.log("H0: "+ H0);
console.log("H1: "+ H1);
console.log("H2: "+ H2);
console.log("H3: "+ H3);
console.log("H4: "+ H4);
console.log("H5: "+ H5);*/
console.log("SIGN_GAP :" + SIGN_GAP);
console.log("GAP_TOP : " + GAP_TOP);
console.log("RADICAL_H0: "+ H0/plH);
console.log("RADICAL_H1: "+ H1/plH);
console.log("RADICAL_H2: "+ H2/plH);
console.log("RADICAL_H3: "+ H3/plH);
console.log("RADICAL_H4: "+ H4/plH);
console.log("RADICAL_H5: "+ H5/plH);
///// Size of tick //////
var minHgtRad = plH * 1.130493164,
maxHgtRad = plH * 7.029296875;
var minHgtTick = plH*0.6,
maxHgtTick = 1.2*plH;
var heightTick, widthSlash,
gapLeft;
if ( heightArg > maxHgtRad )
else if(false === Obj.degHide || 0 === Obj.degHide)
{
heightTick = maxHgtTick;
widthSlash = plH * 0.67;
gapLeft = 0.2*plH;
}
else
{
var H;
if(heightArg < H1)
{
H = H1;
var zetta = height < H1 ? 0.75 : 0.82;
widthSlash = plH *zetta;
}
else
{
H = height;
widthSlash = plH * 0.8681086138556986;
}
var alpha = (H - minHgtRad)/(2*maxHgtRad);
heightTick = minHgtTick*(1 + alpha);
gapLeft = 0.12683105468750022* plH;
this.degHide = false;
this.type = DEGREE_RADICAL;
}
};
this.measure.widthSlash = widthSlash;
this.measure.heightTick = heightTick;
this.measure.widthTick = 0.1196002747872799*txtPrp.FontSize;
////// width, height //////
width = widthSlash + gapLeft + widthArg;
height += this.gapTop;
//////
//console.log("Gap top : " + this.gapTop);
/*console.log("SIGN_GAP: " + SIGN_GAP);
console.log("RADICAL_GAP: " + RADICAL_GAP);
console.log("RADICAL_H0: " + RADICAL_H0);
console.log("RADICAL_H1: " + RADICAL_H1);
console.log("RADICAL_H2: " + RADICAL_H2);
console.log("RADICAL_H3: " + RADICAL_H3);
console.log("RADICAL_H4: " + RADICAL_H4);
console.log("RADICAL_H5: " + RADICAL_H5);*/
//console.log("Height: " + height);
this.size = {height: height, width: width};
}
CSignRadical.prototype.old_draw = function(x, y, pGraphics)
CMathRadicalPr.prototype.Copy = function()
{
var txtPrp = this.Parent.Get_CompiledCtrPrp();
//var txtPrp = this.Parent.getTxtPrp();
var penW = txtPrp.FontSize*g_dKoef_pt_to_mm*0.042;
y += penW/2; // смещаем, для отрисовки верхней линии радикала
var NewPr = new CMathRadicalPr();
var plH = 9.877777777777776 * txtPrp.FontSize /36;
NewPr.type = this.type;
NewPr.degHide = this.degHide;
var x1 = this.pos.x + x,
x2 = x1 + 0.25*this.widthSlash;
var y2 = this.pos.y + y + this.size.height - this.sizeTick.height,
y1 = y2 + 0.11*this.widthSlash;
var tX = 1.7*penW * 0.5 * 25.4/96,
tY = (-1)*tX * 11/25 *0.5; // 11/25 - тангенс угла наклона
var x3 = x2 - tX,
y3 = y2 - tY;
var x4;
/*var minHeight = plH * 1.1304931640625,
maxHeight = plH * 7.029296875;
var maxWidth = plH * 0.81171875;
var k = 0.2*maxWidth/(maxHeight - minHeight),
b = maxWidth*0.3 - k*minHeight;*/
var k = 0.00343247*this.widthSlash,
b = 0.3*this.widthSlash - 1.130493*plH*k;
if(this.size.height < plH*7.029296875)
x4 = x3 + k*this.size.height + b;
else
x4 = x1 + this.widthSlash;
var y4 = this.pos.y + y + this.size.height - penW;
var x5 = x1 + this.widthSlash,
x6 = this.pos.x + x + this.size.width;
var y5 = this.pos.y + y,
y6 = this.pos.y + y;
pGraphics.p_width(penW*0.8*1000);
pGraphics.p_color(0,0,0, 255);
pGraphics.b_color1(0,0,0, 255);
pGraphics._s();
pGraphics._m(x1, y1);
pGraphics._l(x2, y2);
pGraphics.ds();
pGraphics.p_width(1.7*penW*1000);
pGraphics._s();
pGraphics._m(x3, y3);
pGraphics._l(x4, y4);
pGraphics.ds();
pGraphics.p_width(penW*1000);
pGraphics._s();
pGraphics._m(x4, y4);
pGraphics._l(x5, y5);
pGraphics._l(x6,y6);
pGraphics.ds();
return NewPr;
};
}
CSignRadical.prototype.old_recalculateSize = function()
CMathRadicalPr.prototype.Write_ToBinary = function(Writer)
{
//var txtPrp = this.Parent.getTxtPrp();
var txtPrp = this.Parent.Get_CompiledCtrPrp();
var sizeArg = this.Parent.getBase().size;
// Long : type
// Bool : degHide
var height, width;
Writer.WriteLong(this.type);
Writer.WriteBool(this.degHide);
};
var top = txtPrp.FontSize*g_dKoef_pt_to_mm*0.15,
heightArg = sizeArg.height + top,
widthArg = sizeArg.width;
///// height //////
var plH = 9.877777777777776 * txtPrp.FontSize /36;
var H0 = plH,
H1 = plH*1.50732421875,
H2 = plH*2.760986328125,
H3 = plH*4.217578125,
H4 = plH*5.52197265625,
H5 = plH*7.029296875;
if(heightArg < H0)
height = H1*0.75;
else if( heightArg < H1 )
height = H1;
else if( heightArg < H2 )
height = H2;
else if( heightArg < H3 )
height = H3;
else if( heightArg < H4 )
height = H4;
else if(heightArg < H5)
height = H5;
else
height = heightArg;
//////
///// height tick //////
var minHgtRad = plH * 1.130493164,
maxHgtRad = plH * 7.029296875;
var minHgtTick = plH*0.6,
//maxHgtTick = plH * 1.50732422;
maxHgtTick = 0.9*plH;
var heightTick, widthTick;
if ( heightArg > maxHgtRad )
{
heightTick = maxHgtTick;
widthTick = 0.1196002747872799*txtPrp.FontSize;
}
else
{
var alpha = (heightArg - minHgtRad)/maxHgtRad;
heightTick = minHgtTick*(1 + alpha);
widthTick = 0.1196002747872799*txtPrp.FontSize;
}
CMathRadicalPr.prototype.Read_FromBinary = function(Reader)
{
// Long : type
// Bool : degHide
////// width //////
//var widthSlash = plH * 0.9385498046875003;
var widthSlash = plH * 0.81171875;
var gap = 0.12683105468750022* plH;
width = widthSlash + gap + widthArg;
//////
this.type = Reader.GetLong();
this.degHide = Reader.GetBool();
};
this.sizeTick =
{
width : widthTick,
height : heightTick
};
this.widthSlash = widthSlash;
this.size = {height: height, width: width};
}
CSignRadical.prototype.setPosition = function(pos)
{
this.pos = pos;
}
CSignRadical.prototype.relate = function(parent)
{
this.Parent = parent;
}
function CRadical(props)
{
......@@ -862,11 +410,7 @@ function CRadical(props)
this.signRadical = new CSignRadical();
this.signRadical.relate(this);
this.Pr =
{
type: DEGREE_RADICAL,
degHide: false
};
this.Pr = new CMathRadicalPr();
this.gapDegree = 0;
this.gapWidth = 0; // в случае со степенью, если ширина степени не нулевая, добавляется расстояние для ширины
......@@ -883,40 +427,9 @@ CRadical.prototype.init = function(props)
}
CRadical.prototype.setProperties = function(props)
{
if(props.type === SQUARE_RADICAL || props.type === DEGREE_RADICAL)
this.Pr.type = props.type;
if(props.degHide === true || props.degHide === 1)
{
this.Pr.degHide = true;
this.Pr.type = SQUARE_RADICAL;
}
else if(props.degHide == false || props.degHide === 0)
{
this.Pr.degHide = false;
this.Pr.type = DEGREE_RADICAL;
}
this.Pr.Set_FromObject(props);
this.setCtrPrp(props.ctrPrp);
}
CRadical.prototype.fillContent = function()
{
if(this.Pr.type == SQUARE_RADICAL)
{
this.setDimension(1, 1);
this.setContent();
}
else if(this.Pr.type == DEGREE_RADICAL)
{
this.setDimension(1, 2);
this.setContent();
/*var oBase = new CMathContent();
var oDegree = new CMathContent();
oDegree.setArgSize(-2);
this.addMCToContent([oDegree, oBase]);*/
}
}
CRadical.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
{
this.Parent = Parent;
......@@ -1168,6 +681,22 @@ CRadical.prototype.getPropsForWrite = function()
{
return this.Pr;
}
CRadical.prototype.Correct_Content = function(bInnerCorrection)
{
this.Iterator.Correct_Content(bInnerCorrection);
this.Base.Correct_Content(bInnerCorrection);
};
CRadical.prototype.Copy = function()
{
var oProps = this.Pr.Copy();
oProps.ctrPrp = this.CtrPrp.Copy();
var NewRadical = new CRadical(oProps);
this.Base.CopyTo(NewRadical.Base, false);
this.Iterator.CopyTo(NewRadical.Iterator, false);
return NewRadical;
};
CRadical.prototype.Refresh_RecalcData = function(Data)
{
}
......@@ -1180,38 +709,16 @@ CRadical.prototype.Write_ToBinary2 = function( Writer )
Writer.WriteString2(this.getBase().Id);
this.CtrPrp.Write_ToBinary(Writer);
var StartPos = Writer.GetCurPosition();
Writer.Skip(4);
var Flags = 0;
if ( undefined != this.Pr.degHide )
{
Writer.WriteBool( this.Pr.degHide );
Flags |= 1;
}
var EndPos = Writer.GetCurPosition();
Writer.Seek( StartPos );
Writer.WriteLong( Flags );
Writer.Seek( EndPos );
this.Pr.Write_ToBinary(Writer);
}
CRadical.prototype.Read_FromBinary2 = function( Reader )
{
this.Id = Reader.GetString2();
this.Iterator = g_oTableId.Get_ById( Reader.GetString2());
this.Base = g_oTableId.Get_ById( Reader.GetString2());
var props = {ctrPrp: new CTextPr()};
props.ctrPrp.Read_FromBinary(Reader);
var Flags = Reader.GetLong();
if ( Flags & 1 )
props.degHide = Reader.GetBool();
if (props.degHide == true)
this.Iterator = null;
this.setProperties(props);
this.CtrPrp.Read_FromBinary(Reader);
this.Pr.Read_FromBinary(Reader);
}
CRadical.prototype.Get_Id = function()
{
......
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