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

update cursor

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@52550 954022d7-b5bf-4e40-9824-e11837661b57
parent 347ce04f
...@@ -981,26 +981,7 @@ CMathBase.prototype = ...@@ -981,26 +981,7 @@ CMathBase.prototype =
this.typeElement = type; this.typeElement = type;
}, },
//// For Edit ///// //// For Edit /////
/*getSelectContent: function(x, y)
{
var state = true, SelectContent = null;
var elem = this.findDisposition({x: x, y: y});
var X = elem.mCoord.x,
Y = elem.mCoord.y;
if(elem.pos.x == this.CurPos_X && elem.pos.y == this.CurPos_Y && elem.inside_flag === -1 )
{
var movement = this.elements[this.CurPos_X][this.CurPos_Y].getSelectContent(X, Y);
SelectContent = movement.SelectContent;
state = true;
}
else
state = false;
return {state: state, SelectContent: SelectContent};
}*/
selection_Start: function(x, y) selection_Start: function(x, y)
{ {
var elem = this.findDisposition({x: x, y: y}); var elem = this.findDisposition({x: x, y: y});
......
...@@ -4355,23 +4355,40 @@ CMathContent.prototype = ...@@ -4355,23 +4355,40 @@ CMathContent.prototype =
while( pos < (this.content.length - 1) && this.content[pos].widthToEl < mouseX ) while( pos < (this.content.length - 1) && this.content[pos].widthToEl < mouseX )
pos++; pos++;
var gps = this.content[pos].g_mContext; var gps = this.content[pos].g_mContext;
var width = this.content[pos].value.size.width;
var widthToEl = this.content[pos].widthToEl;
if(pos !== 0) if(pos !== 0)
{ {
if( this.content[ pos ].value.typeObj === MATH_COMP ) if( this.content[pos].value.typeObj === MATH_COMP )
{ {
if( this.content[ pos - 1].widthToEl <= mouseX && mouseX < (this.content[pos - 1].widthToEl + gps.left) ) /*if( this.content[pos - 1].widthToEl <= mouseX && mouseX < (this.content[pos - 1].widthToEl + gps.left) )
pos--;
else if( (this.content[pos].widthToEl - gps.right) < mouseX && mouseX <= this.content[ pos ].widthToEl)
pos++;*/
if(mouseX < widthToEl - width - gps.right)
pos--; pos--;
else if( (this.content[ pos ].widthToEl - gps.right) < mouseX && mouseX <= this.content[ pos ].widthToEl) else if(mouseX >= widthToEl - gps.right)
pos++; pos++;
/*if(!bPos)
pos--;
else
pos++;*/
} }
else else
{ {
if( this.content[ pos - 1].widthToEl <= mouseX && mouseX < (this.content[ pos - 1].widthToEl + gps.left) ) if( !(widthToEl - width/2 < mouseX) )
pos--; pos--;
else if( (this.content[ pos ].widthToEl - (this.content[ pos ].value.size.width/2) - this.content[ pos ].g_mContext.left ) > mouseX )
/*if( this.content[ pos - 1].widthToEl <= mouseX && mouseX < (this.content[ pos - 1].widthToEl + gps.left) )
pos--; pos--;
else if( (this.content[ pos ].widthToEl - (this.content[ pos ].value.size.width/2) - this.content[ pos ].g_mContext.left ) > mouseX )
pos--;*/
} }
} }
...@@ -5702,36 +5719,6 @@ CMathContent.prototype = ...@@ -5702,36 +5719,6 @@ CMathContent.prototype =
}, },
/////// selection for Edit //////// /////// selection for Edit ////////
old_selection_Start: function(x, y)
{
var SelectContent = null;
if(this.IsPlaceholder())
{
SelectContent = this;
}
else
{
var msCoord = this.coordWOGaps({x: x, y: y});
var pos = this.findPosition( msCoord);
this.RealPosSelect.start = pos;
this.RealPosSelect.end = pos;
if(this.content[pos].value.typeObj === MATH_COMP)
{
var coord = this.getCoordElem(pos, msCoord);
var movement = this.content[pos].value.selection_Start(coord.x, coord.y);
SelectContent = movement.SelectContent;
}
/*else
{
SelectContent = this;
}*/
}
//return {SelectContent: SelectContent};
},
selection_Start: function(x, y) selection_Start: function(x, y)
{ {
if(this.IsPlaceholder()) if(this.IsPlaceholder())
...@@ -5772,18 +5759,19 @@ CMathContent.prototype = ...@@ -5772,18 +5759,19 @@ CMathContent.prototype =
var posEnd = this.findPosition(msCoord), var posEnd = this.findPosition(msCoord),
posStart = this.RealPosSelect.start; posStart = this.RealPosSelect.start;
this.CurPos = posStart;
this.RealPosSelect.end = posEnd; this.RealPosSelect.end = posEnd;
//селект внутри элемента (дроби и пр.) //селект внутри элемента (дроби и пр.)
if(posStart === posEnd && this.content[posEnd].value.typeObj === MATH_COMP) if(posStart === posEnd && this.content[posEnd].value.typeObj === MATH_COMP)
{ {
var coord = this.getCoordElem(posEnd, msCoord ); var coord = this.getCoordElem(posEnd, msCoord );
var movement = this.content[posEnd].value.selection_End(coord.x, coord.y); var movement = this.content[posEnd].value.selection_End(coord.x, coord.y);
this.setStartPos_Selection(posStart-1);
if( ! movement.state ) if( ! movement.state )
{ {
this.setEnd_Selection(posEnd + 1); this.setEndPos_Selection(posEnd + 1);
SelectContent = this; SelectContent = this;
} }
else else
...@@ -5849,6 +5837,7 @@ CMathContent.prototype = ...@@ -5849,6 +5837,7 @@ CMathContent.prototype =
{ {
this.RealPosSelect.start = 0; /// в итоге, селект начнется с позиции 1 this.RealPosSelect.start = 0; /// в итоге, селект начнется с позиции 1
this.RealPosSelect.end = 0; this.RealPosSelect.end = 0;
this.CurPos = 1;
} }
else else
{ {
...@@ -5863,6 +5852,7 @@ CMathContent.prototype = ...@@ -5863,6 +5852,7 @@ CMathContent.prototype =
{ {
this.RealPosSelect.start = this.content.length - 1; this.RealPosSelect.start = this.content.length - 1;
this.RealPosSelect.end = this.content.length - 1; this.RealPosSelect.end = this.content.length - 1;
this.CurPos = this.content.length - 1;
} }
else else
{ {
...@@ -5903,7 +5893,8 @@ CMathComposition.prototype = ...@@ -5903,7 +5893,8 @@ CMathComposition.prototype =
{ {
// TODO // TODO
// переделать gaps // переделать gaps
var g_Unif = 6*g_dKoef_pix_to_mm; //var g_Unif = 6*g_dKoef_pix_to_mm;
var g_Unif = 0;
var gps = new dist(g_Unif, g_Unif, g_Unif, g_Unif); var gps = new dist(g_Unif, g_Unif, g_Unif, g_Unif);
this.Root = new CMathContent(); this.Root = new CMathContent();
...@@ -6271,10 +6262,10 @@ CMathComposition.prototype = ...@@ -6271,10 +6262,10 @@ CMathComposition.prototype =
UpdateCursor: function() UpdateCursor: function()
{ {
this.CurrentContent.update_Cursor(); this.CurrentContent.update_Cursor();
if( this.SelectContent.selection.startPos !== this.SelectContent.selection.endPos) /*if( this.SelectContent.selection.startPos !== this.SelectContent.selection.endPos)
this.HideCursor(); this.HideCursor();
else else
this.ShowCursor(); this.ShowCursor();*/
}, },
GetPrpSelectContent: function() GetPrpSelectContent: 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