Commit a5d57609 authored by Ilya Kirillov's avatar Ilya Kirillov

Fixed bug with moving table borders inside the CBlockLevelSdt class.

parent 090ea2a5
...@@ -5135,15 +5135,10 @@ CDocument.prototype.Selection_SetStart = function(X, Y, MouseEvent) ...@@ -5135,15 +5135,10 @@ CDocument.prototype.Selection_SetStart = function(X, Y, MouseEvent)
bOldSelectionIsCommon = false; bOldSelectionIsCommon = false;
} }
var SelectionUse_old = this.Selection.Use; var SelectionUse_old = this.Selection.Use;
var Item = this.Content[ContentPos]; var Item = this.Content[ContentPos];
var ElementPageIndex = this.private_GetElementPageIndexByXY(ContentPos, X, Y, this.CurPage);
var bTableBorder = false; var bTableBorder = null === Item.IsTableBorder(X, Y, ElementPageIndex) ? false : true;
if (type_Table == Item.GetType())
{
var ElementPageIndex = this.private_GetElementPageIndexByXY(ContentPos, X, Y, this.CurPage);
bTableBorder = null === Item.IsTableBorder(X, Y, ElementPageIndex) ? false : true;
}
// Убираем селект, кроме случаев либо текущего параграфа, либо при движении границ внутри таблицы // Убираем селект, кроме случаев либо текущего параграфа, либо при движении границ внутри таблицы
if (!(true === SelectionUse_old && true === MouseEvent.ShiftKey && true === bOldSelectionIsCommon)) if (!(true === SelectionUse_old && true === MouseEvent.ShiftKey && true === bOldSelectionIsCommon))
...@@ -5156,56 +5151,54 @@ CDocument.prototype.Selection_SetStart = function(X, Y, MouseEvent) ...@@ -5156,56 +5151,54 @@ CDocument.prototype.Selection_SetStart = function(X, Y, MouseEvent)
this.Selection.Start = true; this.Selection.Start = true;
this.Selection.Flag = selectionflag_Common; this.Selection.Flag = selectionflag_Common;
if (true === SelectionUse_old && true === MouseEvent.ShiftKey && true === bOldSelectionIsCommon) if (true === SelectionUse_old && true === MouseEvent.ShiftKey && true === bOldSelectionIsCommon)
{ {
this.Selection_SetEnd(X, Y, {Type : AscCommon.g_mouse_event_type_up, ClickCount : 1}); this.Selection_SetEnd(X, Y, {Type : AscCommon.g_mouse_event_type_up, ClickCount : 1});
this.Selection.Use = true; this.Selection.Use = true;
this.Selection.Start = true; this.Selection.Start = true;
this.Selection.EndPos = ContentPos; this.Selection.EndPos = ContentPos;
this.Selection.Data = null; this.Selection.Data = null;
} }
else else
{ {
var ElementPageIndex = this.private_GetElementPageIndexByXY(ContentPos, X, Y, this.CurPage); var ElementPageIndex = this.private_GetElementPageIndexByXY(ContentPos, X, Y, this.CurPage);
Item.Selection_SetStart(X, Y, ElementPageIndex, MouseEvent, bTableBorder); Item.Selection_SetStart(X, Y, ElementPageIndex, MouseEvent, bTableBorder);
Item.Selection_SetEnd(X, Y, ElementPageIndex, { Item.Selection_SetEnd(X, Y, ElementPageIndex, {
Type : AscCommon.g_mouse_event_type_move, Type : AscCommon.g_mouse_event_type_move,
ClickCount : 1 ClickCount : 1
}, bTableBorder); }, bTableBorder);
if (!(type_Table == Item.GetType() && true == bTableBorder)) if (true !== bTableBorder)
{ {
this.Selection.Use = true; this.Selection.Use = true;
this.Selection.StartPos = ContentPos; this.Selection.StartPos = ContentPos;
this.Selection.EndPos = ContentPos; this.Selection.EndPos = ContentPos;
this.Selection.Data = null; this.Selection.Data = null;
this.CurPos.ContentPos = ContentPos; this.CurPos.ContentPos = ContentPos;
if (type_Paragraph === Item.GetType() && true === MouseEvent.CtrlKey) if (type_Paragraph === Item.GetType() && true === MouseEvent.CtrlKey)
{ {
var Hyperlink = Item.Check_Hyperlink(X, Y, ElementPageIndex); var Hyperlink = Item.Check_Hyperlink(X, Y, ElementPageIndex);
if (null != Hyperlink) if (null != Hyperlink)
{ {
this.Selection.Data = this.Selection.Data = {
{ Hyperlink : true,
Hyperlink : true, Value : Hyperlink
Value : Hyperlink };
}; }
} }
} }
} else
else {
{ this.Selection.Data = {
this.Selection.Data = TableBorder : true,
{ Pos : ContentPos,
TableBorder : true, Selection : SelectionUse_old
Pos : ContentPos, };
Selection : SelectionUse_old }
}; }
} }
}
}
}; };
/** /**
* Данная функция может использоваться как при движении, так и при окончательном выставлении селекта. * Данная функция может использоваться как при движении, так и при окончательном выставлении селекта.
......
...@@ -6298,125 +6298,120 @@ CDocumentContent.prototype.Selection_SetStart = function(X, Y, CurPage, MouseEve ...@@ -6298,125 +6298,120 @@ CDocumentContent.prototype.Selection_SetStart = function(X, Y, CurPage, MouseEve
Y = this.Pages[CurPage].YLimit; Y = this.Pages[CurPage].YLimit;
} }
this.CurPage = CurPage; this.CurPage = CurPage;
var AbsPage = this.Get_AbsolutePage(this.CurPage); var AbsPage = this.Get_AbsolutePage(this.CurPage);
// Сначала проверим, не попали ли мы в один из "плавающих" объектов // Сначала проверим, не попали ли мы в один из "плавающих" объектов
var bInText = (null === this.IsInText(X, Y, AbsPage) ? false : true); var bInText = (null === this.IsInText(X, Y, AbsPage) ? false : true);
var bTableBorder = (null === this.IsTableBorder(X, Y, AbsPage) ? false : true); var bTableBorder = (null === this.IsTableBorder(X, Y, AbsPage) ? false : true);
var nInDrawing = this.LogicDocument && this.LogicDocument.DrawingObjects.isPointInDrawingObjects(X, Y, AbsPage, this); var nInDrawing = this.LogicDocument && this.LogicDocument.DrawingObjects.isPointInDrawingObjects(X, Y, AbsPage, this);
if (this.Parent instanceof CHeaderFooter && ( nInDrawing === DRAWING_ARRAY_TYPE_BEFORE || nInDrawing === DRAWING_ARRAY_TYPE_INLINE || ( false === bTableBorder && false === bInText && nInDrawing >= 0 ) )) if (this.Parent instanceof CHeaderFooter && ( nInDrawing === DRAWING_ARRAY_TYPE_BEFORE || nInDrawing === DRAWING_ARRAY_TYPE_INLINE || ( false === bTableBorder && false === bInText && nInDrawing >= 0 ) ))
{ {
if (docpostype_DrawingObjects != this.CurPos.Type) if (docpostype_DrawingObjects != this.CurPos.Type)
this.RemoveSelection(); this.RemoveSelection();
// Прячем курсор // Прячем курсор
this.DrawingDocument.TargetEnd(); this.DrawingDocument.TargetEnd();
this.DrawingDocument.SetCurrentPage(AbsPage); this.DrawingDocument.SetCurrentPage(AbsPage);
var HdrFtr = this.Is_HdrFtr(true); var HdrFtr = this.Is_HdrFtr(true);
if (null === HdrFtr) if (null === HdrFtr)
{ {
this.LogicDocument.Selection.Use = true; this.LogicDocument.Selection.Use = true;
this.LogicDocument.Selection.Start = true; this.LogicDocument.Selection.Start = true;
this.LogicDocument.Selection.Flag = selectionflag_Common; this.LogicDocument.Selection.Flag = selectionflag_Common;
this.LogicDocument.Set_DocPosType(docpostype_DrawingObjects); this.LogicDocument.Set_DocPosType(docpostype_DrawingObjects);
} }
else else
{ {
HdrFtr.Content.Selection.Use = true; HdrFtr.Content.Selection.Use = true;
HdrFtr.Content.Selection.Start = true; HdrFtr.Content.Selection.Start = true;
HdrFtr.Content.Selection.Flag = selectionflag_Common; HdrFtr.Content.Selection.Flag = selectionflag_Common;
HdrFtr.Content.Set_DocPosType(docpostype_DrawingObjects); HdrFtr.Content.Set_DocPosType(docpostype_DrawingObjects);
} }
this.LogicDocument.DrawingObjects.OnMouseDown(MouseEvent, X, Y, AbsPage);
}
else
{
var bOldSelectionIsCommon = true;
if (docpostype_DrawingObjects === this.CurPos.Type && true != this.IsInDrawing(X, Y, AbsPage)) this.LogicDocument.DrawingObjects.OnMouseDown(MouseEvent, X, Y, AbsPage);
{ }
this.LogicDocument.DrawingObjects.resetSelection(); else
bOldSelectionIsCommon = false; {
} var bOldSelectionIsCommon = true;
var ContentPos = this.Internal_GetContentPosByXY(X, Y); if (docpostype_DrawingObjects === this.CurPos.Type && true != this.IsInDrawing(X, Y, AbsPage))
{
this.LogicDocument.DrawingObjects.resetSelection();
bOldSelectionIsCommon = false;
}
if (docpostype_Content != this.CurPos.Type) var ContentPos = this.Internal_GetContentPosByXY(X, Y);
{
this.Set_DocPosType(docpostype_Content);
this.CurPos.ContentPos = ContentPos;
bOldSelectionIsCommon = false;
}
var SelectionUse_old = this.Selection.Use; if (docpostype_Content != this.CurPos.Type)
var Item = this.Content[ContentPos]; {
this.Set_DocPosType(docpostype_Content);
this.CurPos.ContentPos = ContentPos;
bOldSelectionIsCommon = false;
}
var bTableBorder = false; var SelectionUse_old = this.Selection.Use;
if (type_Table == Item.GetType()) var Item = this.Content[ContentPos];
bTableBorder = ( null != Item.IsTableBorder(X, Y, AbsPage) ? true : false ); var bTableBorder = (null != Item.IsTableBorder(X, Y, AbsPage) ? true : false);
// Убираем селект, кроме случаев либо текущего параграфа, либо при движении границ внутри таблицы // Убираем селект, кроме случаев либо текущего параграфа, либо при движении границ внутри таблицы
if (!(true === SelectionUse_old && true === MouseEvent.ShiftKey && true === bOldSelectionIsCommon)) if (!(true === SelectionUse_old && true === MouseEvent.ShiftKey && true === bOldSelectionIsCommon))
{ {
if ((selectionflag_Common != this.Selection.Flag) || ( true === this.Selection.Use && MouseEvent.ClickCount <= 1 && true != bTableBorder )) if ((selectionflag_Common != this.Selection.Flag) || ( true === this.Selection.Use && MouseEvent.ClickCount <= 1 && true != bTableBorder ))
this.RemoveSelection(); this.RemoveSelection();
} }
this.Selection.Use = true; this.Selection.Use = true;
this.Selection.Start = true; this.Selection.Start = true;
this.Selection.Flag = selectionflag_Common; this.Selection.Flag = selectionflag_Common;
if (true === SelectionUse_old && true === MouseEvent.ShiftKey && true === bOldSelectionIsCommon) if (true === SelectionUse_old && true === MouseEvent.ShiftKey && true === bOldSelectionIsCommon)
{ {
this.Selection_SetEnd(X, Y, this.CurPage, {Type : AscCommon.g_mouse_event_type_up, ClickCount : 1}); this.Selection_SetEnd(X, Y, this.CurPage, {Type : AscCommon.g_mouse_event_type_up, ClickCount : 1});
this.Selection.Use = true; this.Selection.Use = true;
this.Selection.Start = true; this.Selection.Start = true;
this.Selection.EndPos = ContentPos; this.Selection.EndPos = ContentPos;
this.Selection.Data = null; this.Selection.Data = null;
} }
else else
{ {
var ElementPageIndex = this.private_GetElementPageIndexByXY(ContentPos, X, Y, this.CurPage); var ElementPageIndex = this.private_GetElementPageIndexByXY(ContentPos, X, Y, this.CurPage);
Item.Selection_SetStart(X, Y, ElementPageIndex, MouseEvent); Item.Selection_SetStart(X, Y, ElementPageIndex, MouseEvent);
Item.Selection_SetEnd(X, Y, ElementPageIndex, {Type : AscCommon.g_mouse_event_type_move, ClickCount : 1}); Item.Selection_SetEnd(X, Y, ElementPageIndex, {Type : AscCommon.g_mouse_event_type_move, ClickCount : 1});
if (!(type_Table == Item.GetType() && true == bTableBorder)) if (true !== bTableBorder)
{ {
this.Selection.Use = true; this.Selection.Use = true;
this.Selection.StartPos = ContentPos; this.Selection.StartPos = ContentPos;
this.Selection.EndPos = ContentPos; this.Selection.EndPos = ContentPos;
this.Selection.Data = null; this.Selection.Data = null;
this.CurPos.ContentPos = ContentPos; this.CurPos.ContentPos = ContentPos;
if (type_Paragraph === Item.GetType() && true === MouseEvent.CtrlKey) if (type_Paragraph === Item.GetType() && true === MouseEvent.CtrlKey)
{ {
var Hyperlink = Item.Check_Hyperlink(X, Y, ElementPageIndex); var Hyperlink = Item.Check_Hyperlink(X, Y, ElementPageIndex);
if (null != Hyperlink) if (null != Hyperlink)
{ {
this.Selection.Data = this.Selection.Data = {
{ Hyperlink : true,
Hyperlink : true, Value : Hyperlink
Value : Hyperlink };
}; }
} }
} }
} else
else {
{ this.Selection.Data = {
this.Selection.Data = TableBorder : true,
{ Pos : ContentPos,
TableBorder : true, Selection : SelectionUse_old
Pos : ContentPos, };
Selection : SelectionUse_old }
}; }
} }
}
}
}; };
// Данная функция может использоваться как при движении, так и при окончательном выставлении селекта. // Данная функция может использоваться как при движении, так и при окончательном выставлении селекта.
// Если bEnd = true, тогда это конец селекта. // Если bEnd = true, тогда это конец селекта.
......
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