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 ) {
arrowSizeW: 13,
arrowSizeH: 13,
cornerRadius: 0,
slimScroll: false
slimScroll: false,
alwaysVisible: false
};
this.settings = extendSettings( settings, scrollSettings );
......@@ -1899,7 +1900,7 @@ ScrollObject.prototype = {
this.paneHeight = this.canvasH - this.arrowPosition * 2;
this.paneWidth = this.canvasW - this.arrowPosition * 2;
this.RecalcScroller();
if ( this.isVerticalScroll ) {
if ( this.isVerticalScroll && !this.settings.alwaysVisible) {
if (this.scrollVCurrentY > this.maxScrollY)
this.scrollVCurrentY = this.maxScrollY;
......@@ -1918,7 +1919,7 @@ ScrollObject.prototype = {
this.scrollHCurrentX = this.maxScrollX;
this.scrollToX( this.scrollHCurrentX );
if(this.maxScrollX == 0){
if(this.maxScrollX == 0 && !this.settings.alwaysVisible){
this.canvas.style.display = "none";
}
else{
......
......@@ -3176,6 +3176,28 @@ function CDrawingDocument()
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()
......@@ -5149,6 +5171,7 @@ function CSlideDrawer()
this.CachedCanvasCtx = null;
this.BoundsChecker = new AscFormat.CSlideBoundsChecker();
this.BoundsChecker2 = new AscFormat.CSlideBoundsChecker();
this.CacheSlidePixW = 1;
this.CacheSlidePixH = 1;
......@@ -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)
{
if (this.m_oWordControl.m_oApi.isSaveFonts_Images)
......@@ -5383,7 +5438,7 @@ function CSlideDrawer()
function CNotesDrawer(page)
{
this.Width = 0;
this.Width = 0;
this.Height = 0;
this.HtmlPage = page;
......@@ -5393,33 +5448,37 @@ function CNotesDrawer(page)
this.Slide = -1;
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.Clear();
this.OffsetX = 10;
this.OffsetY = 10;
this.Scroll = 0;
this.ScrollMax = 0;
this.fontManager = new AscFonts.CFontManager();
this.fontManager.Initialize(true);
this.fontManager.SetHintsProps(true, true);
var oThis = this;
this.Init = function()
this.Init = function ()
{
var _elem = this.HtmlPage.m_oNotes;
var _elemOverlay = this.HtmlPage.m_oNotesOverlay;
_elem.HtmlElement.onmousedown = this.onMouseDown;
_elem.HtmlElement.onmousemove = this.onMouseMove;
_elem.HtmlElement.onmouseup = this.onMouseUp;
_elem.HtmlElement.onmouseup = this.onMouseUp;
_elemOverlay.HtmlElement.onmousedown = this.onMouseDown;
_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;
......@@ -5434,7 +5493,7 @@ function CNotesDrawer(page)
var ctx = overlay.m_oContext;
if (drDoc.m_bIsSelection)
{
ctx.fillStyle = "rgba(51,102,204,255)";
ctx.fillStyle = "rgba(51,102,204,255)";
ctx.strokeStyle = "#9ADBFE";
ctx.beginPath();
......@@ -5449,7 +5508,7 @@ function CNotesDrawer(page)
ctx = null;
};
this.OnPaint = function()
this.OnPaint = function ()
{
var element = this.HtmlPage.m_oNotes.HtmlElement;
var ctx = element.getContext('2d');
......@@ -5458,7 +5517,7 @@ function CNotesDrawer(page)
if (-1 == this.Slide)
return;
var dKoef = g_dKoef_mm_to_pix / 100;
var dKoef = g_dKoef_mm_to_pix;
if (this.HtmlPage.bIsRetinaSupport)
dKoef *= AscCommon.AscBrowser.retinaPixelRatio;
......@@ -5475,16 +5534,17 @@ function CNotesDrawer(page)
g.IsRetina = true;
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.IsNoDrawingEmptyPlaceholder = 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.OnRecalculateNote = function(slideNum, width, height)
this.OnRecalculateNote = function (slideNum, width, height)
{
this.Slide = slideNum;
this.Width = width;
......@@ -5496,17 +5556,17 @@ function CNotesDrawer(page)
var element = this.HtmlPage.m_oNotes.HtmlElement;
var settings = {
showArrows : true,
animateScroll : false,
screenW : element.width,
screenH : element.height,
screenAddW : 0,
screenAddH : 0,
vsscrollStep : 45,
hsscrollStep : 45,
contentW : 2 * this.OffsetX + ((width * g_dKoef_mm_to_pix) >> 0),
contentH : 2 * this.OffsetY + ((height * g_dKoef_mm_to_pix) >> 0),
scrollerMinHeight : 5
showArrows: true,
animateScroll: false,
screenW: element.width,
screenH: element.height,
screenAddW: 0,
screenAddH: 0,
vsscrollStep: 45,
hsscrollStep: 45,
contentW: 1,
contentH: 2 * this.OffsetY + ((height * g_dKoef_mm_to_pix) >> 0),
scrollerMinHeight: 5
};
if (this.bIsRetinaSupport)
......@@ -5517,6 +5577,9 @@ function CNotesDrawer(page)
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";
if (this.HtmlPage.m_oScrollNotes_)
......@@ -5527,30 +5590,31 @@ function CNotesDrawer(page)
{
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);
global_mouseEvent.LockMouse();
};
this.HtmlPage.m_oScrollNotes_.offLockMouse = function(evt)
this.HtmlPage.m_oScrollNotes_.offLockMouse = function (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)
this.OnPaint();
};
this.onMouseDown = function(e)
this.onMouseDown = function (e)
{
AscCommon.check_MouseDownEvent(e, true);
global_mouseEvent.LockMouse();
......@@ -5562,11 +5626,11 @@ function CNotesDrawer(page)
console.log(_x + ", " + _y);
};
this.onMouseMove = function(e)
this.onMouseMove = function (e)
{
AscCommon.check_MouseMoveEvent(e);
};
this.onMouseUp = function(e)
this.onMouseUp = function (e)
{
AscCommon.check_MouseUpEvent(e);
......@@ -5576,14 +5640,28 @@ function CNotesDrawer(page)
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;
};
}
......
This diff is collapsed.
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