Commit 9b1a6bda authored by Anna.Pavlova's avatar Anna.Pavlova Committed by Alexander.Trofimov

1. Поправила позицию для accent в случаеБ если для диакритических элементов...

1. Поправила позицию для accent в случаеБ если для диакритических элементов используются не обычный текст
2. Поправила баг для степеней (CDegreeSubSup) : выравнивание было для итераторов по центру вместо выравнивания к левому/правому краю (если итераторы после/перед основанием)

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@57010 954022d7-b5bf-4e40-9824-e11837661b57
parent bafc4b11
...@@ -283,10 +283,10 @@ CAccentTilde.prototype.calcCoord = function(stretch) ...@@ -283,10 +283,10 @@ CAccentTilde.prototype.calcCoord = function(stretch)
YY[i] = (Y[5] - Y[i])*alpha*0.65; // сжали ! YY[i] = (Y[5] - Y[i])*alpha*0.65; // сжали !
} }
var W = X[13], var W = XX[13],
H = Y[5]; H = YY[5];
return {XX: X, YY: Y, W: W, H: H}; return {XX: XX, YY: YY, W: W, H: H};
} }
CAccentTilde.prototype.drawPath = function(pGraphics, XX, YY) CAccentTilde.prototype.drawPath = function(pGraphics, XX, YY)
{ {
...@@ -512,16 +512,14 @@ function CAccent(props) ...@@ -512,16 +512,14 @@ function CAccent(props)
chrType: null chrType: null
}; };
this.shiftX = 0; this.shiftX = 0;
this.shiftX_2 = 0;
this.gap = 0; this.gap = 0;
///////////////// /////////////////
this.operator = new COperator(OPER_ACCENT); this.operator = new COperator(OPER_ACCENT);
//this.code = null; // храним код буквы и тип здесь
//this.typeOper = null; // т.к в класах, которые вызываем, не учитываем случаи, когда элементы (стрелки/скобки) переворачиваются
CAccent.superclass.constructor.call(this); CAccent.superclass.constructor.call(this);
//CMathBase.call(this); //CMathBase.call(this);
...@@ -1078,17 +1076,9 @@ CAccent.prototype.setPosition = function(pos) ...@@ -1078,17 +1076,9 @@ CAccent.prototype.setPosition = function(pos)
var PosOper = new CMathPosition(); var PosOper = new CMathPosition();
PosOper.x = this.pos.x + this.GapLeft + alignOp; PosOper.x = this.pos.x + this.GapLeft + alignOp;
PosOper.y = this.pos.y + this.shiftX;
// TODO PosOper.y = this.pos.y + this.shiftX_2;
// выставить правильно смещение для остальных значков //PosOper.y = this.pos.y + this.size.ascent - this.shiftX;
// для обычных текстовых значков (ACCENT_SIGN) выставлено
/*if(this.typeOper == ACCENT_SIGN)
//y1 = this.pos.y - this.shiftX + this.size.ascent; //shiftOperator to "CCharacter"
y1 = this.pos.y + this.shiftX; //shiftOperator to "CCharacter"
else
y1 = this.pos.y;*/
this.operator.setPosition(PosOper); this.operator.setPosition(PosOper);
...@@ -1136,12 +1126,19 @@ CAccent.prototype.Resize = function(Parent, ParaMath, oMeasure) ...@@ -1136,12 +1126,19 @@ CAccent.prototype.Resize = function(Parent, ParaMath, oMeasure)
this.operator.fixSize(ParaMath, oMeasure, base.size.width); this.operator.fixSize(ParaMath, oMeasure, base.size.width);
var letterX = new CMathText(true);
letterX.add(0x78); if(this.operator.typeOper == OPERATOR_TEXT)
letterX.Resize(null, oMeasure); {
//this.shiftX = base.size.ascent - letterX.size.ascent; var letterX = new CMathText(true);
this.gap = this.operator.size.ascentSign - letterX.size.ascent; letterX.add(0x78);
this.shiftX = this.operator.size.ascentSign; letterX.Resize(null, oMeasure);
this.gap = this.operator.size.ascentSign - letterX.size.ascent;
this.shiftX_2 = this.operator.size.ascentSign;
//this.shiftX = base.size.ascent - letterX.size.ascent;
}
var width = base.size.width > this.operator.size.width ? base.size.width : this.operator.size.width, var width = base.size.width > this.operator.size.width ? base.size.width : this.operator.size.width,
height = base.size.height + this.operator.size.height + this.gap, height = base.size.height + this.operator.size.height + this.gap,
...@@ -1172,7 +1169,6 @@ CAccent.prototype.draw = function(x, y, pGraphics) ...@@ -1172,7 +1169,6 @@ CAccent.prototype.draw = function(x, y, pGraphics)
pGraphics.b_color1(0,0,0, 255); pGraphics.b_color1(0,0,0, 255);
this.operator.draw(x, y, pGraphics); this.operator.draw(x, y, pGraphics);
} }
CAccent.prototype.findDisposition = function(pos) CAccent.prototype.findDisposition = function(pos)
{ {
...@@ -1182,7 +1178,7 @@ CAccent.prototype.findDisposition = function(pos) ...@@ -1182,7 +1178,7 @@ CAccent.prototype.findDisposition = function(pos)
var inside_flag = -1; var inside_flag = -1;
var content = this.elements[0][0], var base = this.elements[0][0],
align = (this.size.width - this.elements[0][0].size.width)/2; align = (this.size.width - this.elements[0][0].size.width)/2;
if(pos.x < align) if(pos.x < align)
...@@ -1190,22 +1186,26 @@ CAccent.prototype.findDisposition = function(pos) ...@@ -1190,22 +1186,26 @@ CAccent.prototype.findDisposition = function(pos)
X = 0; X = 0;
inside_flag = 0; inside_flag = 0;
} }
else if(pos.x > align + content.size.width) else if(pos.x > align + base.size.width)
{ {
X = content.size.width; X = base.size.width;
inside_flag = 1; inside_flag = 1;
} }
else else
X = pos.x - align; X = pos.x - align;
if(pos.y < this.operator.size.height) var accentGap = this.size.height - base.size.height;
if(pos.y < accentGap)
{ {
Y = 0; Y = 0;
inside_flag = 2; inside_flag = 2;
} }
else else
Y = pos.y - this.operator.size.height; Y = pos.y - accentGap;
/*if(pos.y > 0)
console.log("Pos.y " + pos.y + "accent gap" + accentGap);*/
var mouseCoord = {x: X, y: Y}, var mouseCoord = {x: X, y: Y},
......
...@@ -1270,12 +1270,6 @@ CMathBase.prototype = ...@@ -1270,12 +1270,6 @@ CMathBase.prototype =
var disp = this.findDisposition({ x: SearchPos.X - this.GapLeft, y: SearchPos.Y}); var disp = this.findDisposition({ x: SearchPos.X - this.GapLeft, y: SearchPos.Y});
// TO DO
// Рассмотреть дурацкий случай, если контент не заполнен, то тогда перейти в другой элемент
//
// Word
// в случае, если в xml отсутствуют элементы в контенте, то выставляются плейсхолдеры
var pos = disp.pos; var pos = disp.pos;
...@@ -1355,9 +1349,6 @@ CMathBase.prototype = ...@@ -1355,9 +1349,6 @@ CMathBase.prototype =
}, },
Set_SelectionContentPos: function(StartContentPos, EndContentPos, Depth, StartFlag, EndFlag) Set_SelectionContentPos: function(StartContentPos, EndContentPos, Depth, StartFlag, EndFlag)
{ {
//var startX, startY;
//var bJustDraw = false;
if(StartFlag === 0) if(StartFlag === 0)
{ {
this.SelectStart.X = StartContentPos.Get(Depth); this.SelectStart.X = StartContentPos.Get(Depth);
...@@ -1367,17 +1358,8 @@ CMathBase.prototype = ...@@ -1367,17 +1358,8 @@ CMathBase.prototype =
else else
{ {
this.SelectStart.bOutside = true; this.SelectStart.bOutside = true;
/*startX = -1;
startY = -1;*/
} }
/*this.SelectStart.X = startX;
this.SelectStart.Y = startY;*/
//this.SelectStart_X = startX;
//this.SelectStart_Y = startY;
if(EndFlag === 0) if(EndFlag === 0)
{ {
...@@ -1388,12 +1370,8 @@ CMathBase.prototype = ...@@ -1388,12 +1370,8 @@ CMathBase.prototype =
else /// в случае, если закончили селект на уровень выше, а нужно выставить начало селекта во внутреннем элементе мат объекта else /// в случае, если закончили селект на уровень выше, а нужно выставить начало селекта во внутреннем элементе мат объекта
{ {
this.SelectEnd.bOutside = true; this.SelectEnd.bOutside = true;
/*endX = -1;
endY = -1;*/
} }
/*this.SelectEnd_X = endX;
this.SelectEnd_Y = endY;*/
Depth += 2; Depth += 2;
...@@ -1411,7 +1389,7 @@ CMathBase.prototype = ...@@ -1411,7 +1389,7 @@ CMathBase.prototype =
{ {
this.elements[startX][startY].Set_SelectionContentPos(StartContentPos, EndContentPos, Depth, StartFlag, EndFlag); this.elements[startX][startY].Set_SelectionContentPos(StartContentPos, EndContentPos, Depth, StartFlag, EndFlag);
} }
else /*if(startX !== -1 && startY !== -1)*/ else
{ {
this.elements[startX][startY].Set_SelectionContentPos(StartContentPos, null, Depth, StartFlag, -1); this.elements[startX][startY].Set_SelectionContentPos(StartContentPos, null, Depth, StartFlag, -1);
} }
......
...@@ -667,6 +667,11 @@ CIterators.prototype.fillMathComposition = function(upperIterator, lowerIterator ...@@ -667,6 +667,11 @@ CIterators.prototype.fillMathComposition = function(upperIterator, lowerIterator
this.elements[0][0] = upperIterator; this.elements[0][0] = upperIterator;
this.elements[1][0] = lowerIterator; this.elements[1][0] = lowerIterator;
} }
CIterators.prototype.alignIterators = function(mcJc)
{
this.alignment.wdt[0] = mcJc;
}
function CDegreeSubSup(props) function CDegreeSubSup(props)
{ {
...@@ -713,13 +718,13 @@ CDegreeSubSup.prototype.fillContent = function() ...@@ -713,13 +718,13 @@ CDegreeSubSup.prototype.fillContent = function()
if(this.Pr.type == DEGREE_SubSup) if(this.Pr.type == DEGREE_SubSup)
{ {
oIters.alignHor(-1, 0); oIters.alignIterators(MCJC_LEFT);
this.addMCToContent(oBase, oIters); this.addMCToContent(oBase, oIters);
} }
else if(this.Pr.type == DEGREE_PreSubSup) else if(this.Pr.type == DEGREE_PreSubSup)
{ {
oIters.alignHor(-1, 1);
this.addMCToContent(oIters, oBase); this.addMCToContent(oIters, oBase);
oIters.alignIterators(MCJC_RIGHT);
} }
} }
CDegreeSubSup.prototype.old_old_recalculateSize = function(oMeasure) CDegreeSubSup.prototype.old_old_recalculateSize = function(oMeasure)
......
...@@ -329,11 +329,14 @@ CMathText.prototype = ...@@ -329,11 +329,14 @@ CMathText.prototype =
this.pos.x = pos.x + this.GapLeft; this.pos.x = pos.x + this.GapLeft;
this.pos.y = pos.y; this.pos.y = pos.y;
console.log("Placeholder : " + this.pos.y);
} }
else // for symbol only drawing else // for symbol only drawing
{ {
this.pos.x = pos.x - this.rasterOffsetX; this.pos.x = pos.x - this.rasterOffsetX;
this.pos.y = pos.y - this.rasterOffsetY; this.pos.y = pos.y - this.rasterOffsetY;
console.log("Dot : " + this.pos.y);
} }
} }
catch(e) catch(e)
......
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