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

cursor_moveLeft for Editor

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@52668 954022d7-b5bf-4e40-9824-e11837661b57
parent cd9976a9
......@@ -3748,14 +3748,26 @@ CMathContent.prototype =
var state = true,
SelectContent = null, CurrContent = null;
var currType = this.content[this.CurPos].value.typeObj;
var bFirstRunPrp = this.CurPos == 1 && currType == MATH_RUN_PRP;
if(this.IsPlaceholder())
{
var movement = this.Parent.cursor_moveLeft();
CurrContent = SelectContent = movement.SelectContent;
}
else if(this.CurPos!=1 || this.selection.startPos != this.selection.endPos) // не в начале
else if(bFirstRunPrp)
{
if( ! this.bRoot )
{
var movement = this.Parent.cursor_moveLeft();
SelectContent = CurrContent = movement.SelectContent;
}
else
state = false;
}
else if(this.CurPos!=0 || this.selection.startPos != this.selection.endPos) // не в начале
{
var currType = this.content[this.CurPos].value.typeObj;
if(this.selection.startPos != this.selection.endPos)
{
......@@ -3804,10 +3816,7 @@ CMathContent.prototype =
{
//если нет селекта, то просто перемещаемся по контенту
var bFirstRunPrp = this.CurPos == 1 && currType == MATH_RUN_PRP;
if(!bFirstRunPrp) // иначе, по контенту не перемещаемся
{
var prevType = this.content[this.CurPos - 1].value.typeObj,
prev2_Type = this.CurPos > 2 ? this.content[this.CurPos - 2].value.typeObj : null;
......@@ -3818,7 +3827,6 @@ CMathContent.prototype =
this.CurPos -= 2;
else
this.CurPos--;
}
if( this.content[this.CurPos].value.typeObj === MATH_COMP ) // this.CurPos может измениться
{
......@@ -3826,6 +3834,7 @@ CMathContent.prototype =
}
else
CurrContent = SelectContent = this;
}
this.setStart_Selection(this.CurPos);
......@@ -3833,6 +3842,9 @@ CMathContent.prototype =
}
else
state = false;
/*else
{
if( ! this.bRoot )
{
......@@ -3841,7 +3853,7 @@ CMathContent.prototype =
}
else
state = false;
}
}*/
return {state: state, SelectContent: SelectContent, CurrContent: CurrContent };
},
......@@ -5198,7 +5210,7 @@ CMathContent.prototype =
{
runPrp.Merge(this.Parent.getCtrPrp());
}
else if(this.CurPos == 1 && this.content[1].value.typeObj == MATH_COMP)
else if(this.CurPos == 0 && this.content[1].value.typeObj == MATH_COMP)
{
runPrp.Merge(this.content[1].value.getCtrPrp());
}
......@@ -5984,7 +5996,7 @@ CMathComposition.prototype =
{
return this.Root.getFirstPrp();
},
Cursor_MoveRight: function()
Cursor_MoveRight_2: function()
{
this.ClearSelect();
var move = this.SelectContent.cursor_moveRight();
......@@ -5996,16 +6008,30 @@ CMathComposition.prototype =
this.SelectContent = move.SelectContent;
this.CurrentContent = move.CurrContent;
//this.CheckTarget();
this.CheckTarget();
}
return move.state;
},
Cursor_MoveLeft_2: function()
{
this.ClearSelect();
var move = this.SelectContent.cursor_moveLeft();
if(move.state)
{
this.SelectContent = move.SelectContent;
this.CurrentContent = move.CurrContent;
this.CheckTarget();
}
console.log("Cursor_MoveRight: " + move.state);
return move.state;
},
Cursor_MoveLeft: function()
{
this.ClearSelect();
//this.ClearSelect();
var move = this.SelectContent.cursor_moveLeft();
if(move.state)
......@@ -6020,6 +6046,23 @@ CMathComposition.prototype =
return move.state;
},
Cursor_MoveRight: function()
{
//this.ClearSelect();
var move = this.SelectContent.cursor_moveRight();
//передаем состояние, т.к. можем выйти за пределы формулы
if(move.state)
{
// SelectContent == CurrentContent
this.SelectContent = move.SelectContent;
this.CurrentContent = move.CurrContent;
//this.CheckTarget();
}
return move.state;
},
Cursor_MoveUp: function()
{
//TODO !!!
......@@ -6454,14 +6497,14 @@ CMathComposition.prototype =
//стрелка влево
if(e.KeyCode==37)
{
this.Cursor_MoveLeft();
this.Cursor_MoveLeft_2();
return true;
}
//стрелка вправо
else if(e.KeyCode==39)
{
this.Cursor_MoveRight();
this.Cursor_MoveRight_2();
return true;
}
......@@ -6470,7 +6513,7 @@ CMathComposition.prototype =
{
try
{
if(this.Remove(1))
if(this.Remove_2(1))
{
//this.UpdatePosition();
editor.WordControl.m_oLogicDocument.DrawingDocument.OnRecalculatePage(0, editor.WordControl.m_oLogicDocument.Pages[0]);
......@@ -6487,7 +6530,7 @@ CMathComposition.prototype =
//delete
else if ( e.KeyCode == 46)
{
if(this.Remove(-1))
if(this.Remove_2(-1))
{
//this.UpdatePosition();
editor.WordControl.m_oLogicDocument.DrawingDocument.OnRecalculatePage(0, editor.WordControl.m_oLogicDocument.Pages[0]);
......
......@@ -320,6 +320,10 @@ CGlyphOperator.prototype.relate = function(parent)
{
this.Parent = parent;
}
CGlyphOperator.prototype.IsArrow = function()
{
return false;
}
function COperatorBracket()
......@@ -1462,7 +1466,6 @@ COperatorDoubleLine.prototype.drawPath = function(pGraphics, XX, YY)
function CSingleArrow()
{
this.bArrow = true;
CGlyphOperator.call(this);
}
extend(CSingleArrow, CGlyphOperator);
......@@ -1532,10 +1535,13 @@ CSingleArrow.prototype.drawPath = function(pGraphics, XX, YY)
pGraphics._l(XX[9], YY[9]);
pGraphics._l(XX[10], YY[10]);
}
CSingleArrow.prototype.IsArrow = function()
{
return true;
}
function CLeftRightArrow()
{
this.bArrow = true;
CGlyphOperator.call(this);
}
extend(CLeftRightArrow, CGlyphOperator);
......@@ -1618,10 +1624,13 @@ CLeftRightArrow.prototype.drawPath = function(pGraphics, XX, YY)
pGraphics._l(XX[16], YY[16]);
}
CLeftRightArrow.prototype.IsArrow = function()
{
return true;
}
function CDoubleArrow()
{
this.bArrow = true;
CGlyphOperator.call(this);
}
extend(CDoubleArrow, CGlyphOperator);
......@@ -1714,10 +1723,13 @@ CDoubleArrow.prototype.drawPath = function(pGraphics, XX, YY)
pGraphics._m(XX[16], YY[16]);
pGraphics._l(XX[17], YY[17]);
}
CDoubleArrow.prototype.IsArrow = function()
{
return true;
}
function CLR_DoubleArrow()
{
this.bArrow = true;
CGlyphOperator.call(this);
}
extend(CLR_DoubleArrow, CGlyphOperator);
......@@ -1820,6 +1832,10 @@ CLR_DoubleArrow.prototype.drawPath = function(pGraphics, XX, YY)
pGraphics._l(XX[22], YY[22]);
pGraphics._l(XX[23], YY[23]);
}
CLR_DoubleArrow.prototype.IsArrow = function()
{
return true;
}
......@@ -2174,6 +2190,7 @@ COperator.prototype.init = function(props, defaultProps) // props (chr, t
code = prp.code;
////////// delimiters //////////
if( code === 0x28 || type === PARENTHESIS_LEFT)
{
codeChr = 0x28;
......@@ -2397,6 +2414,103 @@ COperator.prototype.init = function(props, defaultProps) // props (chr, t
typeOper = BRACKET_EMPTY;
operator = -1;
}
//////////////////////////////////////
////////// accents //////////
//////////////////////////////////////
////////// group characters //////////
else if(code === 0x23DE || type == BRACKET_CURLY_TOP)
{
codeChr = 0x23DE;
typeOper = BRACKET_CURLY_TOP;
glyph = new COperatorBracket();
props =
{
location: this.loc,
turn: TURN_0
};
glyph.init(props);
}
else if(code === 0x23DF || type === BRACKET_CURLY_BOTTOM )
{
glyph = new COperatorBracket();
props =
{
location: this.loc,
turn: TURN_MIRROR_0
};
glyph.init(props);
}
else if(code === 0x2190 || type === ARROW_LEFT)
{
glyph = new CSingleArrow();
props =
{
location: this.loc,
turn: TURN_0
};
glyph.init(props);
}
else if(code === 0x2192 || type === ARROW_RIGHT)
{
glyph = new CSingleArrow();
props =
{
location: this.loc,
turn: TURN_180
};
glyph.init(props);
}
else if(code === 0x2194 || type === ARROW_LR)
{
glyph = new CLeftRightArrow();
props =
{
location: this.loc,
turn: TURN_0
};
glyph.init(props);
}
else if(code === 0x21D0 || type === DOUBLE_LEFT_ARROW)
{
glyph = new CDoubleArrow();
props =
{
location: this.loc,
turn: TURN_0
};
glyph.init(props);
}
else if(code === 0x21D2 || type === DOUBLE_RIGHT_ARROW)
{
glyph = new CDoubleArrow();
props =
{
location: this.loc,
turn: TURN_180
};
glyph.init(props);
}
else if(code === 0x21D4 || type === DOUBLE_ARROW_LR)
{
glyph = new CLR_DoubleArrow();
props =
{
location: this.loc,
turn: TURN_0
};
glyph.init(props);
}
//////////////////////////////////////////
else if(code !== null)
{
operator = new CMathText();
......@@ -3122,7 +3236,7 @@ CGroupCharacter.prototype.init = function(props)
else if(props.pos === LOCATION_BOT || props.location === LOCATION_BOT)
this.loc = LOCATION_BOT;
var type = props.chrType;
/*var type = props.chrType;
var code = typeof(props.chr) === "string" ? props.chr.charCodeAt(0) : null;
if( typeof(type) === "undefined"|| type === null && code === null )
......@@ -3134,9 +3248,12 @@ CGroupCharacter.prototype.init = function(props)
var glyph = this.getGlyph(code, type);
if(glyph.bArrow)
this.setReduct(DEGR_REDUCT);
this.setReduct(DEGR_REDUCT);*/
/*this.setOperator(new COperator(glyph));*/
this.setOperator(new COperator(glyph));
if(this.operator.IsArrow())
this.setReduct(DEGR_REDUCT); /// заменить впоследствии на более подходящую функцию
}
CGroupCharacter.prototype.getCenter = 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