Commit 7eb72e66 authored by Oleg.Korshul's avatar Oleg.Korshul Committed by Alexander.Trofimov

ретина

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@49779 954022d7-b5bf-4e40-9824-e11837661b57
parent f737be55
...@@ -948,7 +948,10 @@ function CBinaryFileWriter() ...@@ -948,7 +948,10 @@ function CBinaryFileWriter()
{ {
oThis.WriteTable(spTree[i]); oThis.WriteTable(spTree[i]);
} }
// TODO: WriteChart else if (spTree[i] instanceof CChartAsGroup)
{
oThis.WriteChart(spTree[i]);
}
oThis.EndRecord(); oThis.EndRecord();
} }
...@@ -1997,9 +2000,6 @@ function CBinaryFileWriter() ...@@ -1997,9 +2000,6 @@ function CBinaryFileWriter()
shape.spPr.WriteXfrm = shape.spPr.xfrm; shape.spPr.WriteXfrm = shape.spPr.xfrm;
var tmpGeom = shape.spPr.Geometry;
shape.spPr.Geometry = shape.geometry;
var tmpFill = shape.spPr.Fill; var tmpFill = shape.spPr.Fill;
var isUseTmpFill = false; var isUseTmpFill = false;
if (tmpFill !== undefined && tmpFill != null) if (tmpFill !== undefined && tmpFill != null)
...@@ -2020,7 +2020,6 @@ function CBinaryFileWriter() ...@@ -2020,7 +2020,6 @@ function CBinaryFileWriter()
oThis.WriteRecord2(2, shape.style, oThis.WriteShapeStyle); oThis.WriteRecord2(2, shape.style, oThis.WriteShapeStyle);
oThis.WriteRecord2(3, shape.txBody, oThis.WriteTxBody); oThis.WriteRecord2(3, shape.txBody, oThis.WriteTxBody);
shape.spPr.Geometry = tmpGeom;
if (isUseTmpFill) if (isUseTmpFill)
{ {
shape.spPr.Fill = tmpFill; shape.spPr.Fill = tmpFill;
...@@ -2039,10 +2038,10 @@ function CBinaryFileWriter() ...@@ -2039,10 +2038,10 @@ function CBinaryFileWriter()
image.spPr.WriteXfrm = image.spPr.xfrm; image.spPr.WriteXfrm = image.spPr.xfrm;
if (image.spPr.Geometry === undefined || image.spPr.Geometry == null) if (image.spPr.geometry === undefined || image.spPr.geometry == null)
{ {
// powerpoint! // powerpoint!
image.spPr.Geometry = CreateGeometry("rect"); image.spPr.geometry = CreateGeometry("rect");
} }
oThis.WriteRecord1(1, image.blipFill, oThis.WriteUniFill); oThis.WriteRecord1(1, image.blipFill, oThis.WriteUniFill);
...@@ -2444,9 +2443,9 @@ function CBinaryFileWriter() ...@@ -2444,9 +2443,9 @@ function CBinaryFileWriter()
} }
oThis.WriteRecord2(0, spPr.WriteXfrm, oThis.WriteXfrm); oThis.WriteRecord2(0, spPr.WriteXfrm, oThis.WriteXfrm);
oThis.WriteRecord1(1, spPr.Geometry, oThis.WriteGeometry); oThis.WriteRecord2(1, spPr.geometry, oThis.WriteGeometry);
if (spPr.Geometry === undefined || spPr.Geometry == null) if (spPr.geometry === undefined || spPr.geometry == null)
{ {
if (bIsExistFill || bIsExistLn) if (bIsExistFill || bIsExistLn)
{ {
......
...@@ -21,7 +21,8 @@ ...@@ -21,7 +21,8 @@
} }
} }
window.USER_AGENT_SAFARI_MACOS = (navigator.userAgent.toLowerCase().indexOf('safari') > -1 && navigator.userAgent.toLowerCase().indexOf('mac') > -1) ? true : false; window.USER_AGENT_MACOS = (navigator.userAgent.toLowerCase().indexOf('mac') > -1) ? true : false;
window.USER_AGENT_SAFARI_MACOS = (navigator.userAgent.toLowerCase().indexOf('safari') > -1 && window.USER_AGENT_MACOS) ? true : false;
if (window.USER_AGENT_SAFARI_MACOS) if (window.USER_AGENT_SAFARI_MACOS)
{ {
// браузеры под мак все определяются как сафари // браузеры под мак все определяются как сафари
...@@ -30,6 +31,7 @@ if (window.USER_AGENT_SAFARI_MACOS) ...@@ -30,6 +31,7 @@ if (window.USER_AGENT_SAFARI_MACOS)
window.USER_AGENT_SAFARI_MACOS = false; window.USER_AGENT_SAFARI_MACOS = false;
} }
window.USER_AGENT_IE = ((/MSIE/g.test(navigator.userAgent)) || window.opera) ? true : false; window.USER_AGENT_IE = ((/MSIE/g.test(navigator.userAgent)) || window.opera) ? true : false;
window.USER_AGENT_WEBKIT = (navigator.userAgent.toLowerCase().indexOf('webkit') > -1) ? true : false;
window.GlobalPasteFlagCounter = 0; window.GlobalPasteFlagCounter = 0;
...@@ -239,8 +241,7 @@ function Editor_Copy(api, bCut) ...@@ -239,8 +241,7 @@ function Editor_Copy(api, bCut)
{ {
//�������� � webkit: ���� ���������� ����� ���� ��������, �� ���������� ������ ��� ������������ //�������� � webkit: ���� ���������� ����� ���� ��������, �� ���������� ������ ��� ������������
//������ ��� docs.google ����������� ��� � ��� <b> //������ ��� docs.google ����������� ��� � ��� <b>
var is_webkit = navigator.userAgent.toLowerCase().indexOf('webkit') > -1; if(window.USER_AGENT_WEBKIT && (true !== window.USER_AGENT_SAFARI_MACOS))
if(is_webkit && (true !== window.USER_AGENT_SAFARI_MACOS))
{ {
var aChildNodes = ElemToSelect.childNodes; var aChildNodes = ElemToSelect.childNodes;
if(aChildNodes.length == 1) if(aChildNodes.length == 1)
......
...@@ -2784,7 +2784,7 @@ function CDrawingDocument() ...@@ -2784,7 +2784,7 @@ function CDrawingDocument()
ctx.stroke(); ctx.stroke();
} }
if (!oThis.m_oWordControl.MobileTouchManager) if ((!oThis.m_oWordControl.MobileTouchManager && !window.USER_AGENT_SAFARI_MACOS) || !window.USER_AGENT_WEBKIT)
{ {
this.TargetHtmlElement.style.left = Math.min(pos1.X, pos2.X) + "px"; this.TargetHtmlElement.style.left = Math.min(pos1.X, pos2.X) + "px";
this.TargetHtmlElement.style.top = Math.min(pos1.Y, pos2.Y) + "px"; this.TargetHtmlElement.style.top = Math.min(pos1.Y, pos2.Y) + "px";
...@@ -2795,7 +2795,6 @@ function CDrawingDocument() ...@@ -2795,7 +2795,6 @@ function CDrawingDocument()
var __y = Math.min(pos1.Y, pos2.Y); var __y = Math.min(pos1.Y, pos2.Y);
oThis.TargetHtmlElement.style.left = "0px"; oThis.TargetHtmlElement.style.left = "0px";
oThis.TargetHtmlElement.style.top = "0px"; oThis.TargetHtmlElement.style.top = "0px";
//oThis.TargetHtmlElement.style.webkitTransform = "translate(" + __x + "px," + __y + "px)";
oThis.TargetHtmlElement.style["webkitTransform"] = "matrix(1, 0, 0, 1, " +__x + "," + __y + ")"; oThis.TargetHtmlElement.style["webkitTransform"] = "matrix(1, 0, 0, 1, " +__x + "," + __y + ")";
} }
} }
...@@ -2828,7 +2827,7 @@ function CDrawingDocument() ...@@ -2828,7 +2827,7 @@ function CDrawingDocument()
var pos = this.ConvertCoordsToCursor2(x, y, this.m_lCurrentPage); var pos = this.ConvertCoordsToCursor2(x, y, this.m_lCurrentPage);
if (!oThis.m_oWordControl.MobileTouchManager) if (!oThis.m_oWordControl.MobileTouchManager && !window.USER_AGENT_SAFARI_MACOS)
{ {
this.TargetHtmlElement.style.left = pos.X + "px"; this.TargetHtmlElement.style.left = pos.X + "px";
this.TargetHtmlElement.style.top = pos.Y + "px"; this.TargetHtmlElement.style.top = pos.Y + "px";
...@@ -2837,7 +2836,6 @@ function CDrawingDocument() ...@@ -2837,7 +2836,6 @@ function CDrawingDocument()
{ {
oThis.TargetHtmlElement.style.left = "0px"; oThis.TargetHtmlElement.style.left = "0px";
oThis.TargetHtmlElement.style.top = "0px"; oThis.TargetHtmlElement.style.top = "0px";
//oThis.TargetHtmlElement.style.webkitTransform = "translate(" + pos.X + "px," + pos.Y + "px)";
oThis.TargetHtmlElement.style["webkitTransform"] = "matrix(1, 0, 0, 1, " + pos.X + "," + pos.Y + ")"; oThis.TargetHtmlElement.style["webkitTransform"] = "matrix(1, 0, 0, 1, " + pos.X + "," + pos.Y + ")";
} }
...@@ -5095,8 +5093,17 @@ function CDrawingDocument() ...@@ -5095,8 +5093,17 @@ function CDrawingDocument()
Grid[i] = W / Cols; Grid[i] = W / Cols;
var _canvas = document.createElement('canvas'); var _canvas = document.createElement('canvas');
if (!this.m_oWordControl.bIsRetinaSupport)
{
_canvas.width = TABLE_STYLE_WIDTH_PIX; _canvas.width = TABLE_STYLE_WIDTH_PIX;
_canvas.height = TABLE_STYLE_HEIGHT_PIX; _canvas.height = TABLE_STYLE_HEIGHT_PIX;
}
else
{
_canvas.width = (TABLE_STYLE_WIDTH_PIX << 1);
_canvas.height = (TABLE_STYLE_HEIGHT_PIX << 1);
}
var ctx = _canvas.getContext('2d'); var ctx = _canvas.getContext('2d');
History.TurnOff(); History.TurnOff();
...@@ -5133,7 +5140,7 @@ function CDrawingDocument() ...@@ -5133,7 +5140,7 @@ function CDrawingDocument()
} }
History.TurnOn(); History.TurnOn();
this.m_oWordControl.m_oApi.sync_InitEditorTableStyles(_dst_styles); this.m_oWordControl.m_oApi.sync_InitEditorTableStyles(_dst_styles, this.m_oWordControl.bIsRetinaSupport);
} }
this.IsMobileVersion = function() this.IsMobileVersion = function()
...@@ -5607,9 +5614,17 @@ function CStylesPainter() ...@@ -5607,9 +5614,17 @@ function CStylesPainter()
this.STYLE_THUMBNAIL_HEIGHT = 40; this.STYLE_THUMBNAIL_HEIGHT = 40;
this.CurrentTranslate = null; this.CurrentTranslate = null;
this.IsRetinaEnabled = false;
this.GenerateStyles = function(_api, ds) this.GenerateStyles = function(_api, ds)
{ {
if (_api.WordControl.bIsRetinaSupport)
{
this.STYLE_THUMBNAIL_WIDTH <<= 1;
this.STYLE_THUMBNAIL_HEIGHT <<= 1;
this.IsRetinaEnabled = true;
}
this.CurrentTranslate = _api.CurrentTranslate; this.CurrentTranslate = _api.CurrentTranslate;
this.GenerateDefaultStyles(_api, ds); this.GenerateDefaultStyles(_api, ds);
......
...@@ -504,6 +504,8 @@ function CGraphics() ...@@ -504,6 +504,8 @@ function CGraphics()
this.IsUseFonts2 = false; this.IsUseFonts2 = false;
this.m_oFontManager2 = null; this.m_oFontManager2 = null;
this.m_oLastFont2 = null; this.m_oLastFont2 = null;
this.ClearMode = false;
} }
CGraphics.prototype = CGraphics.prototype =
......
...@@ -2036,13 +2036,29 @@ function CEditorPage(api) ...@@ -2036,13 +2036,29 @@ function CEditorPage(api)
} }
var oWordControl = oThis; var oWordControl = oThis;
if (false === oWordControl.m_oApi.bInit_word_control || oWordControl.m_bIsMouseLock === true) if (false === oWordControl.m_oApi.bInit_word_control)
{ {
check_KeyboardEvent2(e); check_KeyboardEvent2(e);
e.preventDefault(); e.preventDefault();
return; return;
} }
if (oWordControl.m_bIsMouseLock === true)
{
if (!window.USER_AGENT_MACOS)
{
check_KeyboardEvent2(e);
e.preventDefault();
return;
}
// на масОс есть мега выделение на трекпаде. там моусАп приходит с задержкой.
// нужно лдибо копить команды клавиатуры, либо насильно заранее сделать моусАп самому.
// мы выбараем второе
oWordControl.onMouseUpExternal(global_mouseEvent.X, global_mouseEvent.Y);
}
check_KeyboardEvent(e); check_KeyboardEvent(e);
if (oWordControl.IsFocus === false) if (oWordControl.IsFocus === false)
...@@ -3062,7 +3078,7 @@ function CEditorPage(api) ...@@ -3062,7 +3078,7 @@ function CEditorPage(api)
{ {
if (this.bIsRetinaSupport) if (this.bIsRetinaSupport)
{ {
if (htmlElem.id == "id_viewer") if (htmlElem.id == "id_viewer" || htmlElem.id == "id_hor_ruler" || htmlElem.id == "id_vert_ruler")
return true; return true;
} }
return false; return false;
......
...@@ -177,19 +177,131 @@ function CHorRuler() ...@@ -177,19 +177,131 @@ function CHorRuler()
return _data; return _data;
} }
this.InitTablePict2 = function()
{
var _data = g_memory.ctx.createImageData(7, 8);
var _px = _data.data;
var is2 = false;
var black_level = 100;
for (var j = 0; j < 8; j++)
{
var ind = j * 4 * 7;
if (is2)
{
for (i = 0; i < 7; i++)
{
_px[ind++] = black_level;
_px[ind++] = black_level;
_px[ind++] = black_level;
_px[ind++] = 255;
}
}
else
{
var is22 = false;
for (var i = 0; i < 7; i++)
{
if (is22)
{
_px[ind++] = black_level;
_px[ind++] = black_level;
_px[ind++] = black_level;
_px[ind++] = 255;
}
else
{
_px[ind++] = 255;
_px[ind++] = 255;
_px[ind++] = 255;
_px[ind++] = 255;
}
is22 = !is22;
}
}
is2 = !is2;
}
var _data2 = g_memory.ctx.createImageData(14, 16);
var _px2 = _data2.data;
var _sI = 0;
var _sI2 = 0;
for (var j = 0; j < 8; j++)
{
var _oldsI = _sI;
for (var i = 0; i < 7; i++)
{
_px2[_sI2++] = _px[_sI];
_px2[_sI2++] = _px[_sI];
_px2[_sI2++] = _px[_sI];
_px2[_sI2++] = _px[_sI];
_px2[_sI2++] = _px[_sI++];
_px2[_sI2++] = _px[_sI++];
_px2[_sI2++] = _px[_sI++];
_px2[_sI2++] = _px[_sI++];
}
_sI = _oldsI;
for (var i = 0; i < 7; i++)
{
_px2[_sI2++] = _px[_sI];
_px2[_sI2++] = _px[_sI];
_px2[_sI2++] = _px[_sI];
_px2[_sI2++] = _px[_sI];
_px2[_sI2++] = _px[_sI++];
_px2[_sI2++] = _px[_sI++];
_px2[_sI2++] = _px[_sI++];
_px2[_sI2++] = _px[_sI++];
}
}
return _data2;
}
this.CheckTableSprite = function(is_retina)
{
if (null != this.tableSprite)
{
if (!is_retina && this.tableSprite.width == 7)
return;
if (is_retina && this.tableSprite.width == 14)
return;
}
if (!is_retina)
this.tableSprite = this.InitTablePict(); this.tableSprite = this.InitTablePict();
else
this.tableSprite = this.InitTablePict2();
}
this.tableSprite = null;
this.CheckCanvas = function() this.CheckCanvas = function()
{ {
this.m_dZoom = this.m_oWordControl.m_nZoomValue / 100; this.m_dZoom = this.m_oWordControl.m_nZoomValue / 100;
this.IsRetina = this.m_oWordControl.bIsRetinaSupport;
this.CheckTableSprite(this.IsRetina);
var dKoef_mm_to_pix = g_dKoef_mm_to_pix * this.m_dZoom; var dKoef_mm_to_pix = g_dKoef_mm_to_pix * this.m_dZoom;
if (this.IsRetina)
dKoef_mm_to_pix *= 2;
var widthNew = dKoef_mm_to_pix * this.m_oPage.width_mm; var widthNew = dKoef_mm_to_pix * this.m_oPage.width_mm;
var _width = 10 + widthNew; var _width = 10 + widthNew;
if (this.IsRetina)
_width += 10;
var _height = 8 * g_dKoef_mm_to_pix; var _height = 8 * g_dKoef_mm_to_pix;
var intW = parseInt(_width); if (this.IsRetina)
var intH = parseInt(_height); _height *= 2;
var intW = _width >> 0;
var intH = _height >> 0;
if (null == this.m_oCanvas) if (null == this.m_oCanvas)
{ {
this.m_oCanvas = document.createElement('canvas'); this.m_oCanvas = document.createElement('canvas');
...@@ -220,6 +332,9 @@ function CHorRuler() ...@@ -220,6 +332,9 @@ function CHorRuler()
this.m_oPage = cachedPage; this.m_oPage = cachedPage;
var width = this.CheckCanvas(); var width = this.CheckCanvas();
if (this.IsRetina)
width >>= 1;
if (0 == this.DragType) if (0 == this.DragType)
{ {
this.m_dMarginLeft = cachedPage.margin_left; this.m_dMarginLeft = cachedPage.margin_left;
...@@ -293,6 +408,10 @@ function CHorRuler() ...@@ -293,6 +408,10 @@ function CHorRuler()
this.m_nBottom = parseInt(5.2 * g_dKoef_mm_to_pix); this.m_nBottom = parseInt(5.2 * g_dKoef_mm_to_pix);
var context = this.m_oCanvas.getContext('2d'); var context = this.m_oCanvas.getContext('2d');
if (!this.IsRetina)
context.setTransform(1, 0, 0, 1, 5, 0);
else
context.setTransform(2, 0, 0, 2, 10, 0);
context.fillStyle = "#B0B0B0"; context.fillStyle = "#B0B0B0";
context.fillRect(0, 0, this.m_oCanvas.width, this.m_oCanvas.height); context.fillRect(0, 0, this.m_oCanvas.width, this.m_oCanvas.height);
...@@ -347,7 +466,7 @@ function CHorRuler() ...@@ -347,7 +466,7 @@ function CHorRuler()
} }
context.fillStyle = "#EDEDED"; context.fillStyle = "#EDEDED";
context.fillRect(5 + left_margin + 0.5, this.m_nTop + 0.5, right_margin - left_margin, this.m_nBottom - this.m_nTop); context.fillRect(left_margin + 0.5, this.m_nTop + 0.5, right_margin - left_margin, this.m_nBottom - this.m_nTop);
var intW = parseInt(width); var intW = parseInt(width);
...@@ -358,13 +477,13 @@ function CHorRuler() ...@@ -358,13 +477,13 @@ function CHorRuler()
context.strokeStyle = "#929292"; context.strokeStyle = "#929292";
context.lineWidth = 1; context.lineWidth = 1;
context.strokeRect(5 + 0.5, this.m_nTop + 0.5, intW, this.m_nBottom - this.m_nTop); context.strokeRect(0.5, this.m_nTop + 0.5, intW, this.m_nBottom - this.m_nTop);
context.beginPath(); context.beginPath();
context.moveTo(5 + left_margin + 0.5, this.m_nTop + 0.5); context.moveTo(left_margin + 0.5, this.m_nTop + 0.5);
context.lineTo(5 + left_margin + 0.5, this.m_nBottom - 0.5); context.lineTo(left_margin + 0.5, this.m_nBottom - 0.5);
context.moveTo(5 + right_margin + 0.5, this.m_nTop + 0.5); context.moveTo(right_margin + 0.5, this.m_nTop + 0.5);
context.lineTo(5 + right_margin + 0.5, this.m_nBottom - 0.5); context.lineTo(right_margin + 0.5, this.m_nBottom - 0.5);
context.stroke(); context.stroke();
context.beginPath(); context.beginPath();
...@@ -386,7 +505,7 @@ function CHorRuler() ...@@ -386,7 +505,7 @@ function CHorRuler()
var num = 0; var num = 0;
for (var i = 1; i < lCount1; i++) for (var i = 1; i < lCount1; i++)
{ {
var lXPos = parseInt(5 + left_margin + i * mm_1_4) + 0.5; var lXPos = parseInt(left_margin + i * mm_1_4) + 0.5;
index++; index++;
if (index == 4) if (index == 4)
...@@ -431,7 +550,7 @@ function CHorRuler() ...@@ -431,7 +550,7 @@ function CHorRuler()
num = 0; num = 0;
for (var i = 1; i <= lCount2; i++) for (var i = 1; i <= lCount2; i++)
{ {
var lXPos = parseInt(5 + left_margin - i * mm_1_4) + 0.5; var lXPos = parseInt(left_margin - i * mm_1_4) + 0.5;
index++; index++;
if (index == 4) if (index == 4)
...@@ -483,24 +602,39 @@ function CHorRuler() ...@@ -483,24 +602,39 @@ function CHorRuler()
var _offset = markup.X; var _offset = markup.X;
for (var i = 0; i <= _count; i++) for (var i = 0; i <= _count; i++)
{ {
var __xID = 0;
if (!this.IsRetina)
__xID = (2.5 + _offset * dKoef_mm_to_pix) >> 0;
else
__xID = ((2.5 + _offset * dKoef_mm_to_pix) * 2) >> 0;
var __yID = this.m_nBottom - 10;
if (this.IsRetina);
__yID <<= 1;
if (0 == i) if (0 == i)
{ {
context.putImageData(this.tableSprite, parseInt(2.5 + _offset * dKoef_mm_to_pix), this.m_nBottom - 10); context.putImageData(this.tableSprite, __xID, __yID);
_offset += markup.Cols[i]; _offset += markup.Cols[i];
continue; continue;
} }
if (i == _count) if (i == _count)
{ {
context.putImageData(this.tableSprite, parseInt(2.5 + _offset * dKoef_mm_to_pix), this.m_nBottom - 10); context.putImageData(this.tableSprite, __xID, __yID);
break; break;
} }
var __x = parseInt((_offset - markup.Margins[i-1].Right) * dKoef_mm_to_pix) + 0.5; var __x = parseInt((_offset - markup.Margins[i-1].Right) * dKoef_mm_to_pix) + 0.5;
var __r = parseInt((_offset + markup.Margins[i].Left) * dKoef_mm_to_pix) + 0.5; var __r = parseInt((_offset + markup.Margins[i].Left) * dKoef_mm_to_pix) + 0.5;
context.fillRect(5 + __x, this.m_nTop + 0.5, __r - __x, this.m_nBottom - this.m_nTop); context.fillRect(__x, this.m_nTop + 0.5, __r - __x, this.m_nBottom - this.m_nTop);
context.strokeRect(5 + __x, this.m_nTop + 0.5, __r - __x, this.m_nBottom - this.m_nTop); context.strokeRect(__x, this.m_nTop + 0.5, __r - __x, this.m_nBottom - this.m_nTop);
context.putImageData(this.tableSprite, parseInt(2.5 + _offset * dKoef_mm_to_pix), this.m_nBottom - 10);
if (!this.IsRetina)
context.putImageData(this.tableSprite, __xID, __yID);
else
context.putImageData(this.tableSprite, __xID, __yID);
_offset += markup.Cols[i]; _offset += markup.Cols[i];
} }
} }
...@@ -1328,6 +1462,8 @@ function CHorRuler() ...@@ -1328,6 +1462,8 @@ function CHorRuler()
checker.BlitAttack = false; checker.BlitAttack = false;
htmlElement.width = htmlElement.width; htmlElement.width = htmlElement.width;
var context = htmlElement.getContext('2d'); var context = htmlElement.getContext('2d');
context.setTransform(1, 0, 0, 1, 0, 0);
if (null != this.m_oCanvas) if (null != this.m_oCanvas)
{ {
checker.BlitLeft = left; checker.BlitLeft = left;
...@@ -1349,8 +1485,17 @@ function CHorRuler() ...@@ -1349,8 +1485,17 @@ function CHorRuler()
//context.drawImage(this.m_oCanvas, left - 5, 0, this.m_oCanvas.width, this.m_oCanvas.height, //context.drawImage(this.m_oCanvas, left - 5, 0, this.m_oCanvas.width, this.m_oCanvas.height,
// 0, 0, this.m_oCanvas.width, this.m_oCanvas.height); // 0, 0, this.m_oCanvas.width, this.m_oCanvas.height);
if (!this.IsRetina)
{
context.drawImage(this.m_oCanvas, 0, 0, this.m_oCanvas.width, this.m_oCanvas.height, context.drawImage(this.m_oCanvas, 0, 0, this.m_oCanvas.width, this.m_oCanvas.height,
left - 5, 0, this.m_oCanvas.width, this.m_oCanvas.height); left - 5, 0, this.m_oCanvas.width, this.m_oCanvas.height);
}
else
{
context.drawImage(this.m_oCanvas, 0, 0, this.m_oCanvas.width, this.m_oCanvas.height,
(left - 5) << 1, 0, this.m_oCanvas.width, this.m_oCanvas.height);
context.setTransform(2, 0, 0, 2, 0, 0);
}
if (!this.IsDrawAnyMarkers) if (!this.IsDrawAnyMarkers)
return; return;
...@@ -1673,18 +1818,30 @@ function CVerRuler() ...@@ -1673,18 +1818,30 @@ function CVerRuler()
this.IsCanMoveMargins = true; this.IsCanMoveMargins = true;
this.m_oWordControl = null; this.m_oWordControl = null;
this.IsRetina = false;
this.CheckCanvas = function() this.CheckCanvas = function()
{ {
this.m_dZoom = this.m_oWordControl.m_nZoomValue / 100; this.m_dZoom = this.m_oWordControl.m_nZoomValue / 100;
this.IsRetina = this.m_oWordControl.bIsRetinaSupport;
var dKoef_mm_to_pix = g_dKoef_mm_to_pix * this.m_dZoom; var dKoef_mm_to_pix = g_dKoef_mm_to_pix * this.m_dZoom;
if (this.IsRetina)
dKoef_mm_to_pix *= 2;
var heightNew = dKoef_mm_to_pix * this.m_oPage.height_mm; var heightNew = dKoef_mm_to_pix * this.m_oPage.height_mm;
var _height = 10 + heightNew; var _height = 10 + heightNew;
if (this.IsRetina)
_height += 10;
var _width = 5 * g_dKoef_mm_to_pix; var _width = 5 * g_dKoef_mm_to_pix;
var intW = parseInt(_width); if (this.IsRetina)
var intH = parseInt(_height); _width *= 2;
var intW = _width >> 0;
var intH = _height >> 0;
if (null == this.m_oCanvas) if (null == this.m_oCanvas)
{ {
this.m_oCanvas = document.createElement('canvas'); this.m_oCanvas = document.createElement('canvas');
...@@ -1715,6 +1872,9 @@ function CVerRuler() ...@@ -1715,6 +1872,9 @@ function CVerRuler()
this.m_oPage = cachedPage; this.m_oPage = cachedPage;
var height = this.CheckCanvas(); var height = this.CheckCanvas();
if (this.IsRetina)
height >>= 1;
if (0 == this.DragType) if (0 == this.DragType)
{ {
this.m_dMarginTop = cachedPage.margin_top; this.m_dMarginTop = cachedPage.margin_top;
...@@ -1777,6 +1937,10 @@ function CVerRuler() ...@@ -1777,6 +1937,10 @@ function CVerRuler()
this.m_nRight = parseInt(4.2 * g_dKoef_mm_to_pix); this.m_nRight = parseInt(4.2 * g_dKoef_mm_to_pix);
var context = this.m_oCanvas.getContext('2d'); var context = this.m_oCanvas.getContext('2d');
if (!this.IsRetina)
context.setTransform(1, 0, 0, 1, 0, 5);
else
context.setTransform(2, 0, 0, 2, 0, 10);
context.fillStyle = "#B0B0B0"; context.fillStyle = "#B0B0B0";
context.fillRect(0, 0, this.m_oCanvas.width, this.m_oCanvas.height); context.fillRect(0, 0, this.m_oCanvas.width, this.m_oCanvas.height);
...@@ -1829,7 +1993,7 @@ function CVerRuler() ...@@ -1829,7 +1993,7 @@ function CVerRuler()
if (bottom_margin > top_margin) if (bottom_margin > top_margin)
{ {
context.fillStyle = "#EDEDED"; context.fillStyle = "#EDEDED";
context.fillRect(this.m_nLeft + 0.5, 5 + top_margin + 0.5, this.m_nRight - this.m_nLeft, bottom_margin - top_margin); context.fillRect(this.m_nLeft + 0.5, top_margin + 0.5, this.m_nRight - this.m_nLeft, bottom_margin - top_margin);
} }
var intH = parseInt(height); var intH = parseInt(height);
...@@ -1838,13 +2002,13 @@ function CVerRuler() ...@@ -1838,13 +2002,13 @@ function CVerRuler()
context.strokeStyle = "#929292"; context.strokeStyle = "#929292";
context.lineWidth = 1; context.lineWidth = 1;
context.strokeRect(this.m_nLeft + 0.5, 5 + 0.5, this.m_nRight - this.m_nLeft, intH); context.strokeRect(this.m_nLeft + 0.5, 0.5, this.m_nRight - this.m_nLeft, intH);
context.beginPath(); context.beginPath();
context.moveTo(this.m_nLeft + 0.5, 5 + top_margin + 0.5); context.moveTo(this.m_nLeft + 0.5, top_margin + 0.5);
context.lineTo(this.m_nRight - 0.5, 5 + top_margin + 0.5); context.lineTo(this.m_nRight - 0.5, top_margin + 0.5);
context.moveTo(this.m_nLeft + 0.5, 5 + bottom_margin + 0.5); context.moveTo(this.m_nLeft + 0.5, bottom_margin + 0.5);
context.lineTo(this.m_nRight - 0.5, 5 + bottom_margin + 0.5); context.lineTo(this.m_nRight - 0.5, bottom_margin + 0.5);
context.stroke(); context.stroke();
context.beginPath(); context.beginPath();
...@@ -1866,7 +2030,7 @@ function CVerRuler() ...@@ -1866,7 +2030,7 @@ function CVerRuler()
var num = 0; var num = 0;
for (var i = 1; i < lCount1; i++) for (var i = 1; i < lCount1; i++)
{ {
var lYPos = parseInt(5 + top_margin + i * mm_1_4) + 0.5; var lYPos = parseInt(top_margin + i * mm_1_4) + 0.5;
index++; index++;
if (index == 4) if (index == 4)
...@@ -1882,16 +2046,12 @@ function CVerRuler() ...@@ -1882,16 +2046,12 @@ function CVerRuler()
context.translate(middleHor, lYPos); context.translate(middleHor, lYPos);
context.rotate(-Math.PI / 2); context.rotate(-Math.PI / 2);
context.fillText(strNum, -lWidthText / 2.0, 4); context.fillText(strNum, -lWidthText / 2.0, 4);
context.setTransform(1,0,0,1,0,0);
/* if (!this.IsRetina)
var strNum = "" + num; context.setTransform(1, 0, 0, 1, 0, 5);
var lWidthText = context.measureText(strNum).width; else
lXPos -= (lWidthText / 2.0); context.setTransform(2, 0, 0, 2, 0, 10);
context.fillText(strNum, lXPos, this.m_nBottom - 3);
*/
} }
else if (1 == index) else if (1 == index)
{ {
...@@ -1923,7 +2083,7 @@ function CVerRuler() ...@@ -1923,7 +2083,7 @@ function CVerRuler()
num = 0; num = 0;
for (var i = 1; i <= lCount2; i++) for (var i = 1; i <= lCount2; i++)
{ {
var lYPos = parseInt(5 + top_margin - i * mm_1_4) + 0.5; var lYPos = parseInt(top_margin - i * mm_1_4) + 0.5;
index++; index++;
if (index == 4) if (index == 4)
...@@ -1933,21 +2093,17 @@ function CVerRuler() ...@@ -1933,21 +2093,17 @@ function CVerRuler()
{ {
num++; num++;
// number // number
/*
var strNum = "" + num;
var lWidthText = context.measureText(strNum).width;
lXPos -= (lWidthText / 2.0);
context.fillText(strNum, lXPos, this.m_nBottom - 3);
*/
var strNum = "" + num; var strNum = "" + num;
var lWidthText = context.measureText(strNum).width; var lWidthText = context.measureText(strNum).width;
context.translate(middleHor, lYPos); context.translate(middleHor, lYPos);
context.rotate(-Math.PI / 2); context.rotate(-Math.PI / 2);
context.fillText(strNum, -lWidthText / 2.0, 4); context.fillText(strNum, -lWidthText / 2.0, 4);
context.setTransform(1,0,0,1,0,0);
if (!this.IsRetina)
context.setTransform(1, 0, 0, 1, 0, 5);
else
context.setTransform(2, 0, 0, 2, 0, 10);
} }
else if (1 == index) else if (1 == index)
{ {
...@@ -1996,8 +2152,8 @@ function CVerRuler() ...@@ -1996,8 +2152,8 @@ function CVerRuler()
for (var i = 1; i < _count; i++) for (var i = 1; i < _count; i++)
{ {
end_dark = parseInt(markup.Rows[i].Y * dKoef_mm_to_pix) + 0.5; end_dark = parseInt(markup.Rows[i].Y * dKoef_mm_to_pix) + 0.5;
context.fillRect(_x, 5 + start_dark, _w, Math.max(end_dark - start_dark, 7)); context.fillRect(_x, start_dark, _w, Math.max(end_dark - start_dark, 7));
context.strokeRect(_x, 5 + start_dark, _w, Math.max(end_dark - start_dark, 7)); context.strokeRect(_x, start_dark, _w, Math.max(end_dark - start_dark, 7));
start_dark = parseInt((markup.Rows[i].Y + markup.Rows[i].H) * dKoef_mm_to_pix) + 0.5; start_dark = parseInt((markup.Rows[i].Y + markup.Rows[i].H) * dKoef_mm_to_pix) + 0.5;
} }
...@@ -2385,11 +2541,17 @@ function CVerRuler() ...@@ -2385,11 +2541,17 @@ function CVerRuler()
htmlElement.width = htmlElement.width; htmlElement.width = htmlElement.width;
var context = htmlElement.getContext('2d'); var context = htmlElement.getContext('2d');
if (null != this.m_oCanvas)
if (!this.IsRetina && null != this.m_oCanvas)
{ {
context.drawImage(this.m_oCanvas, 0, 0, this.m_oCanvas.width, this.m_oCanvas.height, context.drawImage(this.m_oCanvas, 0, 0, this.m_oCanvas.width, this.m_oCanvas.height,
0, top - 5, this.m_oCanvas.width, this.m_oCanvas.height); 0, top - 5, this.m_oCanvas.width, this.m_oCanvas.height);
} }
else
{
context.drawImage(this.m_oCanvas, 0, 0, this.m_oCanvas.width, this.m_oCanvas.height,
0, (top - 5) << 1, this.m_oCanvas.width, this.m_oCanvas.height);
}
} }
// выставление параметров логическому документу // выставление параметров логическому документу
......
...@@ -449,6 +449,7 @@ CStylesPainter.prototype.get_DocStylesImage = function() { return this.docStyles ...@@ -449,6 +449,7 @@ CStylesPainter.prototype.get_DocStylesImage = function() { return this.docStyles
CStylesPainter.prototype.get_MergedStyles = function() { return this.mergedStyles; } CStylesPainter.prototype.get_MergedStyles = function() { return this.mergedStyles; }
CStylesPainter.prototype.get_STYLE_THUMBNAIL_WIDTH = function() { return this.STYLE_THUMBNAIL_WIDTH; } CStylesPainter.prototype.get_STYLE_THUMBNAIL_WIDTH = function() { return this.STYLE_THUMBNAIL_WIDTH; }
CStylesPainter.prototype.get_STYLE_THUMBNAIL_HEIGHT = function() { return this.STYLE_THUMBNAIL_HEIGHT; } CStylesPainter.prototype.get_STYLE_THUMBNAIL_HEIGHT = function() { return this.STYLE_THUMBNAIL_HEIGHT; }
CStylesPainter.prototype.get_IsRetinaEnabled = function() { return this.IsRetinaEnabled; }
CStyleImage.prototype.get_ThumbnailOffset = function() { return this.ThumbnailOffset; } CStyleImage.prototype.get_ThumbnailOffset = function() { return this.ThumbnailOffset; }
CStyleImage.prototype.get_Type = function() { return this.Type; } CStyleImage.prototype.get_Type = function() { return this.Type; }
...@@ -3242,8 +3243,8 @@ asc_docs_api.prototype.sync_InitEditorStyles = function(styles_painter){ ...@@ -3242,8 +3243,8 @@ asc_docs_api.prototype.sync_InitEditorStyles = function(styles_painter){
if (ret) if (ret)
this._gui_styles = null; this._gui_styles = null;
} }
asc_docs_api.prototype.sync_InitEditorTableStyles = function(styles){ asc_docs_api.prototype.sync_InitEditorTableStyles = function(styles, is_retina_enabled){
this.asc_fireCallback("asc_onInitTableTemplates",styles); this.asc_fireCallback("asc_onInitTableTemplates",styles, is_retina_enabled);
} }
......
...@@ -924,8 +924,16 @@ function GenerateTableStyles(drawingDoc, logicDoc, tableLook) ...@@ -924,8 +924,16 @@ function GenerateTableStyles(drawingDoc, logicDoc, tableLook)
Grid[i] = W / Cols; Grid[i] = W / Cols;
var _canvas = document.createElement('canvas'); var _canvas = document.createElement('canvas');
if (!this.m_oWordControl.bIsRetinaSupport)
{
_canvas.width = TABLE_STYLE_WIDTH_PIX; _canvas.width = TABLE_STYLE_WIDTH_PIX;
_canvas.height = TABLE_STYLE_HEIGHT_PIX; _canvas.height = TABLE_STYLE_HEIGHT_PIX;
}
else
{
_canvas.width = (TABLE_STYLE_WIDTH_PIX << 1);
_canvas.height = (TABLE_STYLE_HEIGHT_PIX << 1);
}
var ctx = _canvas.getContext('2d'); var ctx = _canvas.getContext('2d');
History.TurnOff(); History.TurnOff();
......
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