Commit a4c34e53 authored by SergeyLuzyanin's avatar SergeyLuzyanin

fix Bug 35002

parent f1fd009a
...@@ -78,7 +78,7 @@ function Processor3D(width, height, left, right, bottom, top, chartSpace, charts ...@@ -78,7 +78,7 @@ function Processor3D(width, height, left, right, bottom, top, chartSpace, charts
this.specialStandardScaleX = 1; this.specialStandardScaleX = 1;
this.view3D = chartSpace.chart.view3D; this.view3D = chartSpace.chart.getView3d();
this.chartSpace = chartSpace; this.chartSpace = chartSpace;
this.chartsDrawer = chartsDrawer; this.chartsDrawer = chartsDrawer;
......
...@@ -2465,9 +2465,9 @@ CChartsDrawer.prototype = ...@@ -2465,9 +2465,9 @@ CChartsDrawer.prototype =
calculatePositionLabelsCatAxFromAngle: function(chartSpace) calculatePositionLabelsCatAxFromAngle: function(chartSpace)
{ {
var res = null; var res = null;
var oView3D = chartSpace.chart.getView3d();
var angleOy = chartSpace.chart.view3D && chartSpace.chart.view3D.rotY ? (- chartSpace.chart.view3D.rotY / 360) * (Math.PI * 2) : 0; var angleOy = oView3D && oView3D.rotY ? (- oView3D.rotY / 360) * (Math.PI * 2) : 0;
if(chartSpace.chart.view3D && !chartSpace.chart.view3D.getRAngAx() && angleOy !== 0) if(oView3D && !oView3D.getRAngAx() && angleOy !== 0)
{ {
angleOy = Math.abs(angleOy); angleOy = Math.abs(angleOy);
...@@ -3505,10 +3505,10 @@ CChartsDrawer.prototype = ...@@ -3505,10 +3505,10 @@ CChartsDrawer.prototype =
var chart = chartSpace && chartSpace.chart ? chartSpace.chart.plotArea.charts[0]: null; var chart = chartSpace && chartSpace.chart ? chartSpace.chart.plotArea.charts[0]: null;
var typeChart = chart ? chart.getObjectType() : null; var typeChart = chart ? chart.getObjectType() : null;
var oView3D = chartSpace && chartSpace.chart && chartSpace.chart.getView3d();
if(isTurnOn3DCharts && chartSpace && chartSpace.chart.view3D) if(isTurnOn3DCharts && oView3D)
{ {
var isPerspective = !chartSpace.chart.view3D.getRAngAx(); var isPerspective = !oView3D.getRAngAx();
var isBar = typeChart === AscDFH.historyitem_type_BarChart && chart && chart.barDir !== AscFormat.BAR_DIR_BAR; var isBar = typeChart === AscDFH.historyitem_type_BarChart && chart && chart.barDir !== AscFormat.BAR_DIR_BAR;
var isHBar = typeChart === AscDFH.historyitem_type_BarChart && chart && chart.barDir === AscFormat.BAR_DIR_BAR; var isHBar = typeChart === AscDFH.historyitem_type_BarChart && chart && chart.barDir === AscFormat.BAR_DIR_BAR;
...@@ -8375,8 +8375,9 @@ drawPieChart.prototype = ...@@ -8375,8 +8375,9 @@ drawPieChart.prototype =
var startAngle = Math.PI / 2; var startAngle = Math.PI / 2;
var newStartAngle = startAngle; var newStartAngle = startAngle;
var firstAngle = this.cChartSpace.chart.view3D && this.cChartSpace.chart.view3D.rotY ? (- this.cChartSpace.chart.view3D.rotY / 360) * (Math.PI * 2) : 0; var oView3D = this.cChartSpace.chart.getView3d();
var firstAngle = oView3D && oView3D.rotY ? (- oView3D.rotY / 360) * (Math.PI * 2) : 0;
var getAngleByCoordsSidesTriangle = function(aC, bC, cC) var getAngleByCoordsSidesTriangle = function(aC, bC, cC)
...@@ -12209,7 +12210,7 @@ gridChart.prototype = ...@@ -12209,7 +12210,7 @@ gridChart.prototype =
var path; var path;
if(this.cChartDrawer.nDimensionCount === 3) if(this.cChartDrawer.nDimensionCount === 3)
{ {
var view3DProp = this.cChartSpace.chart.view3D; var view3DProp = this.cChartSpace.chart.getView3d();
var angleOx = view3DProp && view3DProp.rotX ? (- view3DProp.rotX / 360) * (Math.PI * 2) : 0; var angleOx = view3DProp && view3DProp.rotX ? (- view3DProp.rotX / 360) * (Math.PI * 2) : 0;
var angleOy = view3DProp && view3DProp.rotY ? (- view3DProp.rotY / 360) * (Math.PI * 2) : 0; var angleOy = view3DProp && view3DProp.rotY ? (- view3DProp.rotY / 360) * (Math.PI * 2) : 0;
var perspectiveDepth = this.cChartDrawer.processor3D.depthPerspective; var perspectiveDepth = this.cChartDrawer.processor3D.depthPerspective;
...@@ -12726,7 +12727,7 @@ catAxisChart.prototype = ...@@ -12726,7 +12727,7 @@ catAxisChart.prototype =
if(this.cChartDrawer.nDimensionCount === 3) if(this.cChartDrawer.nDimensionCount === 3)
{ {
var view3DProp = this.cChartSpace.chart.view3D; var view3DProp = this.cChartSpace.chart.getView3d();
var z = this.cChartDrawer.processor3D.calculateZPositionCatAxis(); var z = this.cChartDrawer.processor3D.calculateZPositionCatAxis();
...@@ -13095,7 +13096,7 @@ serAxisChart.prototype = ...@@ -13095,7 +13096,7 @@ serAxisChart.prototype =
{ {
var nullPositionOx = this.chartProp.nullPositionOX; var nullPositionOx = this.chartProp.nullPositionOX;
var view3DProp = this.cChartSpace.chart.view3D; var view3DProp = this.cChartSpace.chart.getView3d();
var perspectiveDepth = this.cChartDrawer.processor3D.depthPerspective; var perspectiveDepth = this.cChartDrawer.processor3D.depthPerspective;
//var z = this.cChartDrawer.processor3D.calculateZPositionValAxis(); //var z = this.cChartDrawer.processor3D.calculateZPositionValAxis();
...@@ -13655,7 +13656,7 @@ areaChart.prototype = ...@@ -13655,7 +13656,7 @@ areaChart.prototype =
var topMargin = this.chartProp.chartGutter._top; var topMargin = this.chartProp.chartGutter._top;
var bottomMargin = this.chartProp.chartGutter._bottom; var bottomMargin = this.chartProp.chartGutter._bottom;
var view3DProp = this.cChartSpace.chart.view3D; var view3DProp = this.cChartSpace.chart.getView3d();
var perspectiveDepth = this.cChartDrawer.processor3D.depthPerspective; var perspectiveDepth = this.cChartDrawer.processor3D.depthPerspective;
var convertResult = this.cChartDrawer._convertAndTurnPoint(leftMargin, heightGraph - bottomMargin, perspectiveDepth); var convertResult = this.cChartDrawer._convertAndTurnPoint(leftMargin, heightGraph - bottomMargin, perspectiveDepth);
......
...@@ -13061,6 +13061,37 @@ CChart.prototype = ...@@ -13061,6 +13061,37 @@ CChart.prototype =
return null; return null;
}, },
getView3d: function(){
return AscFormat.ExecuteNoHistory(function(){
if(this.view3D){
var _ret = this.view3D.createDuplicate();
var oChart = this.plotArea && this.plotArea.charts[0];
if(oChart){
if(oChart.getObjectType() === AscDFH.historyitem_type_SurfaceChart){
if(!AscFormat.isRealNumber(_ret.rotX)){
_ret.rotX = 15;
}
if(!AscFormat.isRealNumber(_ret.rotY)){
_ret.rotY = 20;
}
}
else{
if(!AscFormat.isRealNumber(_ret.rotX)){
_ret.rotX = 0;
}
if(!AscFormat.isRealNumber(_ret.rotY)){
_ret.rotY = 0;
}
}
return _ret;
}
}
return null;
}, this, []);
},
getObjectType: function() getObjectType: function()
{ {
return AscDFH.historyitem_type_Chart; return AscDFH.historyitem_type_Chart;
......
...@@ -646,7 +646,7 @@ function Chart3dAdjustTrack(oChartSpace, numHandle, startX, startY) ...@@ -646,7 +646,7 @@ function Chart3dAdjustTrack(oChartSpace, numHandle, startX, startY)
AscFormat.ExecuteNoHistory(function(){ AscFormat.ExecuteNoHistory(function(){
this.view3D = oChartSpace.chart.view3D.createDuplicate(); this.view3D = oChartSpace.chart.getView3d();
this.chartSizes = this.chartSpace.getChartSizes(); this.chartSizes = this.chartSpace.getChartSizes();
this.cX = this.chartSizes.startX + this.chartSizes.w/2; this.cX = this.chartSizes.startX + this.chartSizes.w/2;
...@@ -824,7 +824,8 @@ function Chart3dAdjustTrack(oChartSpace, numHandle, startX, startY) ...@@ -824,7 +824,8 @@ function Chart3dAdjustTrack(oChartSpace, numHandle, startX, startY)
var tx = this.chartSpace.invertTransform.TransformPointX(x, y); var tx = this.chartSpace.invertTransform.TransformPointX(x, y);
var ty = this.chartSpace.invertTransform.TransformPointY(x, y); var ty = this.chartSpace.invertTransform.TransformPointY(x, y);
var deltaAng = 0; var deltaAng = 0;
var StratRotY = oChartSpace.chart.view3D && oChartSpace.chart.view3D.rotY ? oChartSpace.chart.view3D.rotY : 0; var _view3d = oChartSpace.chart.getView3d();
var StratRotY = _view3d && _view3d.rotY ? _view3d.rotY : 0;
deltaAng = -90*(tx - this.startX)/(this.chartSizes.w/2); deltaAng = -90*(tx - this.startX)/(this.chartSizes.w/2);
this.view3D.rotY = StratRotY + deltaAng; this.view3D.rotY = StratRotY + deltaAng;
while(this.view3D.rotY < 0){ while(this.view3D.rotY < 0){
...@@ -834,7 +835,7 @@ function Chart3dAdjustTrack(oChartSpace, numHandle, startX, startY) ...@@ -834,7 +835,7 @@ function Chart3dAdjustTrack(oChartSpace, numHandle, startX, startY)
this.view3D.rotY -= 360; this.view3D.rotY -= 360;
} }
var StratRotX = oChartSpace.chart.view3D && oChartSpace.chart.view3D.rotX ? oChartSpace.chart.view3D.rotX : 0; var StratRotX = _view3d && _view3d.rotX ? _view3d.rotX : 0;
deltaAng = 90*(ty - this.startY)/(this.chartSizes.h/2); deltaAng = 90*(ty - this.startY)/(this.chartSizes.h/2);
this.view3D.rotX = StratRotX + deltaAng; this.view3D.rotX = StratRotX + deltaAng;
......
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