1
0
mirror of https://github.com/ONLYOFFICE/sdkjs.git synced 2025-04-18 14:24:11 +03:00

For bug 70443

This commit is contained in:
Oleg Korshul 2025-03-11 15:50:13 +03:00
parent 11bf2e5f0c
commit dd02b9a9fc
6 changed files with 124 additions and 41 deletions

View File

@ -223,6 +223,8 @@
this.skinObject = config['skin'];
this.isDarkMode = false;
this.isRtlInterface = config['isRtlInterface'] === true;
this.Shortcuts = new AscCommon.CShortcuts();
this.initDefaultShortcuts();

View File

@ -1219,6 +1219,10 @@ function CEditorPage(api)
{
return this.m_oMainParent.AbsolutePosition;
};
this.GetVertRulerLeft = function()
{
return 0;
};
// splitter
this.createSplitterElement = function()

View File

@ -566,6 +566,10 @@ function CEditorPage(api)
{
return this.m_oMainParent.AbsolutePosition;
};
this.GetVertRulerLeft = function()
{
return 0;
};
// splitter
this.createSplitterElement = function()

View File

@ -4189,6 +4189,29 @@ function CDrawingDocument()
return {X: _x, Y: _y, Error: false};
};
this.GetMainOffset = function(isUseRuler)
{
let result = {
x : 0,
y : 0
};
if (this.m_oWordControl.m_oApi.isMobileVersion)
return result;
if (this.m_oWordControl.m_oApi.isRtlInterface)
result.x += this.m_oWordControl.ScrollsWidthPx;
if (true === this.m_oWordControl.m_bIsRuler && isUseRuler !== false)
{
if (!this.m_oWordControl.m_oApi.isRtlInterface)
result.x += (5 * g_dKoef_mm_to_pix);
result.y += (7 * g_dKoef_mm_to_pix);
}
return result;
}
this.ConvertCoordsFromCursor2 = function (x, y, zoomVal, isRulers)
{
var _x = x;
@ -4203,11 +4226,9 @@ function CDrawingDocument()
var _xOffset = this.m_oWordControl.X;
var _yOffset = this.m_oWordControl.Y;
if (true === this.m_oWordControl.m_bIsRuler)
{
_xOffset += (5 * g_dKoef_mm_to_pix);
_yOffset += (7 * g_dKoef_mm_to_pix);
}
let offsets = this.GetMainOffset();
_xOffset += offsets.x;
_yOffset += offsets.y;
_x = x - _xOffset;
_y = y - _yOffset;
@ -4340,11 +4361,9 @@ function CDrawingDocument()
_x = this.m_oWordControl.X;
_y = this.m_oWordControl.Y;
if (this.m_oWordControl.m_bIsRuler)
{
_x += 5 * g_dKoef_mm_to_pix;
_y += 7 * g_dKoef_mm_to_pix;
}
let offsets = this.GetMainOffset();
_x += offsets.x;
_y += offsets.y;
}
return this.private_ConvertCoordsToCursor(x, y, pageIndex, true, _x + 0.5, _y + 0.5);
};
@ -4358,11 +4377,10 @@ function CDrawingDocument()
{
var _x = 0;
var _y = 0;
if (true == this.m_oWordControl.m_bIsRuler && (id_ruler_no_use !== false))
{
_x = 5 * g_dKoef_mm_to_pix;
_y = 7 * g_dKoef_mm_to_pix;
}
let offsets = this.GetMainOffset(id_ruler_no_use);
_x += offsets.x;
_y += offsets.y;
return this.private_ConvertCoordsToCursor(x, y, pageIndex, true, _x, _y, transform);
};

View File

