Commit 9c478ce3 authored by Oleg.Korshul's avatar Oleg.Korshul

calculatedocumentsize срабатывал только на следующем пересчете

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@52817 954022d7-b5bf-4e40-9824-e11837661b57
parent 2b5d24db
...@@ -4924,6 +4924,8 @@ function CSlideDrawer() ...@@ -4924,6 +4924,8 @@ function CSlideDrawer()
this.m_oWordControl.m_oLogicDocument.DrawPage(slideNum, this.BoundsChecker); this.m_oWordControl.m_oLogicDocument.DrawPage(slideNum, this.BoundsChecker);
this.m_oWordControl.CheckCalculateDocumentSize(this.BoundsChecker.Bounds);
// теперь смотрим, используем ли кэш для скролла // теперь смотрим, используем ли кэш для скролла
var _need_pix_width = this.BoundsChecker.Bounds.max_x - this.BoundsChecker.Bounds.min_x + 1; var _need_pix_width = this.BoundsChecker.Bounds.max_x - this.BoundsChecker.Bounds.min_x + 1;
var _need_pix_height = this.BoundsChecker.Bounds.max_y - this.BoundsChecker.Bounds.min_y + 1; var _need_pix_height = this.BoundsChecker.Bounds.max_y - this.BoundsChecker.Bounds.min_y + 1;
......
...@@ -172,6 +172,7 @@ function CEditorPage(api) ...@@ -172,6 +172,7 @@ function CEditorPage(api)
this.Thumbnails = new CThumbnailsManager(); this.Thumbnails = new CThumbnailsManager();
this.SlideDrawer = new CSlideDrawer(); this.SlideDrawer = new CSlideDrawer();
this.SlideBoundsOnCalculateSize = new CBoundsController();
this.MainScrollsEnabledFlag = 0; this.MainScrollsEnabledFlag = 0;
this.bIsUseKeyPress = true; this.bIsUseKeyPress = true;
...@@ -2498,7 +2499,8 @@ function CEditorPage(api) ...@@ -2498,7 +2499,8 @@ function CEditorPage(api)
var dKoef = (this.m_nZoomValue * g_dKoef_mm_to_pix / 100); var dKoef = (this.m_nZoomValue * g_dKoef_mm_to_pix / 100);
var _bounds_slide = this.SlideDrawer.BoundsChecker.Bounds; this.SlideBoundsOnCalculateSize.fromBounds(this.SlideDrawer.BoundsChecker.Bounds);
var _bounds_slide = this.SlideBoundsOnCalculateSize;
var _srcW = this.m_oEditor.HtmlElement.width; var _srcW = this.m_oEditor.HtmlElement.width;
var _srcH = this.m_oEditor.HtmlElement.height; var _srcH = this.m_oEditor.HtmlElement.height;
...@@ -2579,7 +2581,6 @@ function CEditorPage(api) ...@@ -2579,7 +2581,6 @@ function CEditorPage(api)
this.checkNeedHorScroll(); this.checkNeedHorScroll();
var ver_scroll = document.getElementById('id_vertical_scroll');
document.getElementById('panel_right_scroll').style.height = this.m_dDocumentHeight + "px"; document.getElementById('panel_right_scroll').style.height = this.m_dDocumentHeight + "px";
this.UpdateScrolls(); this.UpdateScrolls();
...@@ -2592,6 +2593,95 @@ function CEditorPage(api) ...@@ -2592,6 +2593,95 @@ function CEditorPage(api)
this.Thumbnails.CheckSizes(); this.Thumbnails.CheckSizes();
} }
this.CheckCalculateDocumentSize = function(_bounds)
{
if (false === oThis.m_oApi.bInit_word_control)
{
oThis.UpdateScrolls();
return;
}
if ((Math.abs(_bounds.min_x - this.SlideBoundsOnCalculateSize.min_x) < 0.1) &&
(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 >>= 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(_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.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.SlideScrollMIN = 0;
this.SlideScrollMAX = this.SlideScrollMIN + one_slide_height - _srcH;
}
this.MainScrollLock();
this.checkNeedHorScroll();
document.getElementById('panel_right_scroll').style.height = this.m_dDocumentHeight + "px";
this.UpdateScrolls();
this.MainScrollUnLock();
}
this.InitDocument = function(bIsEmpty) this.InitDocument = function(bIsEmpty)
{ {
this.m_oDrawingDocument.m_oWordControl = this; this.m_oDrawingDocument.m_oWordControl = this;
......
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