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

Реализован селект

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@55357 954022d7-b5bf-4e40-9824-e11837661b57
parent e1f8ee2a
......@@ -626,7 +626,6 @@ ParaMath.prototype =
if ( EndPos >= 1 && CurrentRun == true)
{
//result = this.Root.update_Cursor(_CurPage, UpdateCurPos, UpdateTarget);
result = this.Root.Recalculate_CurPos(_X, Y, CurrentRun, _CurRange, _CurLine, _CurPage, UpdateCurPos, UpdateTarget, ReturnTarget);
}
......@@ -785,25 +784,17 @@ ParaMath.prototype =
// Проверяем, попали ли мы в формулу
//var Dx = this.Math.Size.WidthVisible;
var Dx = this.Root.size.width;
var D = SearchPos.X - SearchPos.CurX;
var Diff = Math.abs(D) < Math.abs(D + Dx) ? Math.abs(D) : Math.abs(D + Dx);
//var Diff = SearchPos.X - SearchPos.CurX;
var CurX = SearchPos.CurX;
//console.log("CurX :"+ SearchPos.CurX );
if(Math.abs(Diff) < SearchPos.DiffX + 0.001 )
{
//console.log(SearchPos.X);
var X = SearchPos.X,
Y = SearchPos.Y;
var str = "X: "+ SearchPos.X + "; " + "Y: " + SearchPos.Y;
//console.log(str);
SearchPos.X -= this.Math.absPos.x;
SearchPos.Y -= this.Math.absPos.y;
......@@ -812,29 +803,9 @@ ParaMath.prototype =
this.Root.Get_ParaContentPosByXY(SearchPos, Depth);
//console.log(SearchPos.X);
/*var str = "";
for(var i = 0; i < SearchPos.Pos.length; i++)
{
str += SearchPos.Pos[i] + " ;";
}
console.log(str);*/
SearchPos.X = X;
SearchPos.Y = Y;
str = "X: "+ SearchPos.X + "; " + "Y: " + SearchPos.Y;
//console.log(str);
/*console.log("X; " + SearchPos.X);
console.log("Y: " + SearchPos.Y);*/
//this.Math.Selection_SetStart(SearchPos.X, SearchPos.Y);
//this.Math.Selection_SetEnd(SearchPos.X, SearchPos.Y);
//this.Math.Root.get_ParaContentPos(false, SearchPos.Pos);
Result = true;
if ( D >= - 0.001 && D <= Dx + 0.001 )
......@@ -848,12 +819,6 @@ ParaMath.prototype =
SearchPos.CurX = CurX + Dx;
var CX = SearchPos.CurX - Dx;
/* if ( 1 === Flag )
console.log("CurX :"+ SearchPos.CurX );*/
return Result;
},
......@@ -869,14 +834,6 @@ ParaMath.prototype =
{
// TODO: ParaMath.Set_ParaContentPos
/*var str = "";
for(var i = 0; i < ContentPos.length; i++)
{
str += ContentPos[i] + " ;";
}
console.log(str);*/
var Pos = ContentPos.Get(Depth);
this.State.ContentPos = Pos;
......@@ -950,38 +907,6 @@ ParaMath.prototype =
this.Root.Set_SelectionContentPos(StartContentPos, EndContentPos, Depth, StartFlag, EndFlag);
/*this.SelectContent = this.RootComposition;
switch (StartFlag)
{
case 1:
this.RootComposition.setLogicalPosition(1);
break;
case -1:
this.RootComposition.setLogicalPosition(this.RootComposition.length - 1);
break;
case 0:
this.RootComposition.set_StartSelectContent(StartContentPos, Depth);
break;
}
switch (EndFlag)
{
case 1:
this.RootComposition.set_SelectEndExtreme(false);
break;
case -1:
this.RootComposition.set_SelectEndExtreme(true);
break;
case 0:
var result = this.RootComposition.set_EndSelectContent(EndContentPos, Depth);
this.SelectContent = result.SelectContent;
break;
}*/
/*if(!this.SelectContent.selectUse())
this.CurrentContent = this.SelectContent;*/
this.bSelectionUse = true;
},
......@@ -1022,26 +947,18 @@ ParaMath.prototype =
{
// TODO: ParaMath.Selection_Draw_Range
if(SelectionDraw.FindStart == true)
{
/*if(this.SelectContent.selectUse())
{
SelectionDraw.FindStart = false;
this.SelectContent.drawSelect(SelectionDraw);
}*/
this.Root.Selection_DrawRange(SelectionDraw);
}
else
{
if(this.Root.selectUse())
SelectionDraw.W += this.Root.size.width;
}
this.Root.Selection_DrawRange(SelectionDraw);
}
else
{
console.log(SelectionDraw.FindStart);
if ( true === SelectionDraw.FindStart )
{
SelectionDraw.StartX += this.Width;
}
}
}
......
......@@ -1355,7 +1355,7 @@ CMathBase.prototype =
var endX, endY;
if(EndFlag !== -1)
if(EndFlag === 0)
{
endX = EndContentPos.Get(Depth);
endY = EndContentPos.Get(Depth + 1);
......
......@@ -4500,10 +4500,6 @@ CMathContent.prototype =
if(bShiftKey)
{
console.log("Start of select " + this.RealSelect.startPos);
console.log("End of select " + this.RealSelect.endPos);
var pos = this.RealSelect.endPos - 1;
var endSelect = this.changePosForMove(pos, -1);
......@@ -4532,9 +4528,6 @@ CMathContent.prototype =
this.setEndPos_Selection(endSelect);
console.log("After move: start of select " + this.RealSelect.startPos);
console.log("After move: end of select " + this.RealSelect.endPos);
}
}
......@@ -5264,6 +5257,7 @@ CMathContent.prototype =
for(var i = 0; i < this.content.length; i++)
{
this.WidthToElement[i] = width;
oSize = this.content[i].size;
width += oSize.width;
......@@ -7786,40 +7780,6 @@ CMathContent.prototype =
},
Set_SelectionContentPos: function(StartContentPos, EndContentPos, Depth, StartFlag, EndFlag)
{
/*
else
{
SelectContent = this;
var direction = (posStart < posEnd) ? 1 : -1;
if(posStart < this.content.length)
{
if(this.content[posStart].value.typeObj === MATH_COMP )
{
if( direction == 1 )
this.setStartPos_Selection( posStart - 1);
else if( direction == -1 )
this.setStartPos_Selection( posStart + 1);
}
else
this.setStartPos_Selection(posStart);
}
if(posEnd < this.content.length)
{
if(this.content[posEnd].value.typeObj === MATH_COMP )
{
if( direction == 1 )
this.setEndPos_Selection(posEnd + 1);
else if( direction == -1 )
this.setEndPos_Selection(posEnd - 1);
}
else
this.setEndPos_Selection(posEnd);
}
}
*/
var posStart, posEnd;
switch(StartFlag)
......@@ -7850,7 +7810,6 @@ CMathContent.prototype =
this.SelectEndPos = posEnd;
Depth++;
if(this.IsPlaceholder())
{
this.SelectStartPos = 0;
......@@ -7864,40 +7823,31 @@ CMathContent.prototype =
}
else
{
this.content[posStart].Set_SelectionContentPos(StartContentPos, null, Depth, StartFlag, -1);
//this.content[posEnd].Set_SelectionContentPos(null, EndContentPos, Depth)
//случай с плейсхолдером рассмотрели выше
if(this.content[posEnd].typeObj !== MATH_COMP) // Para_Run
this.content[posEnd].Set_SelectionContentPos(null, EndContentPos, Depth, 1, EndFlag);
/*if(this.content[posEnd].typeObj == MATH_COMP)
if(posStart > posEnd)
{
var direction = (posStart < posEnd) ? 1 : -1;
this.content[posStart].Set_SelectionContentPos(StartContentPos, null, Depth, StartFlag, 1);
if( direction == 1 )
this.SelectEndPos = posEnd + 1;
//this.setEndPos_Selection(posEnd + 1);
else if( direction == -1 )
this.SelectEndPos = posEnd - 1;
//this.setEndPos_Selection(posEnd - 1);
//случай с плейсхолдером рассмотрели выше
if(this.content[posEnd].typeObj == MATH_PARA_RUN)
this.content[posEnd].Set_SelectionContentPos(null, EndContentPos, Depth, -1, EndFlag);
}
else // Para_Run
else
{
this.content[posEnd].Set_SelectionContentPos(null, EndContentPos, Depth, 1, 0);
}*/
this.content[posStart].Set_SelectionContentPos(StartContentPos, null, Depth, StartFlag, -1);
//случай с плейсхолдером рассмотрели выше
if(this.content[posEnd].typeObj == MATH_PARA_RUN)
this.content[posEnd].Set_SelectionContentPos(null, EndContentPos, Depth, 1, EndFlag);
}
}
}
},
Selection_DrawRange: function(SelectionDraw)
{
if(this.SelectStartPos !== this.SelectEndPos)
{
SelectionDraw.FindStart = false;
var startPos = this.SelectStartPos,
endPos = this.SelectEndPos;
......@@ -7908,52 +7858,62 @@ CMathContent.prototype =
endPos = temp;
}
SelectionDraw.StartX += this.WidthToElement[startPos];
if(this.content[startPos].typeObj === MATH_PARA_RUN)
{
SelectionDraw.StartX += this.pos.x + this.WidthToElement[startPos];
this.content[startPos].Selection_DrawRange(0, 0, SelectionDraw);
SelectionDraw.StartY = this.pos.y + this.Composition.absPos.y;
}
else
{
SelectionDraw.W += this.WidthToElement[startPos];
SelectionDraw.W += this.content[startPos].size.width;
SelectionDraw.StartX = this.pos.x + this.Composition.absPos.x + this.WidthToElement[startPos];
SelectionDraw.StartY = this.pos.y + this.Composition.absPos.y;
}
SelectionDraw.W += this.WidthToElement[endPos] - this.WidthToElement[startPos + 1]; // startPos < endPos
SelectionDraw.H = this.size.height;
if(this.content[endPos].typeObj === MATH_PARA_RUN)
this.content[endPos].Selection_DrawRange(0, 0, SelectionDraw);
else
SelectionDraw.W += this.WidthToElement[endPos];
SelectionDraw.W += this.content[endPos].size.width;
SelectionDraw.H = this.size.height;
SelectionDraw.FindStart = false;
}
else
{
var pos = this.SelectStartPos;
SelectionDraw.StartX += this.WidthToElement[pos];
if(this.content[pos].typeObj === MATH_COMP)
{
if(this.content[pos].IsSelectEmpty())
{
this.content[pos].Selection_DrawRange(SelectionDraw);
}
else
{
SelectionDraw.FindStart = false;
SelectionDraw.W = this.content[pos].size.width;
SelectionDraw.H = this.size.height;
SelectionDraw.StartX = this.pos.x + this.Composition.absPos.x + this.WidthToElement[pos];
SelectionDraw.StartX += this.pos.x + this.WidthToElement[pos];
SelectionDraw.StartY = this.pos.y + this.Composition.absPos.y;
}
}
else if(this.content[pos].typeObj === MATH_PARA_RUN)
this.content[pos].Selection_DrawRange(0, 0, SelectionDraw);
{
SelectionDraw.StartX += this.pos.x + this.WidthToElement[pos];
this.content[pos].Selection_DrawRange(0, 0, SelectionDraw);
SelectionDraw.H = this.size.height;
SelectionDraw.StartY = this.pos.y + this.Composition.absPos.y;
}
}
},
......@@ -9046,15 +9006,6 @@ CMathComposition.prototype =
},
RecalculateComposition: function(oMeasure, TextPr) // textPrp в тестовом режиме, просто отрисуем с ними формулу
{
/*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);*/
this.Resize(oMeasure); // пересчитываем всю формулу
var width = this.Root.size.width,
......@@ -9068,8 +9019,6 @@ CMathComposition.prototype =
y = Y - this.absPos.y;
this.Root.selection_Start(x, y);
//console.log("X: " + X, "Y: " + Y);
},
Selection_SetEnd: function(X, Y, PageNum, MouseEvent)
{
......
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