@ -277,8 +277,16 @@ function CEditorPage(api)
// panel right --------------------------------------------------------------
this.m_oPanelRight = AscCommon.CreateControlContainer("id_panel_right");
this.m_oPanelRight.Bounds.SetParams(0, 0, 1000, 0, false, true, false, true, scrollWidthMm, -1);
this.m_oPanelRight.Anchor = (g_anchor_top | g_anchor_right | g_anchor_bottom);
if (!this.m_oApi.isRtlInterface)
{
this.m_oPanelRight.Bounds.SetParams(0, 0, 1000, 0, false, true, false, true, scrollWidthMm, -1);
this.m_oPanelRight.Anchor = (g_anchor_top | g_anchor_right | g_anchor_bottom);
}
else
{
this.m_oPanelRight.Bounds.SetParams(0, 0, 0, 0, false, true, false, true, scrollWidthMm, -1);
this.m_oPanelRight.Anchor = (g_anchor_top | g_anchor_left | g_anchor_bottom);
}
this.m_oBody.AddControl(this.m_oPanelRight);
if (this.m_oApi.isMobileVersion)
@ -328,18 +336,44 @@ function CEditorPage(api)
// main content -------------------------------------------------------------
this.m_oMainContent = AscCommon.CreateControlContainer("id_main");
if (!this.m_oApi.isMobileVersion)
this.m_oMainContent.Bounds.SetParams(0, 0, scrollWidthMm, 0, false, true, true, true, -1, -1);
{
if (!this.m_oApi.isRtlInterface)
this.m_oMainContent.Bounds.SetParams(0, 0, scrollWidthMm, 0, false, true, true, true, -1, -1);
else
this.m_oMainContent.Bounds.SetParams(scrollWidthMm, 0, 0, 0, true, true, true, true, -1, -1);
}
else
{
this.m_oMainContent.Bounds.SetParams(0, 0, 0, 0, false, true, true, true, -1, -1);
}
this.m_oMainContent.Anchor = (g_anchor_left | g_anchor_top | g_anchor_right | g_anchor_bottom);
this.m_oBody.AddControl(this.m_oMainContent);
// --- left ---
this.m_oLeftRuler = AscCommon.CreateControlContainer("id_panel_left");
this.m_oLeftRuler.Bounds.SetParams(0, 0, 1000, 1000, false, false, false, false, 5, -1);
this.m_oLeftRuler.Anchor = (g_anchor_left | g_anchor_top | g_anchor_bottom);
this.m_oMainContent.AddControl(this.m_oLeftRuler);
if (!this.m_oApi.isRtlInterface)
{
this.m_oLeftRuler = AscCommon.CreateControlContainer("id_panel_left");
this.m_oLeftRuler.Bounds.SetParams(0, 0, 1000, 1000, false, false, false, false, 5, -1);
this.m_oLeftRuler.Anchor = (g_anchor_left | g_anchor_top | g_anchor_bottom);
this.m_oMainContent.AddControl(this.m_oLeftRuler);
this.m_oMainView = AscCommon.CreateControlContainer("id_main_view");
this.m_oMainView.Bounds.SetParams(5, 7, 1000, 1000, true, true, false, false, -1, -1);
this.m_oMainView.Anchor = (g_anchor_left | g_anchor_right | g_anchor_top | g_anchor_bottom);
this.m_oMainContent.AddControl(this.m_oMainView);
}
else
{
this.m_oLeftRuler = AscCommon.CreateControlContainer("id_panel_left");
this.m_oLeftRuler.Bounds.SetParams(0, 0, 1000, 1000, false, false, false, false, 5, -1);
this.m_oLeftRuler.Anchor = (g_anchor_right | g_anchor_top | g_anchor_bottom);
this.m_oMainContent.AddControl(this.m_oLeftRuler);
this.m_oMainView = AscCommon.CreateControlContainer("id_main_view");
this.m_oMainView.Bounds.SetParams(0, 7, 5, 1000, false, true, true, false, -1, -1);
this.m_oMainView.Anchor = (g_anchor_left | g_anchor_right | g_anchor_top | g_anchor_bottom);
this.m_oMainContent.AddControl(this.m_oMainView);
}
this.m_oLeftRuler_buttonsTabs = AscCommon.CreateControl("id_buttonTabs");
this.m_oLeftRuler_buttonsTabs.Bounds.SetParams(0, 0.8, 1000, 1000, false, true, false, false, -1, 5);
this.m_oLeftRuler_buttonsTabs.Anchor = (g_anchor_left | g_anchor_top | g_anchor_right);
@ -352,10 +386,20 @@ function CEditorPage(api)
// ------------
// --- top ----
this.m_oTopRuler = AscCommon.CreateControlContainer("id_panel_top");
this.m_oTopRuler.Bounds.SetParams(5, 0, 1000, 1000, true, false, false, false, -1, 7);
this.m_oTopRuler.Anchor = (g_anchor_left | g_anchor_top | g_anchor_right);
this.m_oMainContent.AddControl(this.m_oTopRuler);
if (!this.m_oApi.isRtlInterface)
{
this.m_oTopRuler = AscCommon.CreateControlContainer("id_panel_top");
this.m_oTopRuler.Bounds.SetParams(5, 0, 1000, 1000, true, false, false, false, -1, 7);
this.m_oTopRuler.Anchor = (g_anchor_left | g_anchor_top | g_anchor_right);
this.m_oMainContent.AddControl(this.m_oTopRuler);
}
else
{
this.m_oTopRuler = AscCommon.CreateControlContainer("id_panel_top");
this.m_oTopRuler.Bounds.SetParams(0, 0, 5, 1000, false, false, true, false, -1, 7);
this.m_oTopRuler.Anchor = (g_anchor_left | g_anchor_top | g_anchor_right);
this.m_oMainContent.AddControl(this.m_oTopRuler);
}
this.m_oTopRuler_horRuler = AscCommon.CreateControl("id_hor_ruler");
this.m_oTopRuler_horRuler.Bounds.SetParams(0, 0, 1000, 1000, false, false, false, false, -1, -1);
@ -363,11 +407,6 @@ function CEditorPage(api)
this.m_oTopRuler.AddControl(this.m_oTopRuler_horRuler);
// ------------
this.m_oMainView = AscCommon.CreateControlContainer("id_main_view");
this.m_oMainView.Bounds.SetParams(5, 7, 1000, 1000, true, true, false, false, -1, -1);
this.m_oMainView.Anchor = (g_anchor_left | g_anchor_right | g_anchor_top | g_anchor_bottom);
this.m_oMainContent.AddControl(this.m_oMainView);
// проблема с фокусом fixed-позиционированного элемента внутри (bug 63194)
this.m_oMainView.HtmlElement.onscroll = function() {
this.scrollTop = 0;
@ -705,7 +744,11 @@ function CEditorPage(api)
this.m_oLeftRuler.HtmlElement.style.display = 'block';
this.m_oTopRuler.HtmlElement.style.display = 'block';
this.m_oMainView.Bounds.L = 5;
if (!this.m_oApi.isRtlInterface)
this.m_oMainView.Bounds.L = 5;
else
this.m_oMainView.Bounds.R = 5;
this.m_oMainView.Bounds.T = 7;
}
else
@ -713,7 +756,11 @@ function CEditorPage(api)
this.m_oLeftRuler.HtmlElement.style.display = 'none';
this.m_oTopRuler.HtmlElement.style.display = 'none';
this.m_oMainView.Bounds.L = 0;
if (!this.m_oApi.isRtlInterface)
this.m_oMainView.Bounds.L = 0;
else
this.m_oMainView.Bounds.R = 0;
this.m_oMainView.Bounds.T = 0;
}
};
@ -1758,11 +1805,9 @@ function CEditorPage(api)
var _xOffset = oWordControl.X;
var _yOffset = oWordControl.Y;
if (true === oWordControl.m_bIsRuler)
{
_xOffset += (5 * g_dKoef_mm_to_pix);
_yOffset += (7 * g_dKoef_mm_to_pix);
}
let offsets = oWordControl.m_oDrawingDocument.GetMainOffset();
_xOffset += offsets.x;
_yOffset += offsets.y;
if (window['closeDialogs'] != undefined)
window['closeDialogs']();
@ -3794,6 +3839,10 @@ function CEditorPage(api)
{
return this.m_oMainContent.AbsolutePosition;
};
this.GetVertRulerLeft = function()
{
return this.m_oLeftRuler.AbsolutePosition.L;
};
// mobile ---
this.setOffsetTop = function(offset, offsetScrollTop)

