Commit b86badaf authored by Oleg Korshul's avatar Oleg Korshul

mobile: use contextmenu last info

parent 17b766b9
...@@ -181,6 +181,93 @@ function (window, undefined) ...@@ -181,6 +181,93 @@ function (window, undefined)
return _mode; return _mode;
}; };
CMobileDelegateEditorCell.prototype.GetContextMenuInfo = function(info)
{
info.Clear();
var _info = null;
var _transform = null;
var _x = 0;
var _y = 0;
var _controller = this.WB.getWorksheet().objectRender.controller;
var _target = _controller.Is_SelectionUse();
var _selection = this.WB.GetSelectionRectsBounds();
if (!_target && !_selection)
{
_info = {
X : this.DrawingDocument.m_dTargetX,
Y : this.DrawingDocument.m_dTargetY,
Page : this.DrawingDocument.m_lTargetPage
};
_transform = this.DrawingDocument.TextMatrix;
if (_transform)
{
_x = _transform.TransformPointX(_info.X, _info.Y);
_y = _transform.TransformPointY(_info.X, _info.Y);
_info.X = _x;
_info.Y = _y;
}
info.targetPos = _info;
}
var _select = _controller.Get_SelectionBounds();
if (_select)
{
var _rect1 = _select.Start;
var _rect2 = _select.End;
_info = {
X1 : _rect1.X,
Y1 : _rect1.Y,
Page1 : _rect1.Page,
X2 : _rect2.X + _rect2.W,
Y2 : _rect2.Y + _rect2.H,
Page2 : _rect2.Page
};
_transform = this.DrawingDocument.SelectionMatrix;
if (_transform)
{
_x = _transform.TransformPointX(_info.X1, _info.Y1);
_y = _transform.TransformPointY(_info.X1, _info.Y1);
_info.X1 = _x;
_info.Y1 = _y;
_x = _transform.TransformPointX(_info.X2, _info.Y2);
_y = _transform.TransformPointY(_info.X2, _info.Y2);
_info.X2 = _x;
_info.Y2 = _y;
}
info.selectText = _info;
}
else if (_selection)
{
info.selectCell = {
X : _selection.X,
Y : _selection.Y,
W : _selection.W,
H : _selection.H
};
}
var _object_bounds = _controller.getSelectedObjectsBounds();
if ((0 == _mode) && _object_bounds)
{
info.selectBounds = {
X : _object_bounds.minX,
Y : _object_bounds.minY,
R : _object_bounds.maxX,
B : _object_bounds.maxY,
Page : _object_bounds.pageIndex
};
}
};
CMobileDelegateEditorCell.prototype.GetContextMenuPosition = function() CMobileDelegateEditorCell.prototype.GetContextMenuPosition = function()
{ {
var _controller = this.WB.getWorksheet().objectRender.controller; var _controller = this.WB.getWorksheet().objectRender.controller;
......
...@@ -60,6 +60,28 @@ ...@@ -60,6 +60,28 @@
Slide : 4 Slide : 4
}; };
function MobileTouchContextMenuLastInfo()
{
this.targetPos = null;
this.selectText = null;
this.selectCell = null;
this.objectBounds = null;
this.objectSlideThumbnail = null;
}
MobileTouchContextMenuLastInfo.prototype =
{
Clear : function()
{
this.targetPos = null;
this.selectText = null;
this.selectCell = null;
this.objectBounds = null;
this.objectSlideThumbnail = null;
}
};
AscCommon.MobileTouchContextMenuLastInfo = MobileTouchContextMenuLastInfo;
AscCommon.MOBILE_SELECT_TRACK_ROUND = 14; AscCommon.MOBILE_SELECT_TRACK_ROUND = 14;
AscCommon.MOBILE_TABLE_RULER_DIAMOND = 7; AscCommon.MOBILE_TABLE_RULER_DIAMOND = 7;
...@@ -134,6 +156,10 @@ ...@@ -134,6 +156,10 @@
{ {
return AscCommon.MobileTouchContextMenuType.None; return AscCommon.MobileTouchContextMenuType.None;
}; };
CMobileDelegateSimple.prototype.GetContextMenuInfo = function(info)
{
info.Clear();
};
CMobileDelegateEditor.prototype.GetContextMenuPosition = function() CMobileDelegateEditor.prototype.GetContextMenuPosition = function()
{ {
return null; return null;
...@@ -240,6 +266,81 @@ ...@@ -240,6 +266,81 @@
return _mode; return _mode;
}; };
CMobileDelegateEditor.prototype.GetContextMenuInfo = function(info)
{
info.Clear();
var _info = null;
var _transform = null;
var _x = 0;
var _y = 0;
var _target = this.LogicDocument.Is_SelectionUse();
if (_target === false)
{
_info = {
X : this.DrawingDocument.m_dTargetX,
Y : this.DrawingDocument.m_dTargetY,
Page : this.DrawingDocument.m_lTargetPage
};
_transform = this.DrawingDocument.TextMatrix;
if (_transform)
{
_x = _transform.TransformPointX(_info.X, _info.Y);
_y = _transform.TransformPointY(_info.X, _info.Y);
_info.X = _x;
_info.Y = _y;
}
info.targetPos = _info;
}
var _select = this.LogicDocument.Get_SelectionBounds();
if (_select)
{
var _rect1 = _select.Start;
var _rect2 = _select.End;
_info = {
X1 : _rect1.X,
Y1 : _rect1.Y,
Page1 : _rect1.Page,
X2 : _rect2.X + _rect2.W,
Y2 : _rect2.Y + _rect2.H,
Page2 : _rect2.Page
};
_transform = this.DrawingDocument.SelectionMatrix;
if (_transform)
{
_x = _transform.TransformPointX(_info.X1, _info.Y1);
_y = _transform.TransformPointY(_info.X1, _info.Y1);
_info.X1 = _x;
_info.Y1 = _y;
_x = _transform.TransformPointX(_info.X2, _info.Y2);
_y = _transform.TransformPointY(_info.X2, _info.Y2);
_info.X2 = _x;
_info.Y2 = _y;
}
info.selectText = _info;
}
var _object_bounds = this.LogicDocument.DrawingObjects.getSelectedObjectsBounds();
if ((0 == _mode) && _object_bounds)
{
info.selectBounds = {
X : _object_bounds.minX,
Y : _object_bounds.minY,
R : _object_bounds.maxX,
B : _object_bounds.maxY,
Page : _object_bounds.pageIndex
};
}
};
CMobileDelegateEditor.prototype.GetContextMenuPosition = function() CMobileDelegateEditor.prototype.GetContextMenuPosition = function()
{ {
var _posX = 0; var _posX = 0;
...@@ -477,6 +578,8 @@ ...@@ -477,6 +578,8 @@
/* context menu */ /* context menu */
this.ContextMenuLastMode = AscCommon.MobileTouchContextMenuType.None; this.ContextMenuLastMode = AscCommon.MobileTouchContextMenuType.None;
this.ContextMenuLastInfo = new AscCommon.MobileTouchContextMenuLastInfo();
this.ContextMenuLastModeCounter = 0; this.ContextMenuLastModeCounter = 0;
this.ContextMenuShowTimerId = -1; this.ContextMenuShowTimerId = -1;
......
...@@ -143,6 +143,83 @@ ...@@ -143,6 +143,83 @@
return _mode; return _mode;
}; };
CMobileDelegateEditorPresentation.prototype.GetContextMenuInfo = function(info)
{
info.Clear();
var _info = null;
var _transform = null;
var _x = 0;
var _y = 0;
var _controller = this.LogicDocument.Slides[this.LogicDocument.CurPage].graphicObjects;
var _target = _controller.Is_SelectionUse();
if (_target === false)
{
_info = {
X : this.DrawingDocument.m_dTargetX,
Y : this.DrawingDocument.m_dTargetY,
Page : this.DrawingDocument.m_lTargetPage
};
_transform = this.DrawingDocument.TextMatrix;
if (_transform)
{
_x = _transform.TransformPointX(_info.X, _info.Y);
_y = _transform.TransformPointY(_info.X, _info.Y);
_info.X = _x;
_info.Y = _y;
}
info.targetPos = _info;
}
var _select = _controller.Get_SelectionBounds();
if (_select)
{
var _rect1 = _select.Start;
var _rect2 = _select.End;
_info = {
X1 : _rect1.X,
Y1 : _rect1.Y,
Page1 : _rect1.Page,
X2 : _rect2.X + _rect2.W,
Y2 : _rect2.Y + _rect2.H,
Page2 : _rect2.Page
};
_transform = this.DrawingDocument.SelectionMatrix;
if (_transform)
{
_x = _transform.TransformPointX(_info.X1, _info.Y1);
_y = _transform.TransformPointY(_info.X1, _info.Y1);
_info.X1 = _x;
_info.Y1 = _y;
_x = _transform.TransformPointX(_info.X2, _info.Y2);
_y = _transform.TransformPointY(_info.X2, _info.Y2);
_info.X2 = _x;
_info.Y2 = _y;
}
info.selectText = _info;
}
var _object_bounds = _controller.getSelectedObjectsBounds();
if ((0 == _mode) && _object_bounds)
{
info.selectBounds = {
X : _object_bounds.minX,
Y : _object_bounds.minY,
R : _object_bounds.maxX,
B : _object_bounds.maxY,
Page : _object_bounds.pageIndex
};
}
};
CMobileDelegateEditorPresentation.prototype.GetContextMenuPosition = function() CMobileDelegateEditorPresentation.prototype.GetContextMenuPosition = function()
{ {
var _controller = this.LogicDocument.Slides[this.LogicDocument.CurPage].graphicObjects; var _controller = this.LogicDocument.Slides[this.LogicDocument.CurPage].graphicObjects;
...@@ -987,6 +1064,15 @@ ...@@ -987,6 +1064,15 @@
{ {
return AscCommon.MobileTouchContextMenuType.Slide; return AscCommon.MobileTouchContextMenuType.Slide;
}; };
CMobileDelegateThumbnails.prototype.GetContextMenuInfo = function(info)
{
info.Clear();
var aSelected = this.Thumbnails.GetSelectedArray();
var nSlideIndex = Math.min.apply(Math, aSelected);
info.objectSlideThumbnail = { Slide : nSlideIndex };
};
CMobileDelegateThumbnails.prototype.GetContextMenuPosition = function() CMobileDelegateThumbnails.prototype.GetContextMenuPosition = function()
{ {
var aSelected = this.Thumbnails.GetSelectedArray(); var aSelected = this.Thumbnails.GetSelectedArray();
......
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