Commit 79c46949 authored by Oleg Korshul's avatar Oleg Korshul

.

parent ba20b625
...@@ -5171,6 +5171,7 @@ function CSlideDrawer() ...@@ -5171,6 +5171,7 @@ function CSlideDrawer()
this.CachedCanvasCtx = null; this.CachedCanvasCtx = null;
this.BoundsChecker = new AscFormat.CSlideBoundsChecker(); this.BoundsChecker = new AscFormat.CSlideBoundsChecker();
this.BoundsChecker2 = new AscFormat.CSlideBoundsChecker();
this.CacheSlidePixW = 1; this.CacheSlidePixW = 1;
this.CacheSlidePixH = 1; this.CacheSlidePixH = 1;
...@@ -5190,6 +5191,38 @@ function CSlideDrawer() ...@@ -5190,6 +5191,38 @@ function CSlideDrawer()
} }
} }
this.CheckSlideSize = function(zoom, slideNum)
{
if (-1 == slideNum)
this.bIsEmptyPresentation = true;
var dKoef = zoom * g_dKoef_mm_to_pix / 100;
if (this.m_oWordControl.bIsRetinaSupport)
dKoef *= AscCommon.AscBrowser.retinaPixelRatio;
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;
var h_px = (h_mm * dKoef) >> 0;
this.BoundsChecker2.init(w_px, h_px, w_mm, h_mm);
this.BoundsChecker2.transform(1, 0, 0, 1, 0, 0);
if (this.bIsEmptyPresentation)
{
this.BoundsChecker2._s();
this.BoundsChecker2._m(0, 0);
this.BoundsChecker2._l(w_mm, 0);
this.BoundsChecker2._l(w_mm, h_mm);
this.BoundsChecker2._l(0, h_mm);
this.BoundsChecker2._z();
return;
}
this.m_oWordControl.m_oLogicDocument.DrawPage(slideNum, this.BoundsChecker2);
}
this.CheckSlide = function(slideNum) this.CheckSlide = function(slideNum)
{ {
if (this.m_oWordControl.m_oApi.isSaveFonts_Images) if (this.m_oWordControl.m_oApi.isSaveFonts_Images)
...@@ -5504,6 +5537,7 @@ function CNotesDrawer(page) ...@@ -5504,6 +5537,7 @@ function CNotesDrawer(page)
g.m_oCoordTransform.ty = -this.Scroll; g.m_oCoordTransform.ty = -this.Scroll;
g.transform(1, 0, 0, 1, 0, 0); g.transform(1, 0, 0, 1, 0, 0);
g.IsNoDrawingEmptyPlaceholder = true;
g.IsNoDrawingEmptyPlaceholderText = true; g.IsNoDrawingEmptyPlaceholderText = true;
this.HtmlPage.m_oLogicDocument.Notes_Draw(this.Slide, g); this.HtmlPage.m_oLogicDocument.Notes_Draw(this.Slide, g);
......
...@@ -196,7 +196,6 @@ function CEditorPage(api) ...@@ -196,7 +196,6 @@ function CEditorPage(api)
// properties // properties
this.m_bIsHorScrollVisible = false; this.m_bIsHorScrollVisible = false;
this.m_bIsCheckHeedHorScrollRepeat = false;
this.m_bIsRuler = false; this.m_bIsRuler = false;
this.m_bDocumentPlaceChangedEnabled = false; this.m_bDocumentPlaceChangedEnabled = false;
...@@ -846,13 +845,11 @@ function CEditorPage(api) ...@@ -846,13 +845,11 @@ function CEditorPage(api)
oThis.OnResize(true); oThis.OnResize(true);
}; };
this.zoom_FitToWidth = function() this.zoom_FitToWidth_value = function()
{ {
if (null == this.m_oLogicDocument) var _value = 100;
{ if (!this.m_oLogicDocument)
this.m_nZoomType = 1; return _value;
return;
}
var w = this.m_oEditor.HtmlElement.width; var w = this.m_oEditor.HtmlElement.width;
if (this.bIsRetinaSupport) if (this.bIsRetinaSupport)
...@@ -867,34 +864,23 @@ function CEditorPage(api) ...@@ -867,34 +864,23 @@ function CEditorPage(api)
if (Zoom < 5) if (Zoom < 5)
Zoom = 5; Zoom = 5;
} }
var _new_value = Zoom >> 0; _value = Zoom >> 0;
return _value;
this.m_nZoomType = 1;
if (_new_value != this.m_nZoomValue)
{
this.m_nZoomValue = _new_value;
this.zoom_Fire(1);
return true;
}
else
{
this.m_oApi.sync_zoomChangeCallback(this.m_nZoomValue, 1);
}
return false;
}; };
this.zoom_FitToPage = function() this.zoom_FitToPage_value = function(_canvas_height)
{ {
if (null == this.m_oLogicDocument) var _value = 100;
{ if (!this.m_oLogicDocument)
this.m_nZoomType = 2; return _value;
return;
}
var w = this.m_oEditor.HtmlElement.width; var w = this.m_oEditor.HtmlElement.width;
var h = (undefined == _canvas_height) ? this.m_oEditor.HtmlElement.height : _canvas_height;
if (this.bIsRetinaSupport) if (this.bIsRetinaSupport)
{
w /= AscCommon.AscBrowser.retinaPixelRatio; w /= AscCommon.AscBrowser.retinaPixelRatio;
h /= AscCommon.AscBrowser.retinaPixelRatio;
var h = ((this.m_oMainView.AbsolutePosition.B - this.m_oMainView.AbsolutePosition.T) * g_dKoef_mm_to_pix) >> 0; }
var _pageWidth = this.m_oLogicDocument.Width * g_dKoef_mm_to_pix; var _pageWidth = this.m_oLogicDocument.Width * g_dKoef_mm_to_pix;
var _pageHeight = this.m_oLogicDocument.Height * g_dKoef_mm_to_pix; var _pageHeight = this.m_oLogicDocument.Height * g_dKoef_mm_to_pix;
...@@ -906,12 +892,42 @@ function CEditorPage(api) ...@@ -906,12 +892,42 @@ function CEditorPage(api)
if (0 != _pageHeight) if (0 != _pageHeight)
_ver_Zoom = (100 * (h - 2 * this.SlideDrawer.CONST_BORDER)) / _pageHeight; _ver_Zoom = (100 * (h - 2 * this.SlideDrawer.CONST_BORDER)) / _pageHeight;
var _new_value = (Math.min(_hor_Zoom, _ver_Zoom) - 0.5) >> 0; _value = (Math.min(_hor_Zoom, _ver_Zoom) - 0.5) >> 0;
if (_new_value < 5) if (_value < 5)
_new_value = 5; _value = 5;
return _value;
};
this.zoom_FitToWidth = function()
{
this.m_nZoomType = 1;
if (!this.m_oLogicDocument)
return;
var _new_value = this.zoom_FitToWidth_value();
if (_new_value != this.m_nZoomValue)
{
this.m_nZoomValue = _new_value;
this.zoom_Fire(1);
return true;
}
else
{
this.m_oApi.sync_zoomChangeCallback(this.m_nZoomValue, 1);
}
return false;
};
this.zoom_FitToPage = function()
{
this.m_nZoomType = 2; this.m_nZoomType = 2;
if (!this.m_oLogicDocument)
return;
var _new_value = this.zoom_FitToPage_value();
if (_new_value != this.m_nZoomValue) if (_new_value != this.m_nZoomValue)
{ {
this.m_nZoomValue = _new_value; this.m_nZoomValue = _new_value;
...@@ -2483,13 +2499,10 @@ function CEditorPage(api) ...@@ -2483,13 +2499,10 @@ function CEditorPage(api)
this.DemonstrationManager.Resize(); this.DemonstrationManager.Resize();
this.m_bIsCheckHeedHorScrollRepeat++;
if (this.checkNeedHorScroll()) if (this.checkNeedHorScroll())
{ {
this.m_bIsCheckHeedHorScrollRepeat--;
return; return;
} }
this.m_bIsCheckHeedHorScrollRepeat--;
// теперь проверим необходимость перезуммирования // теперь проверим необходимость перезуммирования
if (1 == this.m_nZoomType && 0 != this.m_dDocumentPageWidth && 0 != this.m_dDocumentPageHeight) if (1 == this.m_nZoomType && 0 != this.m_dDocumentPageWidth && 0 != this.m_dDocumentPageHeight)
...@@ -2549,13 +2562,10 @@ function CEditorPage(api) ...@@ -2549,13 +2562,10 @@ function CEditorPage(api)
this.onButtonTabsDraw(); this.onButtonTabsDraw();
this.DemonstrationManager.Resize(); this.DemonstrationManager.Resize();
this.m_bIsCheckHeedHorScrollRepeat++;
if (this.checkNeedHorScroll()) if (this.checkNeedHorScroll())
{ {
this.m_bIsCheckHeedHorScrollRepeat--;
return; return;
} }
this.m_bIsCheckHeedHorScrollRepeat--;
// теперь проверим необходимость перезуммирования // теперь проверим необходимость перезуммирования
if (1 == this.m_nZoomType) if (1 == this.m_nZoomType)
...@@ -2618,20 +2628,46 @@ function CEditorPage(api) ...@@ -2618,20 +2628,46 @@ function CEditorPage(api)
this.m_oMainView.Bounds.T = 0; this.m_oMainView.Bounds.T = 0;
} }
}; };
this.checkNeedHorScroll = function()
this.checkNeedHorScrollValue = function(_width)
{ {
var w = this.m_oEditor.HtmlElement.width; var w = this.m_oEditor.HtmlElement.width;
if (this.bIsRetinaSupport) if (this.bIsRetinaSupport)
w /= AscCommon.AscBrowser.retinaPixelRatio; w /= AscCommon.AscBrowser.retinaPixelRatio;
return (_width <= w) ? false : true;
};
this.checkNeedHorScroll = function()
{
if (!this.m_oLogicDocument)
return false;
var oldVisible = this.m_bIsHorScrollVisible; var oldVisible = this.m_bIsHorScrollVisible;
if (this.m_dDocumentWidth <= w)
if (this.m_nZoomType == 0 || this.m_nZoomType == 1)
{ {
this.m_bIsHorScrollVisible = false; this.m_bIsHorScrollVisible = this.checkNeedHorScrollValue(this.m_dDocumentWidth);
} }
else else
{ {
this.m_bIsHorScrollVisible = true; var canvas_height1 = this.m_oEditor.HtmlElement.height;
var addition = AscCommon.AscBrowser.convertToRetinaValue(this.ScrollWidthPx, true);
var canvas_height2 = this.m_bIsHorScrollVisible ? (canvas_height1 + addition) : (canvas_height1 - addition);
var zoom1 = this.zoom_FitToPage_value(canvas_height1);
var zoom2 = this.zoom_FitToPage_value(canvas_height2);
var size1 = this.CalculateDocumentSizeInternal(canvas_height1, zoom1, true);
var size2 = this.CalculateDocumentSizeInternal(canvas_height2, zoom2, true);
var needScroll1 = this.checkNeedHorScrollValue(size1.m_dDocumentWidth);
var needScroll2 = this.checkNeedHorScrollValue(size2.m_dDocumentWidth);
if (needScroll1 == needScroll2)
this.m_bIsHorScrollVisible = needScroll1;
else
this.m_bIsHorScrollVisible = true;
} }
var hor_scroll = document.getElementById('panel_hor_scroll'); var hor_scroll = document.getElementById('panel_hor_scroll');
...@@ -2654,22 +2690,13 @@ function CEditorPage(api) ...@@ -2654,22 +2690,13 @@ function CEditorPage(api)
} }
else else
{ {
if ((this.m_bIsCheckHeedHorScrollRepeat > 0) && oldVisible == true) this.m_oPanelRight.Bounds.B = 0;
{ this.m_oMainView.Bounds.B = 0;
this.m_bIsHorScrollVisible = true; this.m_oScrollHor.HtmlElement.style.display = 'none';
this.m_dScrollX = 0;
}
else
{
this.m_oPanelRight.Bounds.B = 0;
this.m_oMainView.Bounds.B = 0;
this.m_oScrollHor.HtmlElement.style.display = 'none';
}
} }
if (this.m_bIsHorScrollVisible != oldVisible) if (this.m_bIsHorScrollVisible != oldVisible)
{ {
this.m_bIsCheckHeedHorScrollRepeat = true;
this.m_dScrollX = 0; this.m_dScrollX = 0;
this.OnResize(true); this.OnResize(true);
return true; return true;
...@@ -2942,26 +2969,34 @@ function CEditorPage(api) ...@@ -2942,26 +2969,34 @@ function CEditorPage(api)
this.m_oDrawingDocument.ClearCachePages(); this.m_oDrawingDocument.ClearCachePages();
}; };
this.CalculateDocumentSize = function(bIsAttack) this.CalculateDocumentSizeInternal = function(_canvas_height, _zoom_value, _check_bounds2)
{ {
if (false === oThis.m_oApi.bInit_word_control) var size = {
{ m_dDocumentWidth : 0,
oThis.UpdateScrolls(); m_dDocumentHeight : 0,
return; m_dDocumentPageWidth : 0,
} m_dDocumentPageHeight : 0,
SlideScrollMIN : 0,
this.m_dDocumentWidth = 0; SlideScrollMAX : 0
this.m_dDocumentHeight = 0; };
this.m_dDocumentPageWidth = 0;
this.m_dDocumentPageHeight = 0;
var dKoef = (this.m_nZoomValue * g_dKoef_mm_to_pix / 100); var _zoom = (undefined == _zoom_value) ? this.m_nZoomValue : _zoom_value;
var dKoef = (_zoom * g_dKoef_mm_to_pix / 100);
this.SlideBoundsOnCalculateSize.fromBounds(this.SlideDrawer.BoundsChecker.Bounds);
var _bounds_slide = this.SlideBoundsOnCalculateSize; var _bounds_slide = this.SlideBoundsOnCalculateSize;
if (undefined == _check_bounds2)
{
this.SlideBoundsOnCalculateSize.fromBounds(this.SlideDrawer.BoundsChecker.Bounds);
}
else
{
_bounds_slide = new AscFormat.CBoundsController();
this.SlideDrawer.CheckSlideSize(_zoom, this.m_oDrawingDocument.SlideCurrent);
_bounds_slide.fromBounds(this.SlideDrawer.BoundsChecker2.Bounds);
}
var _srcW = this.m_oEditor.HtmlElement.width; var _srcW = this.m_oEditor.HtmlElement.width;
var _srcH = this.m_oEditor.HtmlElement.height; var _srcH = (undefined !== _canvas_height) ? _canvas_height : this.m_oEditor.HtmlElement.height;
if (this.bIsRetinaSupport) if (this.bIsRetinaSupport)
{ {
_srcW = (_srcW / AscCommon.AscBrowser.retinaPixelRatio) >> 0; _srcW = (_srcW / AscCommon.AscBrowser.retinaPixelRatio) >> 0;
...@@ -2991,38 +3026,48 @@ function CEditorPage(api) ...@@ -2991,38 +3026,48 @@ function CEditorPage(api)
var one_slide_width = lWSlide; var one_slide_width = lWSlide;
var one_slide_height = Math.max(lHSlide, _srcH); var one_slide_height = Math.max(lHSlide, _srcH);
this.m_dDocumentPageWidth = one_slide_width; size.m_dDocumentPageWidth = one_slide_width;
this.m_dDocumentPageHeight = one_slide_height; size.m_dDocumentPageHeight = one_slide_height;
this.m_dDocumentWidth = one_slide_width; size.m_dDocumentWidth = one_slide_width;
this.m_dDocumentHeight = (one_slide_height * this.m_oDrawingDocument.SlidesCount) >> 0; size.m_dDocumentHeight = (one_slide_height * this.m_oDrawingDocument.SlidesCount) >> 0;
if (0 == this.m_oDrawingDocument.SlidesCount) if (0 == this.m_oDrawingDocument.SlidesCount)
this.m_dDocumentHeight = one_slide_height >> 0; size.m_dDocumentHeight = one_slide_height >> 0;
size.SlideScrollMIN = this.m_oDrawingDocument.SlideCurrent * one_slide_height;
size.SlideScrollMAX = size.SlideScrollMIN + one_slide_height - _srcH;
if (!bIsAttack && this.OldDocumentWidth == this.m_dDocumentWidth && this.OldDocumentHeight == this.m_dDocumentHeight) if (0 == this.m_oDrawingDocument.SlidesCount)
{ {
/* size.SlideScrollMIN = 0;
this.Thumbnails.SlideWidth = this.m_oLogicDocument.Width; size.SlideScrollMAX = size.SlideScrollMIN + one_slide_height - _srcH;
this.Thumbnails.SlideHeight = this.m_oLogicDocument.Height;
this.Thumbnails.SlidesCount = this.m_oDrawingDocument.SlidesCount;
this.Thumbnails.CheckSizes();
return;
*/
} }
this.OldDocumentWidth = this.m_dDocumentWidth; return size;
this.OldDocumentHeight = this.m_dDocumentHeight; };
this.SlideScrollMIN = this.m_oDrawingDocument.SlideCurrent * one_slide_height;
this.SlideScrollMAX = this.SlideScrollMIN + one_slide_height - _srcH;
if (0 == this.m_oDrawingDocument.SlidesCount) this.CalculateDocumentSize = function(bIsAttack)
{
if (false === oThis.m_oApi.bInit_word_control)
{ {
this.SlideScrollMIN = 0; oThis.UpdateScrolls();
this.SlideScrollMAX = this.SlideScrollMIN + one_slide_height - _srcH; return;
} }
var size = this.CalculateDocumentSizeInternal();
this.m_dDocumentWidth = size.m_dDocumentWidth;
this.m_dDocumentHeight = size.m_dDocumentHeight;
this.m_dDocumentPageWidth = size.m_dDocumentPageWidth;
this.m_dDocumentPageHeight = size.m_dDocumentPageHeight;
this.OldDocumentWidth = this.m_dDocumentWidth;
this.OldDocumentHeight = this.m_dDocumentHeight;
this.SlideScrollMIN = size.SlideScrollMIN;
this.SlideScrollMAX = size.SlideScrollMAX;
// теперь проверим необходимость перезуммирования // теперь проверим необходимость перезуммирования
if (1 == this.m_nZoomType) if (1 == this.m_nZoomType)
{ {
...@@ -3037,9 +3082,7 @@ function CEditorPage(api) ...@@ -3037,9 +3082,7 @@ function CEditorPage(api)
this.MainScrollLock(); this.MainScrollLock();
this.m_bIsCheckHeedHorScrollRepeat++;
this.checkNeedHorScroll(); this.checkNeedHorScroll();
this.m_bIsCheckHeedHorScrollRepeat--;
document.getElementById('panel_right_scroll').style.height = this.m_dDocumentHeight + "px"; document.getElementById('panel_right_scroll').style.height = this.m_dDocumentHeight + "px";
...@@ -3064,81 +3107,22 @@ function CEditorPage(api) ...@@ -3064,81 +3107,22 @@ function CEditorPage(api)
return; return;
} }
if ((Math.abs(_bounds.min_x - this.SlideBoundsOnCalculateSize.min_x) < 0.1) && var size = this.CalculateDocumentSizeInternal();
(Math.abs(_bounds.min_y - this.SlideBoundsOnCalculateSize.min_y) < 0.1) &&
(Math.abs(_bounds.max_x - this.SlideBoundsOnCalculateSize.max_x) < 0.1) &&
(Math.abs(_bounds.max_y - this.SlideBoundsOnCalculateSize.max_y) < 0.1))
{
return;
}
this.m_dDocumentWidth = 0;
this.m_dDocumentHeight = 0;
this.m_dDocumentPageWidth = 0;
this.m_dDocumentPageHeight = 0;
var dKoef = (this.m_nZoomValue * g_dKoef_mm_to_pix / 100);
this.SlideBoundsOnCalculateSize.fromBounds(_bounds);
var _bounds_slide = this.SlideBoundsOnCalculateSize;
var _srcW = this.m_oEditor.HtmlElement.width;
var _srcH = this.m_oEditor.HtmlElement.height;
if (this.bIsRetinaSupport)
{
_srcW = (_srcW / AscCommon.AscBrowser.retinaPixelRatio) >> 0;
_srcH = (_srcH / AscCommon.AscBrowser.retinaPixelRatio) >> 0;
_bounds_slide = {
min_x : (_bounds_slide.min_x / AscCommon.AscBrowser.retinaPixelRatio) >> 0,
min_y : (_bounds_slide.min_y / AscCommon.AscBrowser.retinaPixelRatio) >> 0,
max_x : (_bounds_slide.max_x / AscCommon.AscBrowser.retinaPixelRatio) >> 0,
max_y : (_bounds_slide.max_y / AscCommon.AscBrowser.retinaPixelRatio) >> 0
};
}
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(_srcW - 1, _centerX + (_bounds_slide.max_x - _centerSlideX) + this.SlideDrawer.CONST_BORDER);
var _centerY = (_srcH / 2) >> 0; this.m_dDocumentWidth = size.m_dDocumentWidth;
var _centerSlideY = (dKoef * this.m_oLogicDocument.Height / 2) >> 0; this.m_dDocumentHeight = size.m_dDocumentHeight;
var _ver_height_top = Math.min(0, _centerY - (_centerSlideY - _bounds_slide.min_y) - this.SlideDrawer.CONST_BORDER); this.m_dDocumentPageWidth = size.m_dDocumentPageWidth;
var _ver_height_bottom = Math.max(_srcH - 1, _centerY + (_bounds_slide.max_y - _centerSlideY) + this.SlideDrawer.CONST_BORDER); this.m_dDocumentPageHeight = size.m_dDocumentPageHeight;
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, _srcH);
this.m_dDocumentPageWidth = one_slide_width;
this.m_dDocumentPageHeight = one_slide_height;
this.m_dDocumentWidth = one_slide_width;
this.m_dDocumentHeight = (one_slide_height * this.m_oDrawingDocument.SlidesCount) >> 0;
if (0 == this.m_oDrawingDocument.SlidesCount)
this.m_dDocumentHeight = one_slide_height >> 0;
this.OldDocumentWidth = this.m_dDocumentWidth; this.OldDocumentWidth = this.m_dDocumentWidth;
this.OldDocumentHeight = this.m_dDocumentHeight; this.OldDocumentHeight = this.m_dDocumentHeight;
this.SlideScrollMIN = this.m_oDrawingDocument.SlideCurrent * one_slide_height; this.SlideScrollMIN = size.SlideScrollMIN;
this.SlideScrollMAX = this.SlideScrollMIN + one_slide_height - _srcH; this.SlideScrollMAX = size.SlideScrollMAX;
if (0 == this.m_oDrawingDocument.SlidesCount)
{
this.SlideScrollMIN = 0;
this.SlideScrollMAX = this.SlideScrollMIN + one_slide_height - _srcH;
}
this.MainScrollLock(); this.MainScrollLock();
this.m_bIsCheckHeedHorScrollRepeat++;
var bIsResize = this.checkNeedHorScroll(); var bIsResize = this.checkNeedHorScroll();
this.m_bIsCheckHeedHorScrollRepeat--;
document.getElementById('panel_right_scroll').style.height = this.m_dDocumentHeight + "px"; document.getElementById('panel_right_scroll').style.height = this.m_dDocumentHeight + "px";
......
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