Commit 6ff0a861 authored by Alexey.Musinov's avatar Alexey.Musinov Committed by Alexander.Trofimov

[mobile] обновление скриптов (Bug 32016, Bug 32015)

parent 68b4e9ee
window.IsShapeToImageConverter = false; window.IsShapeToImageConverter = false;
function DrawLineEnd(xEnd, yEnd, xPrev, yPrev, type, w, len, drawer, trans) function DrawLineEnd(xEnd, yEnd, xPrev, yPrev, type, w, len, drawer, trans)
{ {
switch (type) switch (type)
...@@ -416,7 +416,6 @@ function CShapeDrawer() ...@@ -416,7 +416,6 @@ function CShapeDrawer()
{ {
this.Shape = null; this.Shape = null;
this.Graphics = null; this.Graphics = null;
this.NativeGraphics = null;
this.UniFill = null; this.UniFill = null;
this.Ln = null; this.Ln = null;
this.Transform = null; this.Transform = null;
...@@ -433,7 +432,12 @@ function CShapeDrawer() ...@@ -433,7 +432,12 @@ function CShapeDrawer()
this.max_x = -0xFFFF; this.max_x = -0xFFFF;
this.max_y = -0xFFFF; this.max_y = -0xFFFF;
this.OldLineJoin = null;
this.IsArrowsDrawing = false;
this.IsCurrentPathCanArrows = true;
this.bIsCheckBounds = false; this.bIsCheckBounds = false;
this.IsRectShape = false; this.IsRectShape = false;
} }
...@@ -459,7 +463,12 @@ CShapeDrawer.prototype = ...@@ -459,7 +463,12 @@ CShapeDrawer.prototype =
this.max_x = -0xFFFF; this.max_x = -0xFFFF;
this.max_y = -0xFFFF; this.max_y = -0xFFFF;
this.OldLineJoin = null;
this.IsArrowsDrawing = false;
this.IsCurrentPathCanArrows = true;
this.bIsCheckBounds = false; this.bIsCheckBounds = false;
this.IsRectShape = false; this.IsRectShape = false;
}, },
...@@ -607,8 +616,21 @@ CShapeDrawer.prototype = ...@@ -607,8 +616,21 @@ CShapeDrawer.prototype =
this.StrokeWidth = (this.Ln.w == null) ? 12700 : parseInt(this.Ln.w); this.StrokeWidth = (this.Ln.w == null) ? 12700 : parseInt(this.Ln.w);
this.StrokeWidth /= 36000.0; this.StrokeWidth /= 36000.0;
this.p_width(1000 * this.StrokeWidth);
if (graphics.IsSlideBoundsCheckerType && !this.bIsNoStrokeAttack) if (graphics.IsSlideBoundsCheckerType && !this.bIsNoStrokeAttack)
graphics.LineWidth = this.StrokeWidth; graphics.LineWidth = this.StrokeWidth;
if ((this.Ln.headEnd != null && this.Ln.headEnd.type != null) || (this.Ln.tailEnd != null && this.Ln.tailEnd.type != null))
{
if (true === graphics.IsTrack)
graphics.Graphics.ArrayPoints = [];
else
graphics.ArrayPoints = [];
}
if (this.Graphics.m_oContext != null && this.Ln.Join != null && this.Ln.Join.type != null)
this.OldLineJoin = this.Graphics.m_oContext.lineJoin;
} }
if (this.bIsTexture || bIsCheckBounds) if (this.bIsTexture || bIsCheckBounds)
...@@ -780,6 +802,9 @@ CShapeDrawer.prototype = ...@@ -780,6 +802,9 @@ CShapeDrawer.prototype =
if (mode == "none" || this.bIsNoFillAttack) if (mode == "none" || this.bIsNoFillAttack)
return; return;
if (this.Graphics.IsTrack)
this.Graphics.m_oOverlay.ClearAll = true;
if (this.Graphics.IsSlideBoundsCheckerType) if (this.Graphics.IsSlideBoundsCheckerType)
return; return;
...@@ -942,6 +967,119 @@ CShapeDrawer.prototype = ...@@ -942,6 +967,119 @@ CShapeDrawer.prototype =
this.NativeGraphics["PD_p_color"](rgba.R, rgba.G, rgba.B, rgba.A); this.NativeGraphics["PD_p_color"](rgba.R, rgba.G, rgba.B, rgba.A);
this.NativeGraphics["PD_Stroke"](); this.NativeGraphics["PD_Stroke"]();
if (this.IsRectShape && this.Graphics.AddSmartRect !== undefined)
{
if (undefined !== this.Shape.extX)
this.Graphics.AddSmartRect(0, 0, this.Shape.extX, this.Shape.extY, this.StrokeWidth);
else
this.Graphics.ds();
}
else
{
this.Graphics.ds();
}
if (null != this.OldLineJoin && !this.IsArrowsDrawing)
{
this.Graphics.m_oContext.lineJoin = this.OldLineJoin;
}
var arr = (this.Graphics.IsTrack === true) ? this.Graphics.Graphics.ArrayPoints : this.Graphics.ArrayPoints;
if (arr != null && arr.length > 1 && this.IsCurrentPathCanArrows === true)
{
this.IsArrowsDrawing = true;
// значит стрелки есть. теперь:
// определяем толщину линии "как есть"
// трансформируем точки в окончательные.
// и отправляем на отрисовку (с матрицей)
var trans = (this.Graphics.IsTrack === true) ? this.Graphics.Graphics.m_oFullTransform : this.Graphics.m_oFullTransform;
var trans1 = global_MatrixTransformer.Invert(trans);
var x1 = trans.TransformPointX(0, 0);
var y1 = trans.TransformPointY(0, 0);
var x2 = trans.TransformPointX(1, 1);
var y2 = trans.TransformPointY(1, 1);
var dKoef = Math.sqrt(((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1))/2);
var _pen_w = (this.Graphics.IsTrack === true) ? (this.Graphics.Graphics.m_oContext.lineWidth * dKoef) : (this.Graphics.m_oContext.lineWidth * dKoef);
var _max_delta_eps2 = 0.001;
if (this.Ln.headEnd != null)
{
var _x1 = trans.TransformPointX(arr[0].x, arr[0].y);
var _y1 = trans.TransformPointY(arr[0].x, arr[0].y);
var _x2 = trans.TransformPointX(arr[1].x, arr[1].y);
var _y2 = trans.TransformPointY(arr[1].x, arr[1].y);
var _max_delta_eps = Math.max(this.Ln.headEnd.GetLen(_pen_w), 5);
var _max_delta = Math.max(Math.abs(_x1 - _x2), Math.abs(_y1 - _y2));
var cur_point = 2;
while (_max_delta < _max_delta_eps && cur_point < arr.length)
{
_x2 = trans.TransformPointX(arr[cur_point].x, arr[cur_point].y);
_y2 = trans.TransformPointY(arr[cur_point].x, arr[cur_point].y);
_max_delta = Math.max(Math.abs(_x1 - _x2), Math.abs(_y1 - _y2));
cur_point++;
}
if (_max_delta > _max_delta_eps2)
{
if (this.Graphics.IsTrack)
{
this.Graphics.Graphics.ArrayPoints = null;
DrawLineEnd(_x1, _y1, _x2, _y2, this.Ln.headEnd.type, this.Ln.headEnd.GetWidth(_pen_w), this.Ln.headEnd.GetLen(_pen_w), this, trans1);
this.Graphics.Graphics.ArrayPoints = arr;
}
else
{
this.Graphics.ArrayPoints = null;
DrawLineEnd(_x1, _y1, _x2, _y2, this.Ln.headEnd.type, this.Ln.headEnd.GetWidth(_pen_w), this.Ln.headEnd.GetLen(_pen_w), this, trans1);
this.Graphics.ArrayPoints = arr;
}
}
}
if (this.Ln.tailEnd != null)
{
var _1 = arr.length-1;
var _2 = arr.length-2;
var _x1 = trans.TransformPointX(arr[_1].x, arr[_1].y);
var _y1 = trans.TransformPointY(arr[_1].x, arr[_1].y);
var _x2 = trans.TransformPointX(arr[_2].x, arr[_2].y);
var _y2 = trans.TransformPointY(arr[_2].x, arr[_2].y);
var _max_delta_eps = Math.max(this.Ln.tailEnd.GetLen(_pen_w), 5);
var _max_delta = Math.max(Math.abs(_x1 - _x2), Math.abs(_y1 - _y2));
var cur_point = _2 - 1;
while (_max_delta < _max_delta_eps && cur_point >= 0)
{
_x2 = trans.TransformPointX(arr[cur_point].x, arr[cur_point].y);
_y2 = trans.TransformPointY(arr[cur_point].x, arr[cur_point].y);
_max_delta = Math.max(Math.abs(_x1 - _x2), Math.abs(_y1 - _y2));
cur_point--;
}
if (_max_delta > _max_delta_eps2)
{
if (this.Graphics.IsTrack)
{
this.Graphics.Graphics.ArrayPoints = null;
DrawLineEnd(_x1, _y1, _x2, _y2, this.Ln.tailEnd.type, this.Ln.tailEnd.GetWidth(_pen_w), this.Ln.tailEnd.GetLen(_pen_w), this, trans1);
this.Graphics.Graphics.ArrayPoints = arr;
}
else
{
this.Graphics.ArrayPoints = null;
DrawLineEnd(_x1, _y1, _x2, _y2, this.Ln.tailEnd.type, this.Ln.tailEnd.GetWidth(_pen_w), this.Ln.tailEnd.GetLen(_pen_w), this, trans1);
this.Graphics.ArrayPoints = arr;
}
}
}
this.IsArrowsDrawing = false;
}
}, },
drawFillStroke : function(bIsFill, fill_mode, bIsStroke) drawFillStroke : function(bIsFill, fill_mode, bIsStroke)
......
...@@ -605,6 +605,7 @@ CGraphics.prototype = ...@@ -605,6 +605,7 @@ CGraphics.prototype =
if (0 != this.m_oPen.LineWidth) if (0 != this.m_oPen.LineWidth)
{ {
this.Native["PD_p_width"](this.m_oPen.LineWidth); this.Native["PD_p_width"](this.m_oPen.LineWidth);
this.m_oContext.lineWidth = this.m_oPen.LineWidth;
} }
else else
{ {
...@@ -615,6 +616,7 @@ CGraphics.prototype = ...@@ -615,6 +616,7 @@ CGraphics.prototype =
var _koef = Math.sqrt(((_x2 - _x1)*(_x2 - _x1) + (_y2 - _y1)*(_y2 - _y1)) / 2); var _koef = Math.sqrt(((_x2 - _x1)*(_x2 - _x1) + (_y2 - _y1)*(_y2 - _y1)) / 2);
this.Native["PD_p_width"](1 / _koef); this.Native["PD_p_width"](1 / _koef);
this.m_oContext.lineWidth = 1 / _koef;
} }
} }
else else
...@@ -627,10 +629,12 @@ CGraphics.prototype = ...@@ -627,10 +629,12 @@ CGraphics.prototype =
var koef = Math.sqrt((x * x + y * y) / 2); var koef = Math.sqrt((x * x + y * y) / 2);
this.Native["PD_p_width"](this.m_oPen.LineWidth * koef); this.Native["PD_p_width"](this.m_oPen.LineWidth * koef);
this.m_oContext.lineWidth = this.m_oPen.LineWidth * koef;
} }
else else
{ {
this.Native["PD_p_width"](1); this.Native["PD_p_width"](1);
this.m_oContext.lineWidth = 1;
} }
} }
}, },
......
window.IsShapeToImageConverter = false; window.IsShapeToImageConverter = false;
function DrawLineEnd(xEnd, yEnd, xPrev, yPrev, type, w, len, drawer, trans) function DrawLineEnd(xEnd, yEnd, xPrev, yPrev, type, w, len, drawer, trans)
{ {
switch (type) switch (type)
...@@ -939,10 +939,123 @@ CShapeDrawer.prototype = ...@@ -939,10 +939,123 @@ CShapeDrawer.prototype =
} }
var rgba = this.StrokeUniColor; var rgba = this.StrokeUniColor;
this.NativeGraphics["PD_p_width"](this.StrokeWidth); this.NativeGraphics["PD_p_width"](this.StrokeWidth);
this.NativeGraphics["PD_p_color"](rgba.R, rgba.G, rgba.B, rgba.A); this.NativeGraphics["PD_p_color"](rgba.R, rgba.G, rgba.B, rgba.A);
this.NativeGraphics["PD_Stroke"](); this.NativeGraphics["PD_Stroke"]();
if (this.IsRectShape && this.Graphics.AddSmartRect !== undefined)
{
// if (undefined !== this.Shape.extX)
// this.Graphics.AddSmartRect(0, 0, this.Shape.extX, this.Shape.extY, this.StrokeWidth);
// else
// this.Graphics.ds();
}
else
{
// this.Graphics.ds();
}
if (null != this.OldLineJoin && !this.IsArrowsDrawing)
{
this.Graphics.m_oContext.lineJoin = this.OldLineJoin;
}
var arr = (this.Graphics.IsTrack === true) ? this.Graphics.Graphics.ArrayPoints : this.Graphics.ArrayPoints;
if (arr != null && arr.length > 1 && this.IsCurrentPathCanArrows === true)
{
this.IsArrowsDrawing = true;
// значит стрелки есть. теперь:
// определяем толщину линии "как есть"
// трансформируем точки в окончательные.
// и отправляем на отрисовку (с матрицей)
var trans = (this.Graphics.IsTrack === true) ? this.Graphics.Graphics.m_oFullTransform : this.Graphics.m_oFullTransform;
var trans1 = global_MatrixTransformer.Invert(trans);
var x1 = trans.TransformPointX(0, 0);
var y1 = trans.TransformPointY(0, 0);
var x2 = trans.TransformPointX(1, 1);
var y2 = trans.TransformPointY(1, 1);
var dKoef = Math.sqrt(((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1))/2);
var _pen_w = (this.Graphics.IsTrack === true) ? (this.Graphics.Graphics.m_oContext.lineWidth * dKoef) : (this.Graphics.m_oContext.lineWidth * dKoef);
var _max_delta_eps2 = 0.001;
if (this.Ln.headEnd != null)
{
var _x1 = trans.TransformPointX(arr[0].x, arr[0].y);
var _y1 = trans.TransformPointY(arr[0].x, arr[0].y);
var _x2 = trans.TransformPointX(arr[1].x, arr[1].y);
var _y2 = trans.TransformPointY(arr[1].x, arr[1].y);
var _max_delta_eps = Math.max(this.Ln.headEnd.GetLen(_pen_w), 5);
var _max_delta = Math.max(Math.abs(_x1 - _x2), Math.abs(_y1 - _y2));
var cur_point = 2;
while (_max_delta < _max_delta_eps && cur_point < arr.length)
{
_x2 = trans.TransformPointX(arr[cur_point].x, arr[cur_point].y);
_y2 = trans.TransformPointY(arr[cur_point].x, arr[cur_point].y);
_max_delta = Math.max(Math.abs(_x1 - _x2), Math.abs(_y1 - _y2));
cur_point++;
}
if (_max_delta > _max_delta_eps2)
{
if (this.Graphics.IsTrack)
{
this.Graphics.Graphics.ArrayPoints = null;
DrawLineEnd(_x1, _y1, _x2, _y2, this.Ln.headEnd.type, this.Ln.headEnd.GetWidth(_pen_w), this.Ln.headEnd.GetLen(_pen_w), this, trans1);
this.Graphics.Graphics.ArrayPoints = arr;
}
else
{
this.Graphics.ArrayPoints = null;
DrawLineEnd(_x1, _y1, _x2, _y2, this.Ln.headEnd.type, this.Ln.headEnd.GetWidth(_pen_w), this.Ln.headEnd.GetLen(_pen_w), this, trans1);
this.Graphics.ArrayPoints = arr;
}
}
}
if (this.Ln.tailEnd != null)
{
var _1 = arr.length-1;
var _2 = arr.length-2;
var _x1 = trans.TransformPointX(arr[_1].x, arr[_1].y);
var _y1 = trans.TransformPointY(arr[_1].x, arr[_1].y);
var _x2 = trans.TransformPointX(arr[_2].x, arr[_2].y);
var _y2 = trans.TransformPointY(arr[_2].x, arr[_2].y);
var _max_delta_eps = Math.max(this.Ln.tailEnd.GetLen(_pen_w), 5);
var _max_delta = Math.max(Math.abs(_x1 - _x2), Math.abs(_y1 - _y2));
var cur_point = _2 - 1;
while (_max_delta < _max_delta_eps && cur_point >= 0)
{
_x2 = trans.TransformPointX(arr[cur_point].x, arr[cur_point].y);
_y2 = trans.TransformPointY(arr[cur_point].x, arr[cur_point].y);
_max_delta = Math.max(Math.abs(_x1 - _x2), Math.abs(_y1 - _y2));
cur_point--;
}
if (_max_delta > _max_delta_eps2)
{
if (this.Graphics.IsTrack)
{
this.Graphics.Graphics.ArrayPoints = null;
DrawLineEnd(_x1, _y1, _x2, _y2, this.Ln.tailEnd.type, this.Ln.tailEnd.GetWidth(_pen_w), this.Ln.tailEnd.GetLen(_pen_w), this, trans1);
this.Graphics.Graphics.ArrayPoints = arr;
}
else
{
this.Graphics.ArrayPoints = null;
DrawLineEnd(_x1, _y1, _x2, _y2, this.Ln.tailEnd.type, this.Ln.tailEnd.GetWidth(_pen_w), this.Ln.tailEnd.GetLen(_pen_w), this, trans1);
this.Graphics.ArrayPoints = arr;
}
}
}
this.IsArrowsDrawing = false;
}
}, },
drawFillStroke : function(bIsFill, fill_mode, bIsStroke) drawFillStroke : function(bIsFill, fill_mode, bIsStroke)
......
...@@ -4004,10 +4004,10 @@ function OfflineEditor () { ...@@ -4004,10 +4004,10 @@ function OfflineEditor () {
var styleThumbnailWidth = Math.floor(92.0 * pxToMM); var styleThumbnailWidth = Math.floor(92.0 * pxToMM);
var styleThumbnailHeight = Math.floor(48.0 * pxToMM); var styleThumbnailHeight = Math.floor(48.0 * pxToMM);
asc.AutoFilters.prototype = Object.create (asc.AutoFilters.prototype); asc.WorkbookView.prototype = Object.create (asc.WorkbookView.prototype);
asc.AutoFilters.prototype.constructor = asc.AutoFilters; asc.WorkbookView.prototype.constructor = asc.WorkbookView;
asc.AutoFilters.prototype.getTablePictures = function(wb, fmgrGraphics, oFont) { asc.WorkbookView.prototype.af_getTablePictures = function(wb, fmgrGraphics, oFont) {
window['native'].SetStylesType(1); window['native'].SetStylesType(1);
...@@ -4030,14 +4030,14 @@ function OfflineEditor () { ...@@ -4030,14 +4030,14 @@ function OfflineEditor () {
if(customStyles[i].table) if(customStyles[i].table)
{ {
window['native'].BeginDrawDocumentStyle(customStyles[i].name, n); window['native'].BeginDrawDocumentStyle(customStyles[i].name, n);
this._drawSmallIconTable(canvas, customStyles[i], fmgrGraphics, oFont); this.af_getSmallIconTable(canvas, customStyles[i], fmgrGraphics, oFont);
// options = // options =
// { // {
// name: i, // name: i,
// displayName: customStyles[i].displayName, // displayName: customStyles[i].displayName,
// type: 'custom', // type: 'custom',
// image: this._drawSmallIconTable(canvas, customStyles[i], fmgrGraphics, oFont) // image: this.af_getSmallIconTable(canvas, customStyles[i], fmgrGraphics, oFont)
// }; // };
// result[n] = new formatTablePictures(options); // result[n] = new formatTablePictures(options);
...@@ -4055,14 +4055,14 @@ function OfflineEditor () { ...@@ -4055,14 +4055,14 @@ function OfflineEditor () {
if(defaultStyles[i].table) if(defaultStyles[i].table)
{ {
window['native'].BeginDrawDefaultStyle(defaultStyles[i].name, n); window['native'].BeginDrawDefaultStyle(defaultStyles[i].name, n);
this._drawSmallIconTable(canvas, defaultStyles[i], fmgrGraphics, oFont); this.af_getSmallIconTable(canvas, defaultStyles[i], fmgrGraphics, oFont);
// options = // options =
// { // {
// name: i, // name: i,
// displayName: defaultStyles[i].displayName, // displayName: defaultStyles[i].displayName,
// type: 'default', // type: 'default',
// image: this._drawSmallIconTable(canvas, defaultStyles[i], fmgrGraphics, oFont) // image: this.af_getSmallIconTable(canvas, defaultStyles[i], fmgrGraphics, oFont)
// }; // };
//result[n] = new formatTablePictures(options); //result[n] = new formatTablePictures(options);
n++; n++;
...@@ -4073,7 +4073,7 @@ function OfflineEditor () { ...@@ -4073,7 +4073,7 @@ function OfflineEditor () {
} }
return result; return result;
}; };
asc.AutoFilters.prototype._drawSmallIconTable = function(canvas, style, fmgrGraphics, oFont) { asc.WorkbookView.prototype.af_getSmallIconTable = function(canvas, style, fmgrGraphics, oFont) {
var ctx = new Asc.DrawingContext({canvas: canvas, units: 0/*pt*/, fmgrGraphics: fmgrGraphics, font: oFont}); var ctx = new Asc.DrawingContext({canvas: canvas, units: 0/*pt*/, fmgrGraphics: fmgrGraphics, font: oFont});
var styleOptions = style; var styleOptions = style;
...@@ -4578,12 +4578,20 @@ function offline_mouse_down(x, y, pin, isViewerMode, isFormulaEditMode, isRangeR ...@@ -4578,12 +4578,20 @@ function offline_mouse_down(x, y, pin, isViewerMode, isFormulaEditMode, isRangeR
ws.isChartAreaEditMode = false; ws.isChartAreaEditMode = false;
} }
window.AscAlwaysSaveAspectOnResizeTrack = true;
var ischart = false; var ischart = false;
var controller = ws.objectRender.controller; var controller = ws.objectRender.controller;
var selected_objects = controller.selection.groupSelection ? controller.selection.groupSelection.selectedObjects : controller.selectedObjects; var selected_objects = controller.selection.groupSelection ? controller.selection.groupSelection.selectedObjects : controller.selectedObjects;
if (selected_objects.length === 1 && selected_objects[0].getObjectType() === historyitem_type_ChartSpace) { if (selected_objects.length === 1 && selected_objects[0].getObjectType() === historyitem_type_ChartSpace) {
ischart = true; ischart = true;
} }
else if (selected_objects.length === 1 && selected_objects[0].getObjectType() === historyitem_type_Shape) {
var shapeObj = selected_objects[0];
if (shapeObj.spPr && shapeObj.spPr.geometry && shapeObj.spPr.geometry.preset === "line") {
window.AscAlwaysSaveAspectOnResizeTrack = false;
}
}
return {id:graphicsInfo.id, ischart: ischart}; return {id:graphicsInfo.id, ischart: ischart};
} }
......
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