Commit 57bda52d authored by Oleg.Korshul's avatar Oleg.Korshul Committed by Alexander.Trofimov

buttonRulers native draw (for retina support)

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@58724 954022d7-b5bf-4e40-9824-e11837661b57
parent 9730dc86
...@@ -515,6 +515,7 @@ function CEditorPage(api) ...@@ -515,6 +515,7 @@ function CEditorPage(api)
if (old != this.bIsRetinaSupport) if (old != this.bIsRetinaSupport)
{ {
// сбросить кэш страниц // сбросить кэш страниц
this.onButtonTabsDraw();
} }
} }
...@@ -522,7 +523,7 @@ function CEditorPage(api) ...@@ -522,7 +523,7 @@ function CEditorPage(api)
{ {
if (this.bIsRetinaSupport) if (this.bIsRetinaSupport)
{ {
if (htmlElem.id == "id_viewer" || htmlElem.id == "id_hor_ruler" || htmlElem.id == "id_vert_ruler") if (htmlElem.id == "id_viewer" || htmlElem.id == "id_hor_ruler" || htmlElem.id == "id_vert_ruler" || htmlElem.id == "id_buttonTabs")
return true; return true;
} }
return false; return false;
...@@ -968,25 +969,72 @@ function CEditorPage(api) ...@@ -968,25 +969,72 @@ function CEditorPage(api)
this.onButtonTabsClick = function() this.onButtonTabsClick = function()
{ {
if (false === oThis.m_oApi.bInit_word_control)
return;
var oWordControl = oThis; var oWordControl = oThis;
if (oWordControl.m_nTabsType == g_tabtype_left) if (oWordControl.m_nTabsType == g_tabtype_left)
{ {
oWordControl.m_nTabsType = g_tabtype_center; oWordControl.m_nTabsType = g_tabtype_center;
oWordControl.m_oLeftRuler_buttonsTabs.HtmlElement.style.backgroundPosition = "0px -37px"; oWordControl.onButtonTabsDraw();
} }
else if (oWordControl.m_nTabsType == g_tabtype_center) else if (oWordControl.m_nTabsType == g_tabtype_center)
{ {
oWordControl.m_nTabsType = g_tabtype_right; oWordControl.m_nTabsType = g_tabtype_right;
oWordControl.m_oLeftRuler_buttonsTabs.HtmlElement.style.backgroundPosition = "0px -18px"; oWordControl.onButtonTabsDraw();
} }
else else
{ {
oWordControl.m_nTabsType = g_tabtype_left; oWordControl.m_nTabsType = g_tabtype_left;
oWordControl.m_oLeftRuler_buttonsTabs.HtmlElement.style.backgroundPosition = "0px 0px"; oWordControl
.onButtonTabsDraw();
}
} }
this.onButtonTabsDraw = function()
{
var _ctx = this.m_oLeftRuler_buttonsTabs.HtmlElement.getContext('2d');
if (this.bIsRetinaSupport)
{
_ctx.setTransform(2, 0, 0, 2, 0, 0);
}
else
{
_ctx.setTransform(1, 0, 0, 1, 0, 0);
}
var _width = 19;
var _height = 19;
_ctx.clearRect(0, 0, 19, 19);
_ctx.lineWidth = 1;
_ctx.strokeStyle = "#BBBEC2";
_ctx.strokeRect(2.5, 3.5, 14, 14);
_ctx.beginPath();
_ctx.strokeStyle = "#3E3E3E";
_ctx.lineWidth = 2;
if (this.m_nTabsType == g_tabtype_left)
{
_ctx.moveTo(8, 9);
_ctx.lineTo(8, 14);
_ctx.lineTo(13, 14);
}
else if (this.m_nTabsType == g_tabtype_center)
{
_ctx.moveTo(6, 14);
_ctx.lineTo(14, 14);
_ctx.moveTo(10, 9);
_ctx.lineTo(10, 14);
}
else
{
_ctx.moveTo(12, 9);
_ctx.lineTo(12, 14);
_ctx.lineTo(7, 14);
}
_ctx.stroke();
_ctx.beginPath();
} }
this.onPrevPage = function() this.onPrevPage = function()
...@@ -2146,6 +2194,7 @@ function CEditorPage(api) ...@@ -2146,6 +2194,7 @@ function CEditorPage(api)
//console.log("resize"); //console.log("resize");
this.CheckRetinaDisplay(); this.CheckRetinaDisplay();
this.m_oBody.Resize(this.Width * g_dKoef_pix_to_mm, this.Height * g_dKoef_pix_to_mm, this); this.m_oBody.Resize(this.Width * g_dKoef_pix_to_mm, this.Height * g_dKoef_pix_to_mm, this);
this.onButtonTabsDraw();
this.DemonstrationManager.Resize(); this.DemonstrationManager.Resize();
if (this.checkNeedHorScroll()) if (this.checkNeedHorScroll())
...@@ -2193,6 +2242,7 @@ function CEditorPage(api) ...@@ -2193,6 +2242,7 @@ function CEditorPage(api)
this.OnResize2 = function(isAttack) this.OnResize2 = function(isAttack)
{ {
this.m_oBody.Resize(this.Width * g_dKoef_pix_to_mm, this.Height * g_dKoef_pix_to_mm, this); this.m_oBody.Resize(this.Width * g_dKoef_pix_to_mm, this.Height * g_dKoef_pix_to_mm, this);
this.onButtonTabsDraw();
this.DemonstrationManager.Resize(); this.DemonstrationManager.Resize();
if (this.checkNeedHorScroll()) if (this.checkNeedHorScroll())
......
...@@ -878,15 +878,6 @@ background-repeat: no-repeat;\ ...@@ -878,15 +878,6 @@ background-repeat: no-repeat;\
}"; }";
_head.appendChild(style1); _head.appendChild(style1);
var style2 = document.createElement('style');
style2.type = 'text/css';
style2.innerHTML = ".buttonRuler {\
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAwCAYAAAAYX/pXAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAOwwAADsMBx2+oZAAAABp0RVh0U29mdHdhcmUAUGFpbnQuTkVUIHYzLjUuMTAw9HKhAAABhElEQVRIS62Uwa6CMBBF/VQNQcOCBS5caOICApEt3+Wv+AcmfQ7pbdreqY+CJifTdjpng727aZrMFmbB+/3erYEE+/3egMPhMPP57QR/EJCgKAoTs1hQlqURjsdjAESyPp1O7pwEVVWZ1+s1VyB7DemRoK5rN+CvNaRPgqZpgqHz+UwSnEklweVyCQbivX8mlQTX65UGfG63m+vLXRLc7/ekQHoAexK0bWs0uq5TKwli8Afq+94Mw+CQPe78K5D6eDzMOI4GVcCdr4IlOMEWfiP4fJpVkEDLA38ghgR+DgB/ICYQ5OYBCez7d1mAvQZ6gcBmAK010A8ENg8c9u2rZ6iBwL51R7z3z1ADgc2DJDYPZnA3ENi3rhLlgauBAO8/JpUHJEih5QF6iwRaHqC3SPANJ9jCbwTP53MVJNDywB+IIYGfA8AfiAkEqTyQDEAO+HlAgtw8IEFuHpAgNw9IkJsHJMjNAxLk5gEJ8P5jUnlAghRaHqC3SKDlAXqLBN9wgvVM5g/dFuEU6U2wnAAAAABJRU5ErkJggg==);\
background-position: 0px 0px;\
background-repeat: no-repeat;\
}";
_head.appendChild(style2);
var style3 = document.createElement('style'); var style3 = document.createElement('style');
style3.type = 'text/css'; style3.type = 'text/css';
style3.innerHTML = ".buttonPrevPage {\ style3.innerHTML = ".buttonPrevPage {\
...@@ -927,7 +918,7 @@ asc_docs_api.prototype.CreateComponents = function() ...@@ -927,7 +918,7 @@ asc_docs_api.prototype.CreateComponents = function()
</div>\ </div>\
<div id=\"id_main\" class=\"block_elem\" style=\"-moz-user-select:none;-khtml-user-select:none;user-select:none;background-color:" + GlobalSkin.BackgroundColor + ";overflow:hidden;border-left-width: 1px;border-left-color:" + GlobalSkin.BorderSplitterColor + "; border-left-style: solid;" + _main_border_style + "\" UNSELECTABLE=\"on\">\ <div id=\"id_main\" class=\"block_elem\" style=\"-moz-user-select:none;-khtml-user-select:none;user-select:none;background-color:" + GlobalSkin.BackgroundColor + ";overflow:hidden;border-left-width: 1px;border-left-color:" + GlobalSkin.BorderSplitterColor + "; border-left-style: solid;" + _main_border_style + "\" UNSELECTABLE=\"on\">\
<div id=\"id_panel_left\" class=\"block_elem\">\ <div id=\"id_panel_left\" class=\"block_elem\">\
<div id=\"id_buttonTabs\" class=\"block_elem buttonTabs\"></div>\ <canvas id=\"id_buttonTabs\" class=\"block_elem\"></canvas>\
<canvas id=\"id_vert_ruler\" class=\"block_elem\"></canvas>\ <canvas id=\"id_vert_ruler\" class=\"block_elem\"></canvas>\
</div>\ </div>\
<div id=\"id_panel_top\" class=\"block_elem\">\ <div id=\"id_panel_top\" class=\"block_elem\">\
......
...@@ -469,6 +469,7 @@ function CEditorPage(api) ...@@ -469,6 +469,7 @@ function CEditorPage(api)
if (old != this.bIsRetinaSupport) if (old != this.bIsRetinaSupport)
{ {
this.m_oDrawingDocument.ClearCachePages(); this.m_oDrawingDocument.ClearCachePages();
this.onButtonTabsDraw();
} }
} }
...@@ -1261,25 +1262,72 @@ function CEditorPage(api) ...@@ -1261,25 +1262,72 @@ function CEditorPage(api)
this.onButtonTabsClick = function() this.onButtonTabsClick = function()
{ {
if (false === oThis.m_oApi.bInit_word_control)
return;
var oWordControl = oThis; var oWordControl = oThis;
if (oWordControl.m_nTabsType == g_tabtype_left) if (oWordControl.m_nTabsType == g_tabtype_left)
{ {
oWordControl.m_nTabsType = g_tabtype_center; oWordControl.m_nTabsType = g_tabtype_center;
oWordControl.m_oLeftRuler_buttonsTabs.HtmlElement.style.backgroundPosition = "0px -37px"; oWordControl.onButtonTabsDraw();
} }
else if (oWordControl.m_nTabsType == g_tabtype_center) else if (oWordControl.m_nTabsType == g_tabtype_center)
{ {
oWordControl.m_nTabsType = g_tabtype_right; oWordControl.m_nTabsType = g_tabtype_right;
oWordControl.m_oLeftRuler_buttonsTabs.HtmlElement.style.backgroundPosition = "0px -18px"; oWordControl.onButtonTabsDraw();
} }
else else
{ {
oWordControl.m_nTabsType = g_tabtype_left; oWordControl.m_nTabsType = g_tabtype_left;
oWordControl.m_oLeftRuler_buttonsTabs.HtmlElement.style.backgroundPosition = "0px 0px"; oWordControl
.onButtonTabsDraw();
}
} }
this.onButtonTabsDraw = function()
{
var _ctx = this.m_oLeftRuler_buttonsTabs.HtmlElement.getContext('2d');
if (this.bIsRetinaSupport)
{
_ctx.setTransform(2, 0, 0, 2, 0, 0);
}
else
{
_ctx.setTransform(1, 0, 0, 1, 0, 0);
}
var _width = 19;
var _height = 19;
_ctx.clearRect(0, 0, 19, 19);
_ctx.lineWidth = 1;
_ctx.strokeStyle = "#BBBEC2";
_ctx.strokeRect(2.5, 3.5, 14, 14);
_ctx.beginPath();
_ctx.strokeStyle = "#3E3E3E";
_ctx.lineWidth = 2;
if (this.m_nTabsType == g_tabtype_left)
{
_ctx.moveTo(8, 9);
_ctx.lineTo(8, 14);
_ctx.lineTo(13, 14);
}
else if (this.m_nTabsType == g_tabtype_center)
{
_ctx.moveTo(6, 14);
_ctx.lineTo(14, 14);
_ctx.moveTo(10, 9);
_ctx.lineTo(10, 14);
}
else
{
_ctx.moveTo(12, 9);
_ctx.lineTo(12, 14);
_ctx.lineTo(7, 14);
}
_ctx.stroke();
_ctx.beginPath();
} }
this.onPrevPage = function() this.onPrevPage = function()
...@@ -2739,6 +2787,7 @@ function CEditorPage(api) ...@@ -2739,6 +2787,7 @@ function CEditorPage(api)
this.CheckRetinaDisplay(); this.CheckRetinaDisplay();
this.m_oBody.Resize(this.Width * g_dKoef_pix_to_mm, this.Height * g_dKoef_pix_to_mm, this); this.m_oBody.Resize(this.Width * g_dKoef_pix_to_mm, this.Height * g_dKoef_pix_to_mm, this);
this.onButtonTabsDraw();
if (this.TextBoxBackground != null) if (this.TextBoxBackground != null)
{ {
...@@ -3374,7 +3423,7 @@ function CEditorPage(api) ...@@ -3374,7 +3423,7 @@ function CEditorPage(api)
{ {
if (this.bIsRetinaSupport) if (this.bIsRetinaSupport)
{ {
if (htmlElem.id == "id_viewer" || htmlElem.id == "id_hor_ruler" || htmlElem.id == "id_vert_ruler") if (htmlElem.id == "id_viewer" || htmlElem.id == "id_hor_ruler" || htmlElem.id == "id_vert_ruler" || htmlElem.id == "id_buttonTabs")
return true; return true;
} }
return false; return false;
......
...@@ -1107,15 +1107,6 @@ asc_docs_api.prototype.CreateCSS = function() ...@@ -1107,15 +1107,6 @@ asc_docs_api.prototype.CreateCSS = function()
style0.innerHTML = ".block_elem { position:absolute;padding:0;margin:0; }"; style0.innerHTML = ".block_elem { position:absolute;padding:0;margin:0; }";
_head.appendChild(style0); _head.appendChild(style0);
var style1 = document.createElement('style');
style1.type = 'text/css';
style1.innerHTML = ".buttonTabs {\
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAA5CAMAAADjueCuAAAABGdBTUEAALGPC/xhBQAAAEhQTFRFAAAAWFhYZWVlSEhIY2NjV1dXQ0NDYWFhYmJiTk5OVlZWYGBgVFRUS0tLbGxsRERETExMZmZmVVVVXl5eR0dHa2trPj4+u77CpAZQrwAAAAF0Uk5TAEDm2GYAAABwSURBVDjL1dHHDoAgEEVR7NLr4P//qQm6EMaFxtje8oTF5ELIpU35Fstf3GegsPEBG+uwSYpNB1qNKreoDeNw/r6dLr/tnFpbbNZj8wKbk8W/1d6ZPjfrhdHx9c4fbA9wzMYWm3OFhbQmbC2ue6z9DCH/Exf/mU3YAAAAAElFTkSuQmCC);\
background-position: 0px 0px;\
background-repeat: no-repeat;\
}";
_head.appendChild(style1);
var style2 = document.createElement('style'); var style2 = document.createElement('style');
style2.type = 'text/css'; style2.type = 'text/css';
style2.innerHTML = ".buttonRuler {\ style2.innerHTML = ".buttonRuler {\
...@@ -1152,7 +1143,7 @@ asc_docs_api.prototype.CreateComponents = function() ...@@ -1152,7 +1143,7 @@ asc_docs_api.prototype.CreateComponents = function()
if (element != null) if (element != null)
element.innerHTML = "<div id=\"id_main\" class=\"block_elem\" style=\"-moz-user-select:none;-khtml-user-select:none;user-select:none;background-color:" + GlobalSkin.BackgroundColor + ";overflow:hidden;\" UNSELECTABLE=\"on\">\ element.innerHTML = "<div id=\"id_main\" class=\"block_elem\" style=\"-moz-user-select:none;-khtml-user-select:none;user-select:none;background-color:" + GlobalSkin.BackgroundColor + ";overflow:hidden;\" UNSELECTABLE=\"on\">\
<div id=\"id_panel_left\" class=\"block_elem\">\ <div id=\"id_panel_left\" class=\"block_elem\">\
<div id=\"id_buttonTabs\" class=\"block_elem buttonTabs\"></div>\ <canvas id=\"id_buttonTabs\" class=\"block_elem\"></canvas>\
<canvas id=\"id_vert_ruler\" class=\"block_elem\"></canvas>\ <canvas id=\"id_vert_ruler\" class=\"block_elem\"></canvas>\
</div>\ </div>\
<div id=\"id_panel_top\" class=\"block_elem\">\ <div id=\"id_panel_top\" class=\"block_elem\">\
......
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