Commit 95cb8f9c authored by Oleg Korshul's avatar Oleg Korshul

.

parent 592c1687
...@@ -86,11 +86,11 @@ ...@@ -86,11 +86,11 @@
this.Manager.iScroll.on('scroll', function() this.Manager.iScroll.on('scroll', function()
{ {
this.ScrollTo(this); this.manager.delegate.ScrollTo(this);
}); });
this.Manager.iScroll.on('scrollEnd', function() this.Manager.iScroll.on('scrollEnd', function()
{ {
this.ScrollEnd(this); this.manager.delegate.ScrollEnd(this);
}); });
}; };
...@@ -165,13 +165,13 @@ ...@@ -165,13 +165,13 @@
/** /**
* @extends {CMobileDelegateSimple} * @extends {CMobileDelegateSimple}
*/ */
function CMobileDelegateEditor(_api) function CMobileDelegateEditor(_manager)
{ {
CMobileDelegateEditor.superclass.constructor.call(this, _api); CMobileDelegateEditor.superclass.constructor.call(this, _manager);
this.HtmlPage = _api.WordControl; this.HtmlPage = this.Api.WordControl;
this.LogicDocument = _api.WordControl.m_oLogicDocument; this.LogicDocument = this.Api.WordControl.m_oLogicDocument;
this.DrawingDocument = _api.WordControl.m_oDrawingDocument; this.DrawingDocument = this.Api.WordControl.m_oDrawingDocument;
} }
AscCommon.extendClass(CMobileDelegateEditor, CMobileDelegateSimple); AscCommon.extendClass(CMobileDelegateEditor, CMobileDelegateSimple);
...@@ -179,9 +179,9 @@ ...@@ -179,9 +179,9 @@
{ {
return this.DrawingDocument.SelectionMatrix; return this.DrawingDocument.SelectionMatrix;
}; };
CMobileDelegateEditor.prototype.ConvertCoordsToCursor = function(x, y, page) CMobileDelegateEditor.prototype.ConvertCoordsToCursor = function(x, y, page, isGlobal)
{ {
return this.DrawingDocument.ConvertCoordsToCursor(x, y, page); return this.DrawingDocument.ConvertCoordsToCursor3(x, y, page, (isGlobal !== false));
}; };
CMobileDelegateEditor.prototype.ConvertCoordsFromCursor = function(x, y) CMobileDelegateEditor.prototype.ConvertCoordsFromCursor = function(x, y)
{ {
...@@ -395,15 +395,15 @@ ...@@ -395,15 +395,15 @@
}; };
CMobileDelegateEditor.prototype.Logic_OnMouseDown = function(e, x, y, page) CMobileDelegateEditor.prototype.Logic_OnMouseDown = function(e, x, y, page)
{ {
return this.LogicDocument.OnMouseDown(global_mouseEvent, x, y, page); return this.LogicDocument.OnMouseDown(e, x, y, page);
}; };
CMobileDelegateEditor.prototype.Logic_OnMouseMove = function() CMobileDelegateEditor.prototype.Logic_OnMouseMove = function(e, x, y, page)
{ {
return this.LogicDocument.OnMouseMove(global_mouseEvent, x, y, page); return this.LogicDocument.OnMouseMove(e, x, y, page);
}; };
CMobileDelegateEditor.prototype.Logic_OnMouseUp = function() CMobileDelegateEditor.prototype.Logic_OnMouseUp = function(e, x, y, page)
{ {
return this.LogicDocument.OnMouseUp(global_mouseEvent, x, y, page); return this.LogicDocument.OnMouseUp(e, x, y, page);
}; };
CMobileDelegateEditor.prototype.Drawing_OnMouseDown = function(e) CMobileDelegateEditor.prototype.Drawing_OnMouseDown = function(e)
{ {
...@@ -473,12 +473,13 @@ ...@@ -473,12 +473,13 @@
/* scroll object */ /* scroll object */
this.iScroll = null; this.iScroll = null;
this.iScrollElement = "mobile_scroller_id";
/* delegate */ /* delegate */
this.delegate = null; this.delegate = null;
} }
CMobileTouchManagerBase.prototype.CreateScrollerDiv = function(_wrapper, _id) CMobileTouchManagerBase.prototype.CreateScrollerDiv = function(_wrapper)
{ {
var _scroller = document.createElement('div'); var _scroller = document.createElement('div');
var _style = "position: absolute; z-index: 0; margin: 0; padding: 0; -webkit-tap-highlight-color: rgba(0,0,0,0); width: 100%; heigth: 100%; display: block;"; var _style = "position: absolute; z-index: 0; margin: 0; padding: 0; -webkit-tap-highlight-color: rgba(0,0,0,0); width: 100%; heigth: 100%; display: block;";
...@@ -487,7 +488,7 @@ ...@@ -487,7 +488,7 @@
_style += "-webkit-text-size-adjust: none; -moz-text-size-adjust: none; -ms-text-size-adjust: none; -o-text-size-adjust: none; text-size-adjust: none;"; _style += "-webkit-text-size-adjust: none; -moz-text-size-adjust: none; -ms-text-size-adjust: none; -o-text-size-adjust: none; text-size-adjust: none;";
_scroller.setAttribute("style", _style); _scroller.setAttribute("style", _style);
_scroller.id = _id; _scroller.id = this.iScrollElement;
_wrapper.appendChild(_scroller); _wrapper.appendChild(_scroller);
}; };
...@@ -554,8 +555,6 @@ ...@@ -554,8 +555,6 @@
if (!this.TableTrackEnabled) if (!this.TableTrackEnabled)
return false; return false;
var _offset = this.delegate.GetElementOffset();
var _eps = this.TrackTargetEps; var _eps = this.TrackTargetEps;
var bIsTable = false; var bIsTable = false;
...@@ -567,8 +566,8 @@ ...@@ -567,8 +566,8 @@
if (!_Transform || global_MatrixTransformer.IsIdentity(_Transform)) if (!_Transform || global_MatrixTransformer.IsIdentity(_Transform))
{ {
var _x = global_mouseEvent.X - _offset.X; var _x = global_mouseEvent.X;
var _y = global_mouseEvent.Y - _offset.Y; var _y = global_mouseEvent.Y;
var posLT = this.delegate.ConvertCoordsToCursor(this.TableMovePoint.X, this.TableMovePoint.Y, _PageNum); var posLT = this.delegate.ConvertCoordsToCursor(this.TableMovePoint.X, this.TableMovePoint.Y, _PageNum);
var _offset = this.TableRulersRectSize + this.TableRulersRectOffset; var _offset = this.TableRulersRectSize + this.TableRulersRectOffset;
...@@ -858,7 +857,7 @@ ...@@ -858,7 +857,7 @@
CMobileTouchManagerBase.prototype.Destroy = function() CMobileTouchManagerBase.prototype.Destroy = function()
{ {
var _scroller = document.getElementById("mobile_scroller_id"); var _scroller = document.getElementById(this.iScrollElement);
this.delegate.GetScrollerParent().removeChild(_scroller); this.delegate.GetScrollerParent().removeChild(_scroller);
if (this.iScroll != null) if (this.iScroll != null)
...@@ -964,11 +963,11 @@ ...@@ -964,11 +963,11 @@
if (!_matrix || global_MatrixTransformer.IsIdentity(_matrix)) if (!_matrix || global_MatrixTransformer.IsIdentity(_matrix))
{ {
var pos1 = this.delegate.ConvertCoordsToCursor(this.RectSelect1.x, this.RectSelect1.y, this.PageSelect1); var pos1 = this.delegate.ConvertCoordsToCursor(this.RectSelect1.x, this.RectSelect1.y, this.PageSelect1, false);
var pos2 = this.delegate.ConvertCoordsToCursor(this.RectSelect1.x, this.RectSelect1.y + this.RectSelect1.h, this.PageSelect1); var pos2 = this.delegate.ConvertCoordsToCursor(this.RectSelect1.x, this.RectSelect1.y + this.RectSelect1.h, this.PageSelect1, false);
var pos3 = this.delegate.ConvertCoordsToCursor(this.RectSelect2.x + this.RectSelect2.w, this.RectSelect2.y, this.PageSelect2); var pos3 = this.delegate.ConvertCoordsToCursor(this.RectSelect2.x + this.RectSelect2.w, this.RectSelect2.y, this.PageSelect2, false);
var pos4 = this.delegate.ConvertCoordsToCursor(this.RectSelect2.x + this.RectSelect2.w, this.RectSelect2.y + this.RectSelect2.h, this.PageSelect2); var pos4 = this.delegate.ConvertCoordsToCursor(this.RectSelect2.x + this.RectSelect2.w, this.RectSelect2.y + this.RectSelect2.h, this.PageSelect2, false);
ctx.beginPath(); ctx.beginPath();
...@@ -1003,11 +1002,11 @@ ...@@ -1003,11 +1002,11 @@
var _xx22 = _matrix.TransformPointX(this.RectSelect2.x + this.RectSelect2.w, this.RectSelect2.y + this.RectSelect2.h); var _xx22 = _matrix.TransformPointX(this.RectSelect2.x + this.RectSelect2.w, this.RectSelect2.y + this.RectSelect2.h);
var _yy22 = _matrix.TransformPointY(this.RectSelect2.x + this.RectSelect2.w, this.RectSelect2.y + this.RectSelect2.h); var _yy22 = _matrix.TransformPointY(this.RectSelect2.x + this.RectSelect2.w, this.RectSelect2.y + this.RectSelect2.h);
var pos1 = this.delegate.ConvertCoordsToCursor(_xx11, _yy11, this.PageSelect1); var pos1 = this.delegate.ConvertCoordsToCursor(_xx11, _yy11, this.PageSelect1, false);
var pos2 = this.delegate.ConvertCoordsToCursor(_xx12, _yy12, this.PageSelect1); var pos2 = this.delegate.ConvertCoordsToCursor(_xx12, _yy12, this.PageSelect1, false);
var pos3 = this.delegate.ConvertCoordsToCursor(_xx21, _yy21, this.PageSelect2); var pos3 = this.delegate.ConvertCoordsToCursor(_xx21, _yy21, this.PageSelect2, false);
var pos4 = this.delegate.ConvertCoordsToCursor(_xx22, _yy22, this.PageSelect2); var pos4 = this.delegate.ConvertCoordsToCursor(_xx22, _yy22, this.PageSelect2, false);
ctx.beginPath(); ctx.beginPath();
...@@ -1078,7 +1077,7 @@ ...@@ -1078,7 +1077,7 @@
if (_table_markup.Rows.length == 0) if (_table_markup.Rows.length == 0)
return; return;
this.HtmlPage.CheckShowOverlay(); HtmlPage.CheckShowOverlay();
var _epsRects = this.TableRulersRectOffset; var _epsRects = this.TableRulersRectOffset;
var _rectWidth = this.TableRulersRectSize; var _rectWidth = this.TableRulersRectSize;
...@@ -1098,8 +1097,8 @@ ...@@ -1098,8 +1097,8 @@
{ {
this.TableMovePoint = {X : _tableOutline.X, Y : _tableOutline.Y}; this.TableMovePoint = {X : _tableOutline.X, Y : _tableOutline.Y};
var pos1 = rawingDocument.ConvertCoordsToCursorWR(_tableOutline.X, _tableOutline.Y, _tableOutline.PageNum); var pos1 = DrawingDocument.ConvertCoordsToCursorWR(_tableOutline.X, _tableOutline.Y, _tableOutline.PageNum);
var pos2 = rawingDocument.ConvertCoordsToCursorWR(_tableOutline.X + _tableW, _tableOutline.Y, _tableOutline.PageNum); var pos2 = DrawingDocument.ConvertCoordsToCursorWR(_tableOutline.X + _tableW, _tableOutline.Y, _tableOutline.PageNum);
ctx.beginPath(); ctx.beginPath();
...@@ -1525,13 +1524,12 @@ ...@@ -1525,13 +1524,12 @@
/* simple click */ /* simple click */
CMobileTouchManagerBase.prototype.MoveCursorToPoint = function(isHalfHeight) CMobileTouchManagerBase.prototype.MoveCursorToPoint = function(isHalfHeight)
{ {
AscCommon.check_MouseMoveEvent(e);
var pos = this.delegate.ConvertCoordsFromCursor(global_mouseEvent.X, global_mouseEvent.Y); var pos = this.delegate.ConvertCoordsFromCursor(global_mouseEvent.X, global_mouseEvent.Y);
var old_click_count = global_mouseEvent.ClickCount; var old_click_count = global_mouseEvent.ClickCount;
global_mouseEvent.ClickCount = 1; global_mouseEvent.ClickCount = 1;
var nearPos = this.delegate.Logic_GetNearestPos(pos.Page, pos.X, pos.Y); var nearPos = this.delegate.Logic_GetNearestPos(pos.X, pos.Y, pos.Page);
this.delegate.DrawingDocument.NeedScrollToTargetFlag = true; this.delegate.DrawingDocument.NeedScrollToTargetFlag = true;
var y = nearPos.Y; var y = nearPos.Y;
......
...@@ -2972,7 +2972,7 @@ function CDrawingDocument() ...@@ -2972,7 +2972,7 @@ function CDrawingDocument()
return {X: x_pix, Y: y_pix, Error: false}; return {X: x_pix, Y: y_pix, Error: false};
} }
this.ConvertCoordsToCursor3 = function (x, y, pageIndex) this.ConvertCoordsToCursor3 = function (x, y, pageIndex, isGlobal)
{ {
// теперь крутить всякие циклы нет смысла // теперь крутить всякие циклы нет смысла
if (pageIndex < 0 || pageIndex >= this.m_lPagesCount) if (pageIndex < 0 || pageIndex >= this.m_lPagesCount)
...@@ -2982,8 +2982,19 @@ function CDrawingDocument() ...@@ -2982,8 +2982,19 @@ function CDrawingDocument()
var dKoef = (this.m_oWordControl.m_nZoomValue * g_dKoef_mm_to_pix / 100); var dKoef = (this.m_oWordControl.m_nZoomValue * g_dKoef_mm_to_pix / 100);
var _x = this.m_oWordControl.X; var _x = 0;
var _y = this.m_oWordControl.Y; var _y = 0;
if (isGlobal)
{
_x = this.m_oWordControl.X;
_y = this.m_oWordControl.Y;
if (true == this.m_oWordControl.m_bIsRuler)
{
_x += 5 * g_dKoef_mm_to_pix;
_y += 7 * g_dKoef_mm_to_pix;
}
}
var x_pix = (this.m_arrPages[pageIndex].drawingPage.left + x * dKoef + _x + 0.5) >> 0; var x_pix = (this.m_arrPages[pageIndex].drawingPage.left + x * dKoef + _x + 0.5) >> 0;
var y_pix = (this.m_arrPages[pageIndex].drawingPage.top + y * dKoef + _y + 0.5) >> 0; var y_pix = (this.m_arrPages[pageIndex].drawingPage.top + y * dKoef + _y + 0.5) >> 0;
......
...@@ -445,7 +445,7 @@ function CEditorPage(api) ...@@ -445,7 +445,7 @@ function CEditorPage(api)
if (this.m_oApi.isMobileVersion) if (this.m_oApi.isMobileVersion)
{ {
this.MobileTouchManager = new AscCommon.CMobileTouchManager({}); this.MobileTouchManager = new AscCommon.CMobileTouchManager({});
this.MobileTouchManager.Init(this); this.MobileTouchManager.Init(this.m_oApi);
} }
this.checkNeedRules(); this.checkNeedRules();
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
// создаем делегата. инициализация его - ПОСЛЕ создания iScroll // создаем делегата. инициализация его - ПОСЛЕ создания iScroll
this.delegate = new AscCommon.CMobileDelegateEditor(this); this.delegate = new AscCommon.CMobileDelegateEditor(this);
var _element = this.delegate.GetScrollerParent(); var _element = this.delegate.GetScrollerParent();
this.CreateScrollerDiv(_element, "mobile_scroller_id"); this.CreateScrollerDiv(_element);
this.iScroll = new window.IScroll(_element, { this.iScroll = new window.IScroll(_element, {
scrollbars: true, scrollbars: true,
...@@ -65,7 +65,7 @@ ...@@ -65,7 +65,7 @@
shrinkScrollbars: 'scale', shrinkScrollbars: 'scale',
fadeScrollbars: true, fadeScrollbars: true,
scrollX : true, scrollX : true,
scroller_id : "mobile_scroller_id", scroller_id : this.iScrollElement,
bounce : false bounce : false
}); });
...@@ -112,6 +112,26 @@ ...@@ -112,6 +112,26 @@
this.Mode = AscCommon.MobileTouchMode.Zoom; this.Mode = AscCommon.MobileTouchMode.Zoom;
} }
// если не используем этот моус даун - то уменьшаем количество кликов
switch (this.Mode)
{
case AscCommon.MobileTouchMode.None:
case AscCommon.MobileTouchMode.Scroll:
case AscCommon.MobileTouchMode.InlineObj:
case AscCommon.MobileTouchMode.FlowObj:
case AscCommon.MobileTouchMode.Zoom:
case AscCommon.MobileTouchMode.Cursor:
case AscCommon.MobileTouchMode.TableMove:
{
// так как был уже check, нужно уменьшить количество кликов
if (global_mouseEvent.ClickCount > 0)
global_mouseEvent.ClickCount--;
break;
}
default:
break;
}
switch (this.Mode) switch (this.Mode)
{ {
case AscCommon.MobileTouchMode.None: case AscCommon.MobileTouchMode.None:
...@@ -192,10 +212,6 @@ ...@@ -192,10 +212,6 @@
} }
case AscCommon.MobileTouchMode.FlowObj: case AscCommon.MobileTouchMode.FlowObj:
{ {
// так как был уже check, нужно уменьшить количество кликов
if (global_mouseEvent.ClickCount > 0)
global_mouseEvent.ClickCount--;
if (bIsKoefPixToMM) if (bIsKoefPixToMM)
{ {
global_mouseEvent.KoefPixToMM = 5; global_mouseEvent.KoefPixToMM = 5;
...@@ -206,7 +222,7 @@ ...@@ -206,7 +222,7 @@
} }
case AscCommon.MobileTouchMode.Zoom: case AscCommon.MobileTouchMode.Zoom:
{ {
this.HtmlPage.NoneRepaintPages = true; this.delegate.HtmlPage.NoneRepaintPages = true;
var _x1 = (e.touches[0].pageX !== undefined) ? e.touches[0].pageX : e.touches[0].clientX; var _x1 = (e.touches[0].pageX !== undefined) ? e.touches[0].pageX : e.touches[0].clientX;
var _y1 = (e.touches[0].pageY !== undefined) ? e.touches[0].pageY : e.touches[0].clientY; var _y1 = (e.touches[0].pageY !== undefined) ? e.touches[0].pageY : e.touches[0].clientY;
...@@ -227,15 +243,12 @@ ...@@ -227,15 +243,12 @@
} }
case AscCommon.MobileTouchMode.TableMove: case AscCommon.MobileTouchMode.TableMove:
{ {
// так как был уже check, нужно уменьшить количество кликов
if (global_mouseEvent.ClickCount > 0)
global_mouseEvent.ClickCount--;
this.delegate.Drawing_OnMouseDown(e.touches ? e.touches[0] : e); this.delegate.Drawing_OnMouseDown(e.touches ? e.touches[0] : e);
break; break;
} }
case AscCommon.MobileTouchMode.TableRuler: case AscCommon.MobileTouchMode.TableRuler:
{ {
this.HtmlPage.OnUpdateOverlay(); this.delegate.HtmlPage.OnUpdateOverlay();
break; break;
} }
} }
...@@ -251,7 +264,7 @@ ...@@ -251,7 +264,7 @@
}; };
CMobileTouchManager.prototype.onTouchMove = function(e) CMobileTouchManager.prototype.onTouchMove = function(e)
{ {
if (null != this.delegate.IsReader()) if (this.delegate.IsReader())
return this.onTouchMove_renderer(e); return this.onTouchMove_renderer(e);
if (this.Mode != AscCommon.MobileTouchMode.FlowObj && this.Mode != AscCommon.MobileTouchMode.TableMove) if (this.Mode != AscCommon.MobileTouchMode.FlowObj && this.Mode != AscCommon.MobileTouchMode.TableMove)
...@@ -409,12 +422,13 @@ ...@@ -409,12 +422,13 @@
{ {
this.IsTouching = false; this.IsTouching = false;
if (null != this.delegate.IsReader()) if (this.delegate.IsReader())
return this.onTouchEnd_renderer(e); return this.onTouchEnd_renderer(e);
var _e = e.changedTouches ? e.changedTouches[0] : e;
if (this.Mode != AscCommon.MobileTouchMode.FlowObj && this.Mode != AscCommon.MobileTouchMode.TableMove) if (this.Mode != AscCommon.MobileTouchMode.FlowObj && this.Mode != AscCommon.MobileTouchMode.TableMove)
{ {
AscCommon.check_MouseUpEvent(e.changedTouches ? e.changedTouches[0] : e); AscCommon.check_MouseUpEvent(_e);
} }
var isCheckContextMenuMode = true; var isCheckContextMenuMode = true;
...@@ -432,7 +446,8 @@ ...@@ -432,7 +446,8 @@
if (!this.MoveAfterDown) if (!this.MoveAfterDown)
{ {
global_mouseEvent.Button = 0; global_mouseEvent.Button = 0;
this.MoveCursorToPoint(false); this.delegate.Drawing_OnMouseDown(_e);
this.delegate.Drawing_OnMouseUp(_e);
this.Api.sendEvent("asc_onTapEvent", e); this.Api.sendEvent("asc_onTapEvent", e);
} }
else else
...@@ -565,7 +580,7 @@ ...@@ -565,7 +580,7 @@
var _markup = HtmlPage.m_oHorRuler.m_oTableMarkup; var _markup = HtmlPage.m_oHorRuler.m_oTableMarkup;
_markup.Rows[this.TableCurrentMovePos].H += (this.TableCurrentMoveValue - this.TableCurrentMoveValueOld); _markup.Rows[this.TableCurrentMovePos].H += (this.TableCurrentMoveValue - this.TableCurrentMoveValueOld);
if ( false === this.HtmlPage.m_oLogicDocument.Document_Is_SelectionLocked(AscCommon.changestype_Table_Properties) ) if ( false === this.delegate.HtmlPage.m_oLogicDocument.Document_Is_SelectionLocked(AscCommon.changestype_Table_Properties) )
{ {
HtmlPage.m_oLogicDocument.Create_NewHistoryPoint(AscDFH.historydescription_Document_SetTableMarkup_Hor); HtmlPage.m_oLogicDocument.Create_NewHistoryPoint(AscDFH.historydescription_Document_SetTableMarkup_Hor);
_markup.Table.Update_TableMarkupFromRuler(_markup, false, this.TableCurrentMovePos + 1); _markup.Table.Update_TableMarkupFromRuler(_markup, false, this.TableCurrentMovePos + 1);
......
...@@ -822,7 +822,7 @@ background-repeat: no-repeat;\ ...@@ -822,7 +822,7 @@ background-repeat: no-repeat;\
this.WordControl.m_oLogicDocument.TurnOff_CheckSpelling(); this.WordControl.m_oLogicDocument.TurnOff_CheckSpelling();
if (this.WordControl.MobileTouchManager) if (this.WordControl.MobileTouchManager)
this.WordControl.MobileTouchManager.LogicDocument = this.WordControl.m_oLogicDocument; this.WordControl.MobileTouchManager.delegate.LogicDocument = this.WordControl.m_oLogicDocument;
}; };
asc_docs_api.prototype.InitViewer = function() asc_docs_api.prototype.InitViewer = 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