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

Поправила accent (для текстовых значков)

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@55744 954022d7-b5bf-4e40-9824-e11837661b57
parent 4f59197f
......@@ -638,26 +638,11 @@ function CAccent()
this.operator = new COperator(OPER_ACCENT);
this.code = null; // храним код буквы и тип здесь
this. type = null; // т.к в класах, которые вызываем, не учитываем случаи, когда элементы (стрелки/скобки) переворачиваются
this.typeOper = null; // т.к в класах, которые вызываем, не учитываем случаи, когда элементы (стрелки/скобки) переворачиваются
this.loc = LOCATION_TOP;
CCharacter.call(this);
}
extend(CAccent, CCharacter);
CAccent.prototype._for_operator_init = function(props)
{
var prp =
{
chr: props.chr,
type: props.chrType
};
var defaultPrp =
{
type: ACCENT_COMB_CARON
};
this.setCharacter(prp, defaultPrp);
}
CAccent.prototype.init = function(properties)
{
var type = properties.chrType,
......@@ -1163,19 +1148,35 @@ CAccent.prototype.init = function(properties)
//this.setOperator(accent);
this.elements[0][0].SetDot(true);
/// вызов этой функции обязательно в конце
this.WriteContentsToHistory();
}
CAccent.prototype.setPosition = function(pos)
{
this.pos = {x: pos.x, y: pos.y - this.size.ascent};
var alignOp = this.align(this.operator),
alignCnt = this.align(this.elements[0][0]);
var x1 = this.pos.x + this.GapLeft + alignOp,
y1;
}
CAccent.prototype.Resize = function(oMeasure)
{
// TODO
// выставить правильно смещение для остальных значков
// для обычных текстовых значков (ACCENT_SIGN) выставлено
if(this.typeOper == ACCENT_SIGN)
y1 = this.pos.y - this.shiftOperator + this.size.ascent; //shiftOperator to "CCharacter"
else
y1 = this.pos.y;
this.operator.setPosition({x: x1, y: y1});
var x2 = this.pos.x + this.GapLeft + alignCnt,
y2 = this.pos.y + this.operator.size.height;
this.elements[0][0].setPosition({x: x2, y: y2});
}
CAccent.prototype.getAscent = function()
{
......
......@@ -76,6 +76,8 @@ CFraction.prototype.old_getCenter = function()
}
CFraction.prototype.draw = function(x, y, pGraphics)
{
console.log("Draw fraction");
if(this.type == BAR_FRACTION || this.type == NO_BAR_FRACTION)
this.drawBarFraction(x, y, pGraphics);
else if(this.type == SKEWED_FRACTION)
......
......@@ -274,6 +274,7 @@ CMathText.prototype =
var X = this.pos.x + x,
Y = this.pos.y + y;
/*var tx = 0;
var ty = 0;
......@@ -298,7 +299,6 @@ CMathText.prototype =
pGraphics.transform(sx, shy, shx, sy, 0, 0);*/
pGraphics.FillTextCode(X, Y, this.getCode()); //на отрисовку символа отправляем положение baseLine
},
......
......@@ -3055,10 +3055,6 @@ COperator.prototype.fixSize = function(oMeasure, stretch)
//height = this.operator.size.height;
}
//var betta = this.getCtrPrp().FontSize;
//ascent = height/2 + 0.2*betta;
}
var mgCtrPrp = this.Parent.mergeCtrTPrp();
......@@ -3849,6 +3845,8 @@ CDelimiter.prototype.getPropsForWrite = function()
function CCharacter()
{
this.operator = new COperator(OPER_GROUP_CHAR);
this.shiftOperator = 0;
CMathBase.call(this);
}
extend(CCharacter, CMathBase);
......@@ -3871,6 +3869,15 @@ CCharacter.prototype.Resize = function(oMeasure)
height = base.size.height + this.operator.size.height,
ascent = this.getAscent(oMeasure);
var ctrPrp = this.mergeCtrTPrp();
oMeasure.SetFont(ctrPrp);
var letterX = new CMathText(true);
letterX.add(0x78);
letterX.Resize(oMeasure);
this.shiftOperator = base.size.ascent - letterX.size.ascent;
this.size = {height: height, width: width, ascent: ascent};
}
CCharacter.prototype.setPosition = function(pos)
......@@ -3912,7 +3919,23 @@ CCharacter.prototype.align = function(element)
CCharacter.prototype.draw = function(x, y, pGraphics)
{
this.elements[0][0].draw(x, y, pGraphics);
var mgCtrPrp = this.mergeCtrTPrp();
var FontSize = mgCtrPrp.FontSize,
FontFamily = {Name: "Cambria Math", Index: -1};
var obj = {FontSize: FontSize, FontFamily: FontFamily};
var accFont = new CTextPr();
accFont.Set_FromObject(obj);
pGraphics.SetFont(accFont);
pGraphics.p_color(0,0,0, 255);
pGraphics.b_color1(0,0,0, 255);
this.operator.draw(x, y, pGraphics);
}
CCharacter.prototype.findDisposition = function(pos)
{
......
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