View File

@ -936,7 +936,10 @@ function CHorRuler()
var hor_ruler = word_control.m_oTopRuler_horRuler;
var dKoefPxToMM = 100 * g_dKoef_pix_to_mm / word_control.m_nZoomValue;
var _x = global_mouseEvent.X - 5 * g_dKoef_mm_to_pix - left - word_control.X - word_control.GetMainContentBounds().L * g_dKoef_mm_to_pix;
var _x = global_mouseEvent.X - left - word_control.X - word_control.GetMainContentBounds().L * g_dKoef_mm_to_pix;
if (!word_control.m_oApi.isRtlInterface)
_x -= 5 * g_dKoef_mm_to_pix;
_x *= dKoefPxToMM;
var _y = (global_mouseEvent.Y - word_control.Y) * g_dKoef_pix_to_mm;
@ -1800,7 +1803,10 @@ function CHorRuler()
var dKoefPxToMM = 100 * g_dKoef_pix_to_mm / word_control.m_nZoomValue;
var dKoef_mm_to_pix = g_dKoef_mm_to_pix * this.m_dZoom;
var _x = global_mouseEvent.X - 5 * g_dKoef_mm_to_pix - left - word_control.X - word_control.GetMainContentBounds().L * g_dKoef_mm_to_pix;
var _x = global_mouseEvent.X - left - word_control.X - word_control.GetMainContentBounds().L * g_dKoef_mm_to_pix;
if (!word_control.m_oApi.isRtlInterface)
_x -= 5 * g_dKoef_mm_to_pix;
_x *= dKoefPxToMM;
var _y = (global_mouseEvent.Y - word_control.Y) * g_dKoef_pix_to_mm;
@ -3569,7 +3575,7 @@ function CVerRuler()
var _y = global_mouseEvent.Y - 7 * g_dKoef_mm_to_pix - top - word_control.Y;
_y *= dKoefPxToMM;
var _x = (global_mouseEvent.X - word_control.X) * g_dKoef_pix_to_mm - word_control.GetMainContentBounds().L;
var _x = (global_mouseEvent.X - word_control.X) * g_dKoef_pix_to_mm - word_control.GetMainContentBounds().L - word_control.GetVertRulerLeft();
this.DragType = this.CheckMouseType(_x, _y);
this.DragTypeMouseDown = this.DragType;