Commit e30a886f authored by Alexey.Musinov's avatar Alexey.Musinov

native fix

parent c488fae3
...@@ -1168,7 +1168,7 @@ Path.prototype = { ...@@ -1168,7 +1168,7 @@ Path.prototype = {
if (!isLine) if (!isLine)
isRect = this.isSmartRect(); isRect = this.isSmartRect();
if (!isLine && !isRect) if (window["NATIVE_EDITOR_ENJINE"] || ( !isLine && !isRect))
return this.draw(shape_drawer); return this.draw(shape_drawer);
var _old_int = _graphics.m_bIntegerGrid; var _old_int = _graphics.m_bIntegerGrid;
...@@ -1872,7 +1872,7 @@ Path.prototype = { ...@@ -1872,7 +1872,7 @@ Path.prototype = {
if (!isLine) if (!isLine)
isRect = this.isSmartRect(); isRect = this.isSmartRect();
if (!isLine && !isRect) if (window["NATIVE_EDITOR_ENJINE"] || ( !isLine && !isRect))
return this.draw(shape_drawer); return this.draw(shape_drawer);
var _old_int = _graphics.m_bIntegerGrid; var _old_int = _graphics.m_bIntegerGrid;
......
...@@ -238,148 +238,6 @@ Asc['asc_docs_api'].prototype.GenerateNativeStyles = function() ...@@ -238,148 +238,6 @@ Asc['asc_docs_api'].prototype.GenerateNativeStyles = function()
StylesPainter.GenerateStyles(this, this.LoadedObjectDS); StylesPainter.GenerateStyles(this, this.LoadedObjectDS);
}; };
window['AscFormat'].Path.prototype.drawSmart = function(shape_drawer) {
var _graphics = shape_drawer.Graphics;
var _full_trans = _graphics.m_oFullTransform;
if (!_graphics || !_full_trans || undefined == _graphics.m_bIntegerGrid || true === shape_drawer.bIsNoSmartAttack)
return this.draw(shape_drawer);
var bIsTransformed = (_full_trans.shx == 0 && _full_trans.shy == 0) ? false : true;
if (bIsTransformed)
return this.draw(shape_drawer);
var isLine = this.isSmartLine();
var isRect = false;
if (!isLine)
isRect = this.isSmartRect();
//if (!isLine && !isRect) // IOS убрать
return this.draw(shape_drawer);
var _old_int = _graphics.m_bIntegerGrid;
if (false == _old_int)
_graphics.SetIntegerGrid(true);
var dKoefMMToPx = Math.max(_graphics.m_oCoordTransform.sx, 0.001);
var _ctx = _graphics.m_oContext;
var bIsStroke = (shape_drawer.bIsNoStrokeAttack || (this.stroke !== true)) ? false : true;
var bIsEven = false;
if (bIsStroke)
{
var _lineWidth = Math.max((shape_drawer.StrokeWidth * dKoefMMToPx + 0.5) >> 0, 1);
_ctx.lineWidth = _lineWidth;
if (_lineWidth & 0x01 == 0x01)
bIsEven = true;
}
var bIsDrawLast = false;
var path = this.ArrPathCommand;
shape_drawer._s();
if (!isRect)
{
for(var j = 0, l = path.length; j < l; ++j)
{
var cmd=path[j];
switch(cmd.id)
{
case AscFormat.moveTo:
{
bIsDrawLast = true;
var _x = (_full_trans.TransformPointX(cmd.X, cmd.Y)) >> 0;
var _y = (_full_trans.TransformPointY(cmd.X, cmd.Y)) >> 0;
if (bIsEven)
{
_x -= 0.5;
_y -= 0.5;
}
_ctx.moveTo(_x, _y);
break;
}
case AscFormat.lineTo:
{
bIsDrawLast = true;
var _x = (_full_trans.TransformPointX(cmd.X, cmd.Y)) >> 0;
var _y = (_full_trans.TransformPointY(cmd.X, cmd.Y)) >> 0;
if (bIsEven)
{
_x -= 0.5;
_y -= 0.5;
}
_ctx.lineTo(_x, _y);
break;
}
case AscFormat.close:
{
_ctx.closePath();
break;
}
}
}
}
else
{
var minX = 100000;
var minY = 100000;
var maxX = -100000;
var maxY = -100000;
bIsDrawLast = true;
for(var j = 0, l = path.length; j < l; ++j)
{
var cmd=path[j];
switch(cmd.id)
{
case AscFormat.moveTo:
case AscFormat.lineTo:
{
if (minX > cmd.X)
minX = cmd.X;
if (minY > cmd.Y)
minY = cmd.Y;
if (maxX < cmd.X)
maxX = cmd.X;
if (maxY < cmd.Y)
maxY = cmd.Y;
break;
}
default:
break;
}
}
var _x1 = (_full_trans.TransformPointX(minX, minY)) >> 0;
var _y1 = (_full_trans.TransformPointY(minX, minY)) >> 0;
var _x2 = (_full_trans.TransformPointX(maxX, maxY)) >> 0;
var _y2 = (_full_trans.TransformPointY(maxX, maxY)) >> 0;
if (bIsEven)
_ctx.rect(_x1 + 0.5, _y1 + 0.5, _x2 - _x1, _y2 - _y1);
else
_ctx.rect(_x1, _y1, _x2 - _x1, _y2 - _y1);
}
if (bIsDrawLast)
{
shape_drawer.drawFillStroke(true, this.fill, bIsStroke);
}
shape_drawer._e();
if (false == _old_int)
_graphics.SetIntegerGrid(false);
};
// TEXTFONTFAMILY // TEXTFONTFAMILY
function asc_menu_ReadFontFamily(_params, _cursor) function asc_menu_ReadFontFamily(_params, _cursor)
{ {
......
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