Commit 7c08124b authored by GoshaZotov's avatar GoshaZotov

changes for scaling

parent 9de3a1db
...@@ -138,6 +138,55 @@ Processor3D.prototype.calaculate3DProperties = function(baseDepth, gapDepth, bIs ...@@ -138,6 +138,55 @@ Processor3D.prototype.calaculate3DProperties = function(baseDepth, gapDepth, bIs
this._recalculateScaleWithMaxWidth(); this._recalculateScaleWithMaxWidth();
} }
} }
if(AscFormat.c_oChartTypes.Pie === this.chartsDrawer.calcProp.type && !this.view3D.rAngAx)
{
//TODO пересмотреть функцию
this.tempChangeAspectRatioForPie();
}
};
Processor3D.prototype.tempChangeAspectRatioForPie = function()
{
var perspectiveDepth = this.depthPerspective;
var widthCanvas = this.widthCanvas;
var originalWidthChart = widthCanvas - this.left - this.right;
var heightCanvas = this.heightCanvas;
var heightChart = heightCanvas - this.top - this.bottom;
var points = [], faces = [];
points.push(new Point3D(this.left + originalWidthChart / 2, this.top, perspectiveDepth, this));
points.push(new Point3D(this.left, this.top, perspectiveDepth / 2, this));
points.push(new Point3D(this.left + originalWidthChart, this.top, perspectiveDepth / 2, this));
points.push(new Point3D(this.left + originalWidthChart / 2, this.top, 0, this));
points.push(new Point3D(this.left + originalWidthChart / 2, this.top + heightChart, perspectiveDepth, this));
points.push(new Point3D(this.left, this.top + heightChart, perspectiveDepth / 2, this));
points.push(new Point3D(this.left + originalWidthChart, this.top + heightChart, perspectiveDepth / 2, this));
points.push(new Point3D(this.left + originalWidthChart / 2, this.top + heightChart, 0, this));
faces.push([0,1,2,3]);
faces.push([2,5,4,3]);
faces.push([1,6,7,0]);
faces.push([6,5,4,7]);
faces.push([7,4,3,0]);
faces.push([1,6,2,5]);
var minMaxOx = this._getMinMaxOx(points, faces);
var minMaxOy = this._getMinMaxOy(points, faces);
var kF = ((minMaxOx.right - minMaxOx.left) / originalWidthChart);
if((minMaxOy.bottom - minMaxOy.top) / kF > heightChart)
{
kF = ((minMaxOy.bottom - minMaxOy.top) / heightChart);
}
this.aspectRatioX = this.aspectRatioX * kF;
this.aspectRatioY = this.aspectRatioY * kF;
this.aspectRatioZ = this.aspectRatioZ * kF;
}; };
Processor3D.prototype.calculateCommonOptions = function() Processor3D.prototype.calculateCommonOptions = function()
...@@ -1200,7 +1249,7 @@ Processor3D.prototype._calculateCameraDiff = function (/*isSkip*/) ...@@ -1200,7 +1249,7 @@ Processor3D.prototype._calculateCameraDiff = function (/*isSkip*/)
var points = []; var points = [];
var faces = []; var faces = [];
if(AscFormat.c_oChartTypes.Pie === this.chartsDrawer.calcProp.type) /*if(AscFormat.c_oChartTypes.Pie === this.chartsDrawer.calcProp.type)
{ {
points.push(new Point3D(this.left + originalWidthChart / 2, this.top, perspectiveDepth, this)); points.push(new Point3D(this.left + originalWidthChart / 2, this.top, perspectiveDepth, this));
points.push(new Point3D(this.left, this.top, perspectiveDepth / 2, this)); points.push(new Point3D(this.left, this.top, perspectiveDepth / 2, this));
...@@ -1213,7 +1262,7 @@ Processor3D.prototype._calculateCameraDiff = function (/*isSkip*/) ...@@ -1213,7 +1262,7 @@ Processor3D.prototype._calculateCameraDiff = function (/*isSkip*/)
points.push(new Point3D(this.left + originalWidthChart / 2, this.top + heightChart, 0, this)); points.push(new Point3D(this.left + originalWidthChart / 2, this.top + heightChart, 0, this));
} }
else else
{ {*/
points.push(new Point3D(this.left, this.top, perspectiveDepth, this)); points.push(new Point3D(this.left, this.top, perspectiveDepth, this));
points.push(new Point3D(this.left, heightChart + this.top, perspectiveDepth, this)); points.push(new Point3D(this.left, heightChart + this.top, perspectiveDepth, this));
points.push(new Point3D(originalWidthChart + this.left, heightChart + this.top, perspectiveDepth, this)); points.push(new Point3D(originalWidthChart + this.left, heightChart + this.top, perspectiveDepth, this));
...@@ -1222,7 +1271,7 @@ Processor3D.prototype._calculateCameraDiff = function (/*isSkip*/) ...@@ -1222,7 +1271,7 @@ Processor3D.prototype._calculateCameraDiff = function (/*isSkip*/)
points.push(new Point3D(originalWidthChart + this.left, heightChart + this.top, 0, this)); points.push(new Point3D(originalWidthChart + this.left, heightChart + this.top, 0, this));
points.push(new Point3D(this.left, heightChart + this.top, 0, this)); points.push(new Point3D(this.left, heightChart + this.top, 0, this));
points.push(new Point3D(this.left, this.top, 0, this)); points.push(new Point3D(this.left, this.top, 0, this));
} //}
faces.push([0,1,2,3]); faces.push([0,1,2,3]);
faces.push([2,5,4,3]); faces.push([2,5,4,3]);
......
...@@ -7445,6 +7445,8 @@ function drawPieChart() ...@@ -7445,6 +7445,8 @@ function drawPieChart()
this.angleFor3D = null; this.angleFor3D = null;
this.properties3d = null; this.properties3d = null;
this.usually3dPropsCalc = []; this.usually3dPropsCalc = [];
this.tempDrawOrder = null;
} }
drawPieChart.prototype = drawPieChart.prototype =
...@@ -8501,6 +8503,11 @@ drawPieChart.prototype = ...@@ -8501,6 +8503,11 @@ drawPieChart.prototype =
var paths = this._calculateSegment3DPerspective(radius11, radius12, radius21, radius22, angles1[i], angles2[i], center1, center2, pointCenter1, pointCenter2, Math.sign(point2.y - point6.y)); var paths = this._calculateSegment3DPerspective(radius11, radius12, radius21, radius22, angles1[i], angles2[i], center1, center2, pointCenter1, pointCenter2, Math.sign(point2.y - point6.y));
if(null === this.tempDrawOrder)
{
this.tempDrawOrder = Math.sign(point2.y - point6.y) < 0 ? true : null;
}
if(!this.paths.series[angles1.length - i - 1]) if(!this.paths.series[angles1.length - i - 1])
{ {
this.paths.series[angles1.length - i - 1] = []; this.paths.series[angles1.length - i - 1] = [];
...@@ -9134,77 +9141,56 @@ drawPieChart.prototype = ...@@ -9134,77 +9141,56 @@ drawPieChart.prototype =
var pen = numCache[0].pen; var pen = numCache[0].pen;
drawPath(this.paths.test, pen, null); drawPath(this.paths.test, pen, null);
var sides = {down: 0, inside: 1, up: 2, front: 3};
//DOWN var drawPaths = function(side)
for (var i = 0,len = numCache.length; i < len; i++)
{ {
var val = numCache[i]; for (var i = 0,len = numCache.length; i < len; i++)
var brush = val.brush;
var pen = val.pen;
var path = this.paths.series[i];
if(path)
{
for(var j = path.length - 1; j >= 0; j--)
{
drawPath(path[j].downPath, pen, null);
}
}
}
//INSIDE
for (var i = 0,len = numCache.length; i < len; i++)
{
var val = numCache[i];
var brush = val.brush;
var pen = val.pen;
var path = this.paths.series[i];
if(path)
{
for(var j = path.length - 1; j >= 0; j--)
{
drawPath(path[j].insidePath, pen, brush, null, true);
}
}
}
//FRONT
for (var i = 0,len = numCache.length; i < len; i++)
{
var val = numCache[i];
var brush = val.brush;
var pen = val.pen;
var path = this.paths.series[i];
if(path)
{ {
for(var j = path.length - 1; j >= 0; j--) var val = numCache[i];
var brush = val.brush;
var pen = val.pen;
var path = t.paths.series[i];
if(path)
{ {
for(var k = 0; k < path[j].frontPath.length;k++) for(var j = path.length - 1; j >= 0; j--)
{ {
drawPath(path[j].frontPath[k], pen, brush, true, true); if(side === sides.down)
{
drawPath(path[j].downPath, pen, null);
}
else if(side === sides.inside)
{
drawPath(path[j].insidePath, pen, brush, null, true);
}
else if(side === sides.up)
{
drawPath(path[j].upPath, pen, brush);
}
else if(side === sides.frontPath)
{
for(var k = 0; k < path[j].frontPath.length;k++)
{
drawPath(path[j].frontPath[k], pen, brush, true, true);
}
}
} }
} }
} }
} };
//UP drawPaths(sides.down);
for (var i = 0,len = numCache.length; i < len; i++) drawPaths(sides.inside);
if(this.tempDrawOrder !== null)
{ {
var val = numCache[i]; drawPaths(sides.up);
var brush = val.brush; drawPaths(sides.frontPath);
var pen = val.pen; }
var path = this.paths.series[i]; else
{
if(path) drawPaths(sides.frontPath);
{ drawPaths(sides.up);
for(var j = path.length - 1; j >= 0; j--) }
{
drawPath(path[j].upPath, pen, brush);
}
}
}
}, },
_calculateTestFrame: function(point1, point2, point3, point4, point5, point6, point7, point8) _calculateTestFrame: function(point1, point2, point3, point4, point5, point6, point7, point8)
......
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