Commit 978f618a authored by Oleg Korshul's avatar Oleg Korshul

resize & hor scroll recursion bug

parent d2c9e39c
...@@ -1554,7 +1554,8 @@ function ScrollObject( elemID, settings, dbg ) { ...@@ -1554,7 +1554,8 @@ function ScrollObject( elemID, settings, dbg ) {
arrowSizeW: 13, arrowSizeW: 13,
arrowSizeH: 13, arrowSizeH: 13,
cornerRadius: 0, cornerRadius: 0,
slimScroll: false slimScroll: false,
alwaysVisible: false
}; };
this.settings = extendSettings( settings, scrollSettings ); this.settings = extendSettings( settings, scrollSettings );
...@@ -1899,7 +1900,7 @@ ScrollObject.prototype = { ...@@ -1899,7 +1900,7 @@ ScrollObject.prototype = {
this.paneHeight = this.canvasH - this.arrowPosition * 2; this.paneHeight = this.canvasH - this.arrowPosition * 2;
this.paneWidth = this.canvasW - this.arrowPosition * 2; this.paneWidth = this.canvasW - this.arrowPosition * 2;
this.RecalcScroller(); this.RecalcScroller();
if ( this.isVerticalScroll ) { if ( this.isVerticalScroll && !this.settings.alwaysVisible) {
if (this.scrollVCurrentY > this.maxScrollY) if (this.scrollVCurrentY > this.maxScrollY)
this.scrollVCurrentY = this.maxScrollY; this.scrollVCurrentY = this.maxScrollY;
...@@ -1918,7 +1919,7 @@ ScrollObject.prototype = { ...@@ -1918,7 +1919,7 @@ ScrollObject.prototype = {
this.scrollHCurrentX = this.maxScrollX; this.scrollHCurrentX = this.maxScrollX;
this.scrollToX( this.scrollHCurrentX ); this.scrollToX( this.scrollHCurrentX );
if(this.maxScrollX == 0){ if(this.maxScrollX == 0 && !this.settings.alwaysVisible){
this.canvas.style.display = "none"; this.canvas.style.display = "none";
} }
else{ else{
......
...@@ -3176,6 +3176,28 @@ function CDrawingDocument() ...@@ -3176,6 +3176,28 @@ function CDrawingDocument()
return null; return null;
}; };
this.Notes_GetWidth = function()
{
if (!this.m_oWordControl.IsSupportNotes)
return 0;
if (!this.m_oWordControl.m_oNotesApi)
return 0;
return this.m_oWordControl.m_oNotesApi.GetNotesWidth();
};
this.Notes_OnRecalculate = function(slideNum, width, height)
{
if (!this.m_oWordControl.IsSupportNotes)
return;
if (!this.m_oWordControl.m_oNotesApi)
return;
this.m_oWordControl.m_oNotesApi.OnRecalculateNote(slideNum, width, height);
};
} }
function CThPage() function CThPage()
...@@ -5149,6 +5171,7 @@ function CSlideDrawer() ...@@ -5149,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;
...@@ -5168,6 +5191,38 @@ function CSlideDrawer() ...@@ -5168,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)
...@@ -5383,7 +5438,7 @@ function CSlideDrawer() ...@@ -5383,7 +5438,7 @@ function CSlideDrawer()
function CNotesDrawer(page) function CNotesDrawer(page)
{ {
this.Width = 0; this.Width = 0;
this.Height = 0; this.Height = 0;
this.HtmlPage = page; this.HtmlPage = page;
...@@ -5393,33 +5448,37 @@ function CNotesDrawer(page) ...@@ -5393,33 +5448,37 @@ function CNotesDrawer(page)
this.Slide = -1; this.Slide = -1;
this.m_oOverlayApi = new AscCommon.COverlay(); this.m_oOverlayApi = new AscCommon.COverlay();
this.m_oOverlayApi.m_oControl = this.HtmlPage.m_oNotesOverlay; this.m_oOverlayApi.m_oControl = this.HtmlPage.m_oNotesOverlay;
this.m_oOverlayApi.m_oHtmlPage = this.HtmlPage; this.m_oOverlayApi.m_oHtmlPage = this.HtmlPage;
this.m_oOverlayApi.Clear(); this.m_oOverlayApi.Clear();
this.OffsetX = 10; this.OffsetX = 10;
this.OffsetY = 10; this.OffsetY = 10;
this.Scroll = 0;
this.ScrollMax = 0;
this.fontManager = new AscFonts.CFontManager(); this.fontManager = new AscFonts.CFontManager();
this.fontManager.Initialize(true); this.fontManager.Initialize(true);
this.fontManager.SetHintsProps(true, true);
var oThis = this; var oThis = this;
this.Init = function() this.Init = function ()
{ {
var _elem = this.HtmlPage.m_oNotes; var _elem = this.HtmlPage.m_oNotes;
var _elemOverlay = this.HtmlPage.m_oNotesOverlay; var _elemOverlay = this.HtmlPage.m_oNotesOverlay;
_elem.HtmlElement.onmousedown = this.onMouseDown; _elem.HtmlElement.onmousedown = this.onMouseDown;
_elem.HtmlElement.onmousemove = this.onMouseMove; _elem.HtmlElement.onmousemove = this.onMouseMove;
_elem.HtmlElement.onmouseup = this.onMouseUp; _elem.HtmlElement.onmouseup = this.onMouseUp;
_elemOverlay.HtmlElement.onmousedown = this.onMouseDown; _elemOverlay.HtmlElement.onmousedown = this.onMouseDown;
_elemOverlay.HtmlElement.onmousemove = this.onMouseMove; _elemOverlay.HtmlElement.onmousemove = this.onMouseMove;
_elemOverlay.HtmlElement.onmouseup = this.onMouseUp; _elemOverlay.HtmlElement.onmouseup = this.onMouseUp;
}; };
this.OnUpdateOverlay = function() this.OnUpdateOverlay = function ()
{ {
var overlay = this.m_oOverlayApi; var overlay = this.m_oOverlayApi;
...@@ -5434,7 +5493,7 @@ function CNotesDrawer(page) ...@@ -5434,7 +5493,7 @@ function CNotesDrawer(page)
var ctx = overlay.m_oContext; var ctx = overlay.m_oContext;
if (drDoc.m_bIsSelection) if (drDoc.m_bIsSelection)
{ {
ctx.fillStyle = "rgba(51,102,204,255)"; ctx.fillStyle = "rgba(51,102,204,255)";
ctx.strokeStyle = "#9ADBFE"; ctx.strokeStyle = "#9ADBFE";
ctx.beginPath(); ctx.beginPath();
...@@ -5449,7 +5508,7 @@ function CNotesDrawer(page) ...@@ -5449,7 +5508,7 @@ function CNotesDrawer(page)
ctx = null; ctx = null;
}; };
this.OnPaint = function() this.OnPaint = function ()
{ {
var element = this.HtmlPage.m_oNotes.HtmlElement; var element = this.HtmlPage.m_oNotes.HtmlElement;
var ctx = element.getContext('2d'); var ctx = element.getContext('2d');
...@@ -5458,7 +5517,7 @@ function CNotesDrawer(page) ...@@ -5458,7 +5517,7 @@ function CNotesDrawer(page)
if (-1 == this.Slide) if (-1 == this.Slide)
return; return;
var dKoef = g_dKoef_mm_to_pix / 100; var dKoef = g_dKoef_mm_to_pix;
if (this.HtmlPage.bIsRetinaSupport) if (this.HtmlPage.bIsRetinaSupport)
dKoef *= AscCommon.AscBrowser.retinaPixelRatio; dKoef *= AscCommon.AscBrowser.retinaPixelRatio;
...@@ -5475,16 +5534,17 @@ function CNotesDrawer(page) ...@@ -5475,16 +5534,17 @@ function CNotesDrawer(page)
g.IsRetina = true; g.IsRetina = true;
g.m_oCoordTransform.tx = this.OffsetX; g.m_oCoordTransform.tx = this.OffsetX;
g.m_oCoordTransform.ty = this.OffsetY; 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.DrawNote(this.Slide, g); this.HtmlPage.m_oLogicDocument.Notes_Draw(this.Slide, g);
this.IsRepaint = false; this.IsRepaint = false;
}; };
this.OnRecalculateNote = function(slideNum, width, height) this.OnRecalculateNote = function (slideNum, width, height)
{ {
this.Slide = slideNum; this.Slide = slideNum;
this.Width = width; this.Width = width;
...@@ -5496,17 +5556,17 @@ function CNotesDrawer(page) ...@@ -5496,17 +5556,17 @@ function CNotesDrawer(page)
var element = this.HtmlPage.m_oNotes.HtmlElement; var element = this.HtmlPage.m_oNotes.HtmlElement;
var settings = { var settings = {
showArrows : true, showArrows: true,
animateScroll : false, animateScroll: false,
screenW : element.width, screenW: element.width,
screenH : element.height, screenH: element.height,
screenAddW : 0, screenAddW: 0,
screenAddH : 0, screenAddH: 0,
vsscrollStep : 45, vsscrollStep: 45,
hsscrollStep : 45, hsscrollStep: 45,
contentW : 2 * this.OffsetX + ((width * g_dKoef_mm_to_pix) >> 0), contentW: 1,
contentH : 2 * this.OffsetY + ((height * g_dKoef_mm_to_pix) >> 0), contentH: 2 * this.OffsetY + ((height * g_dKoef_mm_to_pix) >> 0),
scrollerMinHeight : 5 scrollerMinHeight: 5
}; };
if (this.bIsRetinaSupport) if (this.bIsRetinaSupport)
...@@ -5517,6 +5577,9 @@ function CNotesDrawer(page) ...@@ -5517,6 +5577,9 @@ function CNotesDrawer(page)
settings.screenAddH = AscCommon.AscBrowser.convertToRetinaValue(settings.screenAddH); settings.screenAddH = AscCommon.AscBrowser.convertToRetinaValue(settings.screenAddH);
} }
this.Scroll = 0;
this.ScrollMax = Math.max(0, settings.contentH - settings.screenH);
document.getElementById('panel_right_scroll_notes').style.height = settings.contentH + "px"; document.getElementById('panel_right_scroll_notes').style.height = settings.contentH + "px";
if (this.HtmlPage.m_oScrollNotes_) if (this.HtmlPage.m_oScrollNotes_)
...@@ -5527,30 +5590,31 @@ function CNotesDrawer(page) ...@@ -5527,30 +5590,31 @@ function CNotesDrawer(page)
{ {
this.HtmlPage.m_oScrollNotes_ = new AscCommon.ScrollObject("id_vertical_scroll_notes", settings); this.HtmlPage.m_oScrollNotes_ = new AscCommon.ScrollObject("id_vertical_scroll_notes", settings);
this.HtmlPage.m_oScrollNotes_.onLockMouse = function(evt) this.HtmlPage.m_oScrollNotes_.onLockMouse = function (evt)
{ {
AscCommon.check_MouseDownEvent(evt, true); AscCommon.check_MouseDownEvent(evt, true);
global_mouseEvent.LockMouse(); global_mouseEvent.LockMouse();
}; };
this.HtmlPage.m_oScrollNotes_.offLockMouse = function(evt) this.HtmlPage.m_oScrollNotes_.offLockMouse = function (evt)
{ {
AscCommon.check_MouseUpEvent(evt); AscCommon.check_MouseUpEvent(evt);
}; };
this.HtmlPage.m_oScrollNotes_.bind("scrollvertical", function(evt) this.HtmlPage.m_oScrollNotes_.bind("scrollvertical", function (evt)
{ {
// TODO: oThis.Scroll = (oThis.ScrollMax * evt.scrollD / Math.max(evt.maxScrollY, 1)) >> 0;
oThis.IsRepaint = true;
}); });
} }
}; };
this.CheckPaint = function() this.CheckPaint = function ()
{ {
if (this.IsRepaint) if (this.IsRepaint)
this.OnPaint(); this.OnPaint();
}; };
this.onMouseDown = function(e) this.onMouseDown = function (e)
{ {
AscCommon.check_MouseDownEvent(e, true); AscCommon.check_MouseDownEvent(e, true);
global_mouseEvent.LockMouse(); global_mouseEvent.LockMouse();
...@@ -5562,11 +5626,11 @@ function CNotesDrawer(page) ...@@ -5562,11 +5626,11 @@ function CNotesDrawer(page)
console.log(_x + ", " + _y); console.log(_x + ", " + _y);
}; };
this.onMouseMove = function(e) this.onMouseMove = function (e)
{ {
AscCommon.check_MouseMoveEvent(e); AscCommon.check_MouseMoveEvent(e);
}; };
this.onMouseUp = function(e) this.onMouseUp = function (e)
{ {
AscCommon.check_MouseUpEvent(e); AscCommon.check_MouseUpEvent(e);
...@@ -5576,14 +5640,28 @@ function CNotesDrawer(page) ...@@ -5576,14 +5640,28 @@ function CNotesDrawer(page)
console.log(_x + ", " + _y); console.log(_x + ", " + _y);
}; };
this.onUpdateTarget = function() this.onUpdateTarget = function ()
{ {
}; };
this.OnResize = function() this.OnResize = function ()
{
if (this.HtmlPage.m_oLogicDocument)
{
if (!this.HtmlPage.m_oLogicDocument.Notes_OnResize())
{
this.OnRecalculateNote(this.Slide, this.Width, this.Height);
}
}
};
this.GetNotesWidth = function()
{ {
this.OnRecalculateNote(this.Slide, this.Width, this.Height); var _pix_width = this.HtmlPage.m_oNotes.HtmlElement.width - 20;
if (_pix_width < 10)
_pix_width = 10;
return _pix_width / g_dKoef_mm_to_pix;
}; };
} }
......
...@@ -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;
...@@ -847,13 +846,11 @@ function CEditorPage(api) ...@@ -847,13 +846,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)
...@@ -868,34 +865,23 @@ function CEditorPage(api) ...@@ -868,34 +865,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;
...@@ -907,12 +893,42 @@ function CEditorPage(api) ...@@ -907,12 +893,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 (_value < 5)
_value = 5;
if (_new_value < 5) return _value;
_new_value = 5; };
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;
...@@ -2370,6 +2386,7 @@ function CEditorPage(api) ...@@ -2370,6 +2386,7 @@ function CEditorPage(api)
if (this.m_bIsHorScrollVisible) if (this.m_bIsHorScrollVisible)
{ {
settings.alwaysVisible = true;
if (this.m_oScrollHor_) if (this.m_oScrollHor_)
this.m_oScrollHor_.Repos(settings, true, undefined);//unbind("scrollhorizontal") this.m_oScrollHor_.Repos(settings, true, undefined);//unbind("scrollhorizontal")
else else
...@@ -2392,6 +2409,7 @@ function CEditorPage(api) ...@@ -2392,6 +2409,7 @@ function CEditorPage(api)
this.m_oScrollHorApi = this.m_oScrollHor_; this.m_oScrollHorApi = this.m_oScrollHor_;
} }
settings.alwaysVisible = undefined;
} }
if (this.m_oScrollVer_) if (this.m_oScrollVer_)
...@@ -2483,7 +2501,9 @@ function CEditorPage(api) ...@@ -2483,7 +2501,9 @@ function CEditorPage(api)
this.DemonstrationManager.Resize(); this.DemonstrationManager.Resize();
if (this.checkNeedHorScroll()) if (this.checkNeedHorScroll())
{
return; return;
}
// теперь проверим необходимость перезуммирования // теперь проверим необходимость перезуммирования
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)
...@@ -2544,7 +2564,9 @@ function CEditorPage(api) ...@@ -2544,7 +2564,9 @@ function CEditorPage(api)
this.DemonstrationManager.Resize(); this.DemonstrationManager.Resize();
if (this.checkNeedHorScroll()) if (this.checkNeedHorScroll())
{
return; return;
}
// теперь проверим необходимость перезуммирования // теперь проверим необходимость перезуммирования
if (1 == this.m_nZoomType) if (1 == this.m_nZoomType)
...@@ -2607,20 +2629,46 @@ function CEditorPage(api) ...@@ -2607,20 +2629,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');
...@@ -2643,27 +2691,17 @@ function CEditorPage(api) ...@@ -2643,27 +2691,17 @@ function CEditorPage(api)
} }
else else
{ {
if (this.m_bIsCheckHeedHorScrollRepeat && 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;
} }
this.m_bIsCheckHeedHorScrollRepeat = false;
return false; return false;
}; };
...@@ -2932,26 +2970,34 @@ function CEditorPage(api) ...@@ -2932,26 +2970,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;
...@@ -2981,38 +3027,48 @@ function CEditorPage(api) ...@@ -2981,38 +3027,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)
{ {
...@@ -3052,75 +3108,18 @@ function CEditorPage(api) ...@@ -3052,75 +3108,18 @@ 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_dDocumentWidth = size.m_dDocumentWidth;
this.m_dDocumentHeight = 0; this.m_dDocumentHeight = size.m_dDocumentHeight;
this.m_dDocumentPageWidth = 0; this.m_dDocumentPageWidth = size.m_dDocumentPageWidth;
this.m_dDocumentPageHeight = 0; this.m_dDocumentPageHeight = size.m_dDocumentPageHeight;
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;
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(_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, _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();
...@@ -3210,6 +3209,10 @@ function CEditorPage(api) ...@@ -3210,6 +3209,10 @@ function CEditorPage(api)
{ {
oWordControl.Thumbnails.onCheckUpdate(); oWordControl.Thumbnails.onCheckUpdate();
} }
if (oWordControl.IsSupportNotes && oWordControl.m_oNotesApi)
oWordControl.m_oNotesApi.CheckPaint();
if (null != oWordControl.m_oLogicDocument) if (null != oWordControl.m_oLogicDocument)
{ {
oWordControl.m_oDrawingDocument.UpdateTargetFromPaint = true; oWordControl.m_oDrawingDocument.UpdateTargetFromPaint = true;
......
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