diff --git a/common/apiBase.js b/common/apiBase.js index 4d4ba7fd29..564d2eeac4 100644 --- a/common/apiBase.js +++ b/common/apiBase.js @@ -3932,14 +3932,21 @@ ret.W = Math.max(document.documentElement.clientWidth, window.innerWidth || 0); ret.H = Math.max(document.documentElement.clientHeight, window.innerHeight || 0); + ret.editorX = 0; + ret.editorY = 0; + switch (this.editorId) { case c_oEditorId.Word: { - ret.X += this.WordControl.X; - ret.Y += this.WordControl.Y; - ret.X += (this.WordControl.m_oMainView.AbsolutePosition.L * AscCommon.g_dKoef_mm_to_pix); - ret.Y += (this.WordControl.m_oMainView.AbsolutePosition.T * AscCommon.g_dKoef_mm_to_pix); + ret.editorX += this.WordControl.X; + ret.editorX += (this.WordControl.m_oMainView.AbsolutePosition.L * AscCommon.g_dKoef_mm_to_pix); + ret.editorY += this.WordControl.Y; + ret.editorY += (this.WordControl.m_oMainView.AbsolutePosition.T * AscCommon.g_dKoef_mm_to_pix); + + ret.X += ret.editorX; + ret.Y += ret.editorY; + ret.X += (this.WordControl.m_oDrawingDocument.TargetHtmlElementLeft); ret.Y += (this.WordControl.m_oDrawingDocument.TargetHtmlElementTop); @@ -3951,20 +3958,23 @@ } case c_oEditorId.Presentation: { - ret.X += this.WordControl.X; - ret.Y += this.WordControl.Y; + ret.editorX += this.WordControl.X; + ret.editorX += (this.WordControl.m_oMainParent.AbsolutePosition.L * AscCommon.g_dKoef_mm_to_pix); - ret.X += (this.WordControl.m_oMainParent.AbsolutePosition.L * AscCommon.g_dKoef_mm_to_pix); + ret.X += ret.editorX; + ret.editorY += this.WordControl.Y; if (!this.WordControl.m_oLogicDocument.IsFocusOnNotes()) { - ret.Y += (this.WordControl.m_oMainView.AbsolutePosition.T * AscCommon.g_dKoef_mm_to_pix); + ret.editorY += (this.WordControl.m_oMainView.AbsolutePosition.T * AscCommon.g_dKoef_mm_to_pix); } else { - ret.Y += (this.WordControl.m_oNotesContainer.AbsolutePosition.T * AscCommon.g_dKoef_mm_to_pix); + ret.editorY += (this.WordControl.m_oNotesContainer.AbsolutePosition.T * AscCommon.g_dKoef_mm_to_pix); } + ret.Y += ret.editorY; + ret.X += (this.WordControl.m_oDrawingDocument.TargetHtmlElementLeft); ret.Y += (this.WordControl.m_oDrawingDocument.TargetHtmlElementTop); diff --git a/common/apiBase_plugins.js b/common/apiBase_plugins.js index 97d995743d..ad26bea4a2 100644 --- a/common/apiBase_plugins.js +++ b/common/apiBase_plugins.js @@ -2090,6 +2090,13 @@ h += (offsets.H - b); } + if (y > offsets.H) + y = offsets.H - h; + if (y < offsets.editorY) + y = offsets.editorY; + if (x < offsets.editorX) + x = offsets.editorX; + variation["size"] = [w, h]; variation["positionX"] = x; variation["positionY"] = y;