Commit 78945eba authored by Oleg Korshul's avatar Oleg Korshul

.

parent 95cb8f9c
...@@ -479,6 +479,8 @@ ...@@ -479,6 +479,8 @@
this.delegate = null; this.delegate = null;
} }
// создание вспомогательного элемента, для прокрутки. по идее потом можно изменить
// просто на сдвиги. но пока так
CMobileTouchManagerBase.prototype.CreateScrollerDiv = function(_wrapper) CMobileTouchManagerBase.prototype.CreateScrollerDiv = function(_wrapper)
{ {
var _scroller = document.createElement('div'); var _scroller = document.createElement('div');
...@@ -492,6 +494,8 @@ ...@@ -492,6 +494,8 @@
_wrapper.appendChild(_scroller); _wrapper.appendChild(_scroller);
}; };
// здесь загрузка нужных картинок. пока только для таблицы (движение)
// грузим в конструкторе, используем тогда, когда загружено (asc_complete)
CMobileTouchManagerBase.prototype.LoadMobileImages = function() CMobileTouchManagerBase.prototype.LoadMobileImages = function()
{ {
window.g_table_track_mobile_move = new Image(); window.g_table_track_mobile_move = new Image();
...@@ -503,6 +507,7 @@ ...@@ -503,6 +507,7 @@
window.g_table_track_mobile_move.src = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAArlJREFUeNqMlc9rWkEQx8ffGqMJBJpSUEIISInxpCfT1krioQQ85xISEKGBkGuhpxwEL4GAoOBJ8V9IxJCQ1l4SkFKxQvEfKEXQ0Nb4IxLtfBefvMeriQPj7ps377Mzu7OjZjgckoYlGo2+tFqtcZ1OFyAiG00nfx8eHj7f3d19SKfTP5g11LBRs7u761lYWPiytbVl9/l8ZDKZpqL1ej0qlUp0enr6p9FovM5kMhU92w02my0OmN/vJ0TcbreJVxZzCH9ARqORQqGQCurxeAC2n52dxfkxDOCMXq9/5fV6aTAYEIc/BkHYkWKx2Ni2ubn5X+j5+fkbweIf5GdFmoAhMkny+TzF43GyWCzi+ejoSIA3NjYUQA4IA5xMmGnhBO33+4rowuEwbW9vKz7Gdtzf36ui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36uiHH2n1eJQkCoE0WFeKBTE2O12qdlsKhQ2vLu6uhKjXMHSyuhivLi4oEQiQVLUk/T4+JiKxaLCJtKXQNDLy0tKJpM0NzcnrThR4HNyciLm6+vraiAEB8P1KE9hoqCMzGYzGQwG4asASoZAIEDz8/OUSqWeBGLxg4MDWl1dHe+rKkKUDWpqf3//SeDh4SG5XC5x6nKGYg+lW+J2u6nT6TwKBEzuo0pZPiJSyPX1NWWz2bFdy1UWiUQIt0rykUSe8pDrr837MCMvakgwGCSHw0G5XE487+3t0dLSkip6FDozumABOODVvt3c3PiXl5cVjq1Wi1ZWVmhnZ0dcL6fTqYoMUqlUYP8Klg7dhlNp3N7evuM7a0DZcE9UrL64uEh2u318APJ35XIZl6HN0I/1er2GfmhkfcGb/JYP4/3s7OwaL2Ceph/yvnU5i+/VajVVq9U+semnaLCjTvGM9TkuAaKesmP3WX+z/mKts3Y00l/ACDIzamfa0UKPCU4QR9tDEwIcfwH/BBgAl4G4NBf6Z6AAAAAASUVORK5CYII=";
}; };
// onTouchStart => попали ли в якорьки селекта, чтобы не начинать скроллы/зумы
CMobileTouchManagerBase.prototype.CheckSelectTrack = function() CMobileTouchManagerBase.prototype.CheckSelectTrack = function()
{ {
if (!this.SelectEnabled) if (!this.SelectEnabled)
...@@ -550,6 +555,7 @@ ...@@ -550,6 +555,7 @@
return (this.Mode == AscCommon.MobileTouchMode.Select); return (this.Mode == AscCommon.MobileTouchMode.Select);
}; };
// onTouchStart => попали ли в якорьки таблицы, чтобы не начинать скроллы/зумы
CMobileTouchManagerBase.prototype.CheckTableTrack = function() CMobileTouchManagerBase.prototype.CheckTableTrack = function()
{ {
if (!this.TableTrackEnabled) if (!this.TableTrackEnabled)
...@@ -795,6 +801,7 @@ ...@@ -795,6 +801,7 @@
return bIsTable; return bIsTable;
}; };
// onTouchStart => попали ли в якорьки трека объекта (шейп, картинка), чтобы не начинать скроллы/зумы
CMobileTouchManagerBase.prototype.CheckObjectTrack = function() CMobileTouchManagerBase.prototype.CheckObjectTrack = function()
{ {
var pos = this.delegate.ConvertCoordsFromCursor(global_mouseEvent.X, global_mouseEvent.Y); var pos = this.delegate.ConvertCoordsFromCursor(global_mouseEvent.X, global_mouseEvent.Y);
...@@ -814,6 +821,7 @@ ...@@ -814,6 +821,7 @@
return (AscCommon.MobileTouchMode.FlowObj == this.Mode); return (AscCommon.MobileTouchMode.FlowObj == this.Mode);
}; };
// в мобильной версии - меньше, чем "по ширине" - не делаем
CMobileTouchManagerBase.prototype.CheckZoomCriticalValues = function(zoomMin) CMobileTouchManagerBase.prototype.CheckZoomCriticalValues = function(zoomMin)
{ {
if (zoomMin !== undefined) if (zoomMin !== undefined)
...@@ -832,6 +840,7 @@ ...@@ -832,6 +840,7 @@
} }
}; };
// изменился размер документа/экрана => нужно перескитать вспомогательный элемент для скролла
CMobileTouchManagerBase.prototype.Resize = function() CMobileTouchManagerBase.prototype.Resize = function()
{ {
if (this.iScroll != null) if (this.iScroll != null)
...@@ -844,6 +853,7 @@ ...@@ -844,6 +853,7 @@
} }
}; };
// есть ли тач или анимационный скролл/зум
CMobileTouchManagerBase.prototype.IsWorkedPosition = function() CMobileTouchManagerBase.prototype.IsWorkedPosition = function()
{ {
if (this.IsTouching) if (this.IsTouching)
...@@ -855,6 +865,7 @@ ...@@ -855,6 +865,7 @@
return false; return false;
}; };
// удаление вспомогательного элемента
CMobileTouchManagerBase.prototype.Destroy = function() CMobileTouchManagerBase.prototype.Destroy = function()
{ {
var _scroller = document.getElementById(this.iScrollElement); var _scroller = document.getElementById(this.iScrollElement);
...@@ -911,6 +922,7 @@ ...@@ -911,6 +922,7 @@
this.Api.sendEvent("asc_onHidePopMenu"); this.Api.sendEvent("asc_onHidePopMenu");
}; };
// закончился скролл
CMobileTouchManagerBase.prototype.OnScrollAnimationEnd = function() CMobileTouchManagerBase.prototype.OnScrollAnimationEnd = function()
{ {
if (this.Api.isViewMode) if (this.Api.isViewMode)
...@@ -919,7 +931,7 @@ ...@@ -919,7 +931,7 @@
this.CheckContextMenuTouchEnd(false); this.CheckContextMenuTouchEnd(false);
}; };
/* select rects */ // обновление ректов для селекта текстового
CMobileTouchManagerBase.prototype.CheckSelectRects = function() CMobileTouchManagerBase.prototype.CheckSelectRects = function()
{ {
this.RectSelect1 = null; this.RectSelect1 = null;
...@@ -950,8 +962,12 @@ ...@@ -950,8 +962,12 @@
this.PageSelect2 = _rect2.Page; this.PageSelect2 = _rect2.Page;
}; };
// отрисовка текстового селекта
CMobileTouchManagerBase.prototype.CheckSelect = function(overlay) CMobileTouchManagerBase.prototype.CheckSelect = function(overlay)
{ {
if (!this.SelectEnabled)
return;
this.CheckSelectRects(); this.CheckSelectRects();
if (null == this.RectSelect1 || null == this.RectSelect2) if (null == this.RectSelect1 || null == this.RectSelect2)
return; return;
...@@ -1048,6 +1064,8 @@ ...@@ -1048,6 +1064,8 @@
} }
}; };
// отрисовка табличного селекта
// заточка на определенного делегата
CMobileTouchManagerBase.prototype.CheckTableRules = function(overlay) CMobileTouchManagerBase.prototype.CheckTableRules = function(overlay)
{ {
if (this.Api.isViewMode || !this.TableTrackEnabled) if (this.Api.isViewMode || !this.TableTrackEnabled)
...@@ -1360,7 +1378,7 @@ ...@@ -1360,7 +1378,7 @@
} }
}; };
/* viewer methods */ /* document renderer mode (заточка на делегата) */
CMobileTouchManagerBase.prototype.onTouchStart_renderer = function(e) CMobileTouchManagerBase.prototype.onTouchStart_renderer = function(e)
{ {
AscCommon.check_MouseDownEvent(e.touches ? e.touches[0] : e, true); AscCommon.check_MouseDownEvent(e.touches ? e.touches[0] : e, true);
...@@ -1504,7 +1522,7 @@ ...@@ -1504,7 +1522,7 @@
case AscCommon.MobileTouchMode.Zoom: case AscCommon.MobileTouchMode.Zoom:
{ {
// здесь нужно запускать отрисовку, если есть анимация зума // здесь нужно запускать отрисовку, если есть анимация зума
this.delegate.HtmlPage.NoneRepaintPdelegate.ages = false; this.delegate.HtmlPage.NoneRepaintPages = false;
this.delegate.HtmlPage.m_bIsFullRepaint = true; this.delegate.HtmlPage.m_bIsFullRepaint = true;
this.delegate.HtmlPage.OnScroll(); this.delegate.HtmlPage.OnScroll();
...@@ -1521,7 +1539,7 @@ ...@@ -1521,7 +1539,7 @@
e.returnValue = false; e.returnValue = false;
}; };
/* simple click */ /* перемещение курсора (именно курсора!) до ближайщей позиции. заточка на делегата */
CMobileTouchManagerBase.prototype.MoveCursorToPoint = function(isHalfHeight) CMobileTouchManagerBase.prototype.MoveCursorToPoint = function(isHalfHeight)
{ {
var pos = this.delegate.ConvertCoordsFromCursor(global_mouseEvent.X, global_mouseEvent.Y); var pos = this.delegate.ConvertCoordsFromCursor(global_mouseEvent.X, global_mouseEvent.Y);
...@@ -1543,6 +1561,7 @@ ...@@ -1543,6 +1561,7 @@
}; };
//--------------------------------------------------------export---------------------------------------------------- //--------------------------------------------------------export----------------------------------------------------
AscCommon.CMobileDelegateSimple = CMobileDelegateSimple;
AscCommon.CMobileTouchManagerBase = CMobileTouchManagerBase; AscCommon.CMobileTouchManagerBase = CMobileTouchManagerBase;
AscCommon.CMobileDelegateEditor = CMobileDelegateEditor; AscCommon.CMobileDelegateEditor = CMobileDelegateEditor;
})(window); })(window);
...@@ -444,7 +444,7 @@ function CEditorPage(api) ...@@ -444,7 +444,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.m_oApi); this.MobileTouchManager.Init(this.m_oApi);
} }
...@@ -2278,7 +2278,7 @@ function CEditorPage(api) ...@@ -2278,7 +2278,7 @@ function CEditorPage(api)
} }
this.ReaderTouchManager = new AscCommon.CReaderTouchManager(); this.ReaderTouchManager = new AscCommon.CReaderTouchManager();
this.ReaderTouchManager.Init(this); this.ReaderTouchManager.Init(this.m_oApi);
this.TransformDivUseAnimation(this.ReaderModeDivWrapper, 0); this.TransformDivUseAnimation(this.ReaderModeDivWrapper, 0);
...@@ -2353,8 +2353,9 @@ function CEditorPage(api) ...@@ -2353,8 +2353,9 @@ function CEditorPage(api)
if (oThis.m_oApi.isMobileVersion) if (oThis.m_oApi.isMobileVersion)
{ {
oThis.MobileTouchManager = new AscCommon.CMobileTouchManager({}); oThis.MobileTouchManager = new AscCommon.CMobileTouchManager();
oThis.MobileTouchManager.Init(oThis); oThis.MobileTouchManager.Init(oThis.m_oApi);
oThis.MobileTouchManager.Resize();
} }
return; return;
......
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
*/ */
function CMobileTouchManager(_config) function CMobileTouchManager(_config)
{ {
CMobileTouchManager.superclass.constructor.call(this, _config); CMobileTouchManager.superclass.constructor.call(this, _config || {});
} }
AscCommon.extendClass(CMobileTouchManager, AscCommon.CMobileTouchManagerBase); AscCommon.extendClass(CMobileTouchManager, AscCommon.CMobileTouchManagerBase);
...@@ -610,80 +610,116 @@ ...@@ -610,80 +610,116 @@
this.CheckContextMenuTouchEnd(isCheckContextMenuMode); this.CheckContextMenuTouchEnd(isCheckContextMenuMode);
}; };
function CReaderTouchManager() /*************************************** READER ******************************************/
/**
* @extends {AscCommon.CMobileDelegateSimple}
*/
function CMobileDelegateEditorReader(_manager)
{
CMobileDelegateEditorReader.superclass.constructor.call(this, _manager);
this.HtmlPage = this.Api.WordControl;
}
AscCommon.extendClass(CMobileDelegateEditorReader, AscCommon.CMobileDelegateSimple);
CMobileDelegateEditorReader.prototype.GetZoom = function()
{
return this.HtmlPage.m_nZoomValue;
};
CMobileDelegateEditorReader.prototype.SetZoom = function(_value)
{
this.HtmlPage.m_oApi.zoom(_value);
};
CMobileDelegateEditorReader.prototype.GetScrollerParent = function()
{
return this.HtmlPage.m_oMainView.HtmlElement;
};
/**
* @extends {AscCommon.CMobileTouchManagerBase}
*/
function CReaderTouchManager(_config)
{ {
this.HtmlPage = null; CReaderTouchManager.superclass.constructor.call(this, _config || {});
this.iScroll = null;
this.SelectEnabled = false;
this.TableTrackEnabled = false;
this.bIsLock = false; this.bIsLock = false;
this.bIsMoveAfterDown = false; this.bIsMoveAfterDown = false;
}
AscCommon.extendClass(CReaderTouchManager, AscCommon.CMobileTouchManagerBase);
this.Init = function(ctrl) CReaderTouchManager.prototype.Init = function(_api)
{ {
this.HtmlPage = ctrl; this.Api = _api;
this.LogicDocument = ctrl.m_oLogicDocument; this.iScrollElement = "reader_id";
this.DrawingDocument = ctrl.m_oDrawingDocument;
this.iScroll = new window.IScroll(this.HtmlPage.m_oMainView.HtmlElement, {
scrollbars: true,
mouseWheel: true,
interactiveScrollbars: true,
shrinkScrollbars: 'scale',
fadeScrollbars: true,
scrollX : true,
scroller_id : "reader_id",
bounce : false
});
this.iScroll.manager = this;
this.HtmlPage.m_oApi.sendEvent("asc_onHidePopMenu");
};
this.onTouchStart = function(e)
{
this.iScroll._start(e);
this.bIsLock = true;
this.bIsMoveAfterDown = false;
};
this.onTouchMove = function(e)
{
if (!this.bIsLock)
return;
this.iScroll._move(e);
this.bIsMoveAfterDown = true;
};
this.onTouchEnd = function(e)
{
this.iScroll._end(e);
this.bIsLock = false;
if (this.bIsMoveAfterDown === false) // создаем делегата. инициализация его - ПОСЛЕ создания iScroll
{ this.delegate = new CMobileDelegateEditorReader(this);
this.HtmlPage.m_oApi.sendEvent("asc_onTapEvent", e);
}
};
this.Resize = function() this.iScroll = new window.IScroll(this.delegate.GetScrollerParent(), {
{ scrollbars: true,
this.HtmlPage.ReaderModeDivWrapper.style.width = this.HtmlPage.m_oMainView.HtmlElement.style.width; mouseWheel: true,
this.HtmlPage.ReaderModeDivWrapper.style.height = this.HtmlPage.m_oMainView.HtmlElement.style.height; interactiveScrollbars: true,
shrinkScrollbars: 'scale',
fadeScrollbars: true,
scrollX : true,
scroller_id : this.iScrollElement,
bounce : true
});
if (this.iScroll != null) // создаем делегата. инициализация его - ПОСЛЕ создания iScroll
this.iScroll.refresh(); this.delegate.Init(this);
};
this.ChangeFontSize = function() this.Api.sendEvent("asc_onHidePopMenu");
{ };
if (this.iScroll != null)
this.iScroll.refresh(); CReaderTouchManager.prototype.onTouchStart = function(e)
}; {
this.iScroll._start(e);
this.bIsLock = true;
this.bIsMoveAfterDown = false;
};
CReaderTouchManager.prototype.onTouchMove = function(e)
{
if (!this.bIsLock)
return;
this.iScroll._move(e);
this.bIsMoveAfterDown = true;
};
CReaderTouchManager.prototype.onTouchEnd = function(e)
{
this.iScroll._end(e);
this.bIsLock = false;
this.Destroy = function() if (this.bIsMoveAfterDown === false)
{ {
if (this.iScroll != null) this.Api.sendEvent("asc_onTapEvent", e);
this.iScroll.destroy(); }
}; };
}
CReaderTouchManager.prototype.Resize = function()
{
var HtmlPage = this.delegate.HtmlPage;
HtmlPage.ReaderModeDivWrapper.style.width = HtmlPage.m_oMainView.HtmlElement.style.width;
HtmlPage.ReaderModeDivWrapper.style.height = HtmlPage.m_oMainView.HtmlElement.style.height;
if (this.iScroll != null)
this.iScroll.refresh();
};
CReaderTouchManager.prototype.ChangeFontSize = function()
{
if (this.iScroll != null)
this.iScroll.refresh();
};
CReaderTouchManager.prototype.Destroy = function()
{
if (this.iScroll != null)
this.iScroll.destroy();
};
//--------------------------------------------------------export---------------------------------------------------- //--------------------------------------------------------export----------------------------------------------------
window['AscCommon'] = window['AscCommon'] || {}; window['AscCommon'] = window['AscCommon'] || {};
......
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