Commit 7cfdc01f authored by Oleg.Korshul's avatar Oleg.Korshul Committed by Alexander.Trofimov

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@49807 954022d7-b5bf-4e40-9824-e11837661b57
parent b60e005a
......@@ -21,6 +21,12 @@ var c_oSerPropLenType = {
Double:5,
Variable:6
};
var g_tabtype_left = 0;
var g_tabtype_right = 1;
var g_tabtype_center = 2;
var g_tabtype_clear = 3;
function OpenColor() {
this.rgb = null;
this.auto = null;
......
......@@ -4632,6 +4632,9 @@ function CSlideDrawer()
this.bIsEmptyPresentation = true;
var dKoef = this.m_oWordControl.m_nZoomValue * g_dKoef_mm_to_pix / 100;
if (this.m_oWordControl.bIsRetinaSupport)
dKoef *= 2;
var w_mm = this.m_oWordControl.m_oLogicDocument.Width;
var h_mm = this.m_oWordControl.m_oLogicDocument.Height;
var w_px = (w_mm * dKoef) >> 0;
......@@ -4720,9 +4723,16 @@ function CSlideDrawer()
{
var _rect = this.m_oWordControl.m_oDrawingDocument.SlideCurrectRect;
var _bounds = this.BoundsChecker.Bounds;
var _x = _rect.left + _bounds.min_x;
var _y = _rect.top + _bounds.min_y;
if (this.m_oWordControl.bIsRetinaSupport)
{
_x = (_rect.left << 1) + _bounds.min_x;
_y = (_rect.top << 1) + _bounds.min_y;
}
if (this.bIsEmptyPresentation)
{
var w_px = _bounds.max_x - _bounds.min_x + 1;
......@@ -4749,6 +4759,9 @@ function CSlideDrawer()
else
{
var dKoef = this.m_oWordControl.m_nZoomValue * g_dKoef_mm_to_pix / 100;
if (this.m_oWordControl.bIsRetinaSupport)
dKoef *= 2;
var w_mm = this.m_oWordControl.m_oLogicDocument.Width;
var h_mm = this.m_oWordControl.m_oLogicDocument.Height;
var w_px = (w_mm * dKoef) >> 0;
......
......@@ -216,6 +216,9 @@ function CEditorPage(api)
this.VerticalScrollOnMouseUp = { SlideNum : 0, ScrollY : 0, ScrollY_max : 0};
this.IsGoToPageMAXPosition = false;
this.bIsRetinaSupport = true;
this.bIsRetinaNoSupportAttack = false;
this.MasterLayouts = null; // мастер, от которого посылались в меню последние шаблоны
// demonstrationMode
......@@ -427,6 +430,37 @@ function CEditorPage(api)
this.OnResize(true);
}
this.CheckRetinaDisplay = function()
{
var old = this.bIsRetinaSupport;
if (!this.bIsRetinaNoSupportAttack)
{
if (window.devicePixelRatio != 2)
this.bIsRetinaSupport = false;
else
this.bIsRetinaSupport = true;
}
else
{
this.bIsRetinaSupport = false;
}
if (old != this.bIsRetinaSupport)
{
// сбросить кэш страниц
}
}
this.CheckRetinaElement = function(htmlElem)
{
if (this.bIsRetinaSupport)
{
if (htmlElem.id == "id_viewer" || htmlElem.id == "id_hor_ruler" || htmlElem.id == "id_vert_ruler")
return true;
}
return false;
}
this.ShowOverlay = function()
{
this.m_oOverlayApi.Show();
......@@ -588,6 +622,8 @@ function CEditorPage(api)
}
var w = this.m_oEditor.HtmlElement.width;
if (this.bIsRetinaSupport)
w >>= 1;
var Zoom = 100;
var _pageWidth = this.m_oLogicDocument.Width * g_dKoef_mm_to_pix;
......@@ -618,6 +654,9 @@ function CEditorPage(api)
}
var w = this.m_oEditor.HtmlElement.width;
if (this.bIsRetinaSupport)
w >>= 1;
var h = (((this.m_oBody.AbsolutePosition.B - this.m_oBody.AbsolutePosition.T) -
(this.m_oTopRuler.AbsolutePosition.B - this.m_oTopRuler.AbsolutePosition.T)) * g_dKoef_mm_to_pix) >> 0;
......@@ -787,8 +826,16 @@ function CEditorPage(api)
var boxX = 0;
var boxY = 0;
var boxR = this.m_oEditor.HtmlElement.width - 2;
var boxB = this.m_oEditor.HtmlElement.height - rectSize;
var w = this.m_oEditor.HtmlElement.width;
if (this.bIsRetinaSupport)
w >>= 1;
var h = this.m_oEditor.HtmlElement.height;
if (this.bIsRetinaSupport)
h >>= 1;
var boxR = w - 2;
var boxB = h - rectSize;
var nValueScrollHor = 0;
if (pos.X < boxX)
......@@ -796,7 +843,7 @@ function CEditorPage(api)
if (pos.X > boxR)
{
var _mem = x - g_dKoef_pix_to_mm * this.m_oEditor.HtmlElement.width * 100 / this.m_nZoomValue;
var _mem = x - g_dKoef_pix_to_mm * w * 100 / this.m_nZoomValue;
nValueScrollHor = this.GetHorizontalScrollTo(_mem, navi.PageNum);
}
......@@ -806,7 +853,7 @@ function CEditorPage(api)
if (pos.Y > boxB)
{
var _mem = y + navi.H + 10 - g_dKoef_pix_to_mm * this.m_oEditor.HtmlElement.height * 100 / this.m_nZoomValue;
var _mem = y + navi.H + 10 - g_dKoef_pix_to_mm * h * 100 / this.m_nZoomValue;
nValueScrollVer = this.GetVerticalScrollTo(_mem, navi.PageNum);
}
......@@ -815,14 +862,14 @@ function CEditorPage(api)
{
isNeedScroll = true;
this.m_bIsUpdateTargetNoAttack = true;
var temp = nValueScrollHor * this.m_dScrollX_max / (this.m_dDocumentWidth - this.m_oEditor.HtmlElement.width);
var temp = nValueScrollHor * this.m_dScrollX_max / (this.m_dDocumentWidth - w);
this.m_oScrollHorApi.scrollToX(parseInt(temp), false);
}
if (0 != nValueScrollVer)
{
isNeedScroll = true;
this.m_bIsUpdateTargetNoAttack = true;
var temp = nValueScrollVer * this.m_dScrollY_max / (this.m_dDocumentHeight - this.m_oEditor.HtmlElement.height);
var temp = nValueScrollVer * this.m_dScrollY_max / (this.m_dDocumentHeight - h);
this.m_oScrollVerApi.scrollToY(parseInt(temp), false);
}
......@@ -1845,6 +1892,12 @@ function CEditorPage(api)
hsscrollStep: 45
};
if (this.bIsRetinaSupport)
{
settings.screenW >>= 1;
settings.screenH >>= 1;
}
if (this.m_bIsHorScrollVisible)
{
if (this.m_oScrollHor_)
......@@ -1938,7 +1991,8 @@ function CEditorPage(api)
}
//console.log("resize");
this.m_oBody.Resize(this.Width * g_dKoef_pix_to_mm, this.Height * g_dKoef_pix_to_mm);
this.CheckRetinaDisplay();
this.m_oBody.Resize(this.Width * g_dKoef_pix_to_mm, this.Height * g_dKoef_pix_to_mm, this);
this.DemonstrationManager.Resize();
if (this.checkNeedHorScroll())
......@@ -1985,7 +2039,7 @@ function CEditorPage(api)
this.OnResize2 = function(isAttack)
{
this.m_oBody.Resize(this.Width * g_dKoef_pix_to_mm, this.Height * g_dKoef_pix_to_mm);
this.m_oBody.Resize(this.Width * g_dKoef_pix_to_mm, this.Height * g_dKoef_pix_to_mm, this);
this.DemonstrationManager.Resize();
if (this.checkNeedHorScroll())
......@@ -2051,8 +2105,12 @@ function CEditorPage(api)
}
this.checkNeedHorScroll = function()
{
var w = this.m_oEditor.HtmlElement.width;
if (this.bIsRetinaSupport)
w >>= 1;
var oldVisible = this.m_bIsHorScrollVisible;
if (this.m_dDocumentWidth <= this.m_oEditor.HtmlElement.width)
if (this.m_dDocumentWidth <= w)
{
this.m_bIsHorScrollVisible = false;
}
......@@ -2227,15 +2285,30 @@ function CEditorPage(api)
var _slideW = (dKoef * this.m_oLogicDocument.Width) >> 0;
var _slideH = (dKoef * this.m_oLogicDocument.Height) >> 0;
var _centerX = (this.m_oEditor.HtmlElement.width / 2) >> 0;
var _srcW = this.m_oEditor.HtmlElement.width;
var _srcH = this.m_oEditor.HtmlElement.height;
if (this.bIsRetinaSupport)
{
_srcW >>= 1;
_srcH >>= 1;
_bounds_slide = {
min_x : _bounds_slide.min_x >> 1,
min_y : _bounds_slide.min_y >> 1,
max_x : _bounds_slide.max_x >> 1,
max_y : _bounds_slide.max_y >> 1
};
}
var _centerX = (_srcW / 2) >> 0;
var _centerSlideX = (dKoef * this.m_oLogicDocument.Width / 2) >> 0;
var _hor_width_left = Math.min(0, _centerX - (_centerSlideX - _bounds_slide.min_x) - this.SlideDrawer.CONST_BORDER);
var _hor_width_right = Math.max(this.m_oEditor.HtmlElement.width - 1, _centerX + (_bounds_slide.max_x - _centerSlideX) + this.SlideDrawer.CONST_BORDER);
var _hor_width_right = Math.max(_srcW - 1, _centerX + (_bounds_slide.max_x - _centerSlideX) + this.SlideDrawer.CONST_BORDER);
var _centerY = (this.m_oEditor.HtmlElement.height / 2) >> 0;
var _centerY = (_srcH / 2) >> 0;
var _centerSlideY = (dKoef * this.m_oLogicDocument.Height / 2) >> 0;
var _ver_height_top = Math.min(0, _centerY - (_centerSlideY - _bounds_slide.min_y) - this.SlideDrawer.CONST_BORDER);
var _ver_height_bottom = Math.max(this.m_oEditor.HtmlElement.height - 1, _centerX + (_bounds_slide.max_y - _centerSlideY) + this.SlideDrawer.CONST_BORDER);
var _ver_height_bottom = Math.max(_srcH - 1, _centerX + (_bounds_slide.max_y - _centerSlideY) + this.SlideDrawer.CONST_BORDER);
if (this.m_dScrollY <= this.SlideScrollMIN)
this.m_dScrollY = this.SlideScrollMIN;
......@@ -2334,21 +2407,36 @@ function CEditorPage(api)
var _bounds_slide = this.SlideDrawer.BoundsChecker.Bounds;
var _centerX = (this.m_oEditor.HtmlElement.width / 2) >> 0;
var _srcW = this.m_oEditor.HtmlElement.width;
var _srcH = this.m_oEditor.HtmlElement.height;
if (this.bIsRetinaSupport)
{
_srcW >>= 1;
_srcH >>= 1;
_bounds_slide = {
min_x : _bounds_slide.min_x >> 1,
min_y : _bounds_slide.min_y >> 1,
max_x : _bounds_slide.max_x >> 1,
max_y : _bounds_slide.max_y >> 1
};
}
var _centerX = (_srcW / 2) >> 0;
var _centerSlideX = (dKoef * this.m_oLogicDocument.Width / 2) >> 0;
var _hor_width_left = Math.min(0, _centerX - (_centerSlideX - _bounds_slide.min_x) - this.SlideDrawer.CONST_BORDER);
var _hor_width_right = Math.max(this.m_oEditor.HtmlElement.width - 1, _centerX + (_bounds_slide.max_x - _centerSlideX) + this.SlideDrawer.CONST_BORDER);
var _hor_width_right = Math.max(_srcW - 1, _centerX + (_bounds_slide.max_x - _centerSlideX) + this.SlideDrawer.CONST_BORDER);
var _centerY = (this.m_oEditor.HtmlElement.height / 2) >> 0;
var _centerY = (_srcH / 2) >> 0;
var _centerSlideY = (dKoef * this.m_oLogicDocument.Height / 2) >> 0;
var _ver_height_top = Math.min(0, _centerY - (_centerSlideY - _bounds_slide.min_y) - this.SlideDrawer.CONST_BORDER);
var _ver_height_bottom = Math.max(this.m_oEditor.HtmlElement.height - 1, _centerY + (_bounds_slide.max_y - _centerSlideY) + this.SlideDrawer.CONST_BORDER);
var _ver_height_bottom = Math.max(_srcH - 1, _centerY + (_bounds_slide.max_y - _centerSlideY) + this.SlideDrawer.CONST_BORDER);
var lWSlide = _hor_width_right - _hor_width_left + 1;
var lHSlide = _ver_height_bottom - _ver_height_top + 1;
var one_slide_width = lWSlide;
var one_slide_height = Math.max(lHSlide, this.m_oEditor.HtmlElement.height);
var one_slide_height = Math.max(lHSlide, _srcH);
this.m_dDocumentPageWidth = one_slide_width;
this.m_dDocumentPageHeight = one_slide_height;
......@@ -2374,12 +2462,12 @@ function CEditorPage(api)
this.OldDocumentHeight = this.m_dDocumentHeight;
this.SlideScrollMIN = this.m_oDrawingDocument.SlideCurrent * one_slide_height;
this.SlideScrollMAX = this.SlideScrollMIN + one_slide_height - this.m_oEditor.HtmlElement.height;
this.SlideScrollMAX = this.SlideScrollMIN + one_slide_height - _srcH;
if (0 == this.m_oDrawingDocument.SlidesCount)
{
this.SlideScrollMIN = 0;
this.SlideScrollMAX = this.SlideScrollMIN + one_slide_height - this.m_oEditor.HtmlElement.height;
this.SlideScrollMAX = this.SlideScrollMIN + one_slide_height - _srcH;
}
// теперь проверим необходимость перезуммирования
......
......@@ -3503,6 +3503,8 @@ asc_docs_api.prototype.SetMobileVersion = function(val)
this.isMobileVersion = val;
if (this.isMobileVersion)
{
this.WordControl.bIsRetinaSupport = false; // ipad имеет проблемы с большими картинками
this.WordControl.bIsRetinaNoSupportAttack = true;
this.WordControl.m_bIsRuler = false;
this.ShowParaMarks = false;
}
......
......@@ -1766,9 +1766,15 @@ function CEditorPage(api)
var deltaY = 0;
if (undefined != e.wheelDelta && e.wheelDelta != 0)
delta = (e.wheelDelta > 0) ? -45 : 45;
{
//delta = (e.wheelDelta > 0) ? -45 : 45;
delta = -45 * e.wheelDelta / 120;
}
else if (undefined != e.detail && e.detail != 0)
delta = (e.detail > 0) ? 45 : -45;
{
//delta = (e.detail > 0) ? 45 : -45;
delta = 45 * e.detail / 3;
}
// New school multidimensional scroll (touchpads) deltas
deltaY = delta;
......@@ -1785,15 +1791,24 @@ function CEditorPage(api)
if (e.wheelDeltaY !== undefined)
{
if (e.wheelDelta != 0)
deltaY = (e.wheelDeltaY > 0) ? -45 : 45;
{
//deltaY = (e.wheelDeltaY > 0) ? -45 : 45;
deltaY = -45 * e.wheelDeltaY / 120;
}
}
if (e.wheelDeltaX !== undefined)
{
if (e.wheelDeltaX != 0)
deltaX = (e.wheelDeltaX > 0) ? -45 : 45;
{
//deltaX = (e.wheelDeltaX > 0) ? -45 : 45;
deltaX = -45 * e.wheelDeltaX / 120;
}
}
}
deltaX >>= 0;
deltaY >>= 0;
if (0 != deltaX)
oThis.m_oScrollHorApi.scrollBy(deltaX, 0, false);
else if (0 != deltaY)
......
......@@ -1026,7 +1026,7 @@ function CHorRuler()
{
if ((y > (_top - 1)) && (y < (_top + 1.68)))
{
if (0 == this.m_dIndentLeftFirst && 0 == this.m_dIndentLeft && this.CurrentObjectType == RULER_OBJECT_TYPE_PARAGRAPH)
if (0 == this.m_dIndentLeftFirst && 0 == this.m_dIndentLeft && this.CurrentObjectType == RULER_OBJECT_TYPE_PARAGRAPH && this.IsCanMoveMargins)
{
if (y > (_top + 1))
return 1;
......
......@@ -508,11 +508,6 @@ var ETblLayoutType = {
var g_nodeAttributeStart = 0xFA;
var g_nodeAttributeEnd = 0xFB;
var g_tabtype_left = 0;
var g_tabtype_right = 1;
var g_tabtype_center = 2;
var g_tabtype_clear = 3;
var g_sErrorCharCountMessage = "g_sErrorCharCountMessage";
var g_nErrorCharCount = 30000;
var g_nErrorParagraphCount = 1000;
......
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