Skip to content

Commit e4b3591

Browse files
authored
Merge pull request #7217 from plotly/drop-cameraposition
Drop support for deprecated attribute `gl3d.cameraposition` (use `gl3d.camera` instead)
2 parents 2f19d0f + 312e520 commit e4b3591

File tree

7 files changed

+52
-62
lines changed

7 files changed

+52
-62
lines changed

draftlogs/7217_remove.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Drop support for deprecated attribute `gl3d.cameraposition` (use `gl3d.camera` instead) [[#7217](https://github.com/plotly/plotly.js/pull/7217)]

src/plot_api/helpers.js

-23
Original file line numberDiff line numberDiff line change
@@ -108,29 +108,6 @@ exports.cleanLayout = function(layout) {
108108

109109
var scene = layout[key];
110110

111-
// clean old Camera coords
112-
var cameraposition = scene.cameraposition;
113-
114-
if(Array.isArray(cameraposition) && cameraposition[0].length === 4) {
115-
var rotation = cameraposition[0];
116-
var center = cameraposition[1];
117-
var radius = cameraposition[2];
118-
var mat = m4FromQuat([], rotation);
119-
var eye = [];
120-
121-
for(j = 0; j < 3; ++j) {
122-
eye[j] = center[j] + radius * mat[2 + 4 * j];
123-
}
124-
125-
scene.camera = {
126-
eye: {x: eye[0], y: eye[1], z: eye[2]},
127-
center: {x: center[0], y: center[1], z: center[2]},
128-
up: {x: 0, y: 0, z: 1} // we just ignore calculating camera z up in this case
129-
};
130-
131-
delete scene.cameraposition;
132-
}
133-
134111
// clean axis titles
135112
cleanTitle(scene.xaxis);
136113
cleanTitle(scene.yaxis);

src/plots/gl3d/layout/layout_attributes.js

-8
Original file line numberDiff line numberDiff line change
@@ -159,12 +159,4 @@ module.exports = {
159159
].join(' ')
160160
},
161161
editType: 'plot',
162-
163-
_deprecated: {
164-
cameraposition: {
165-
valType: 'info_array',
166-
editType: 'camera',
167-
description: 'Obsolete. Use `camera` instead.'
168-
}
169-
}
170162
};

test/image/mocks/gl3d_ibm-plot.json

+17-8
Original file line numberDiff line numberDiff line change
@@ -175,14 +175,23 @@
175175
"zerolinecolor": "rgb(255, 255, 255)",
176176
"zerolinewidth": 0.7000000000000001
177177
},
178-
"cameraposition": [
179-
[
180-
0.29286395317284275, 0.5148424663837641, 0.6900510261325995,
181-
-0.4159297068895228
182-
],
183-
[0.0634642139736937, 0.08533175793925227, -0.12431759394236179],
184-
2.0737597910908456
185-
]
178+
"camera": {
179+
"eye": {
180+
"x": 1.7897835835805567,
181+
"y": 1.0535982168424982,
182+
"z": 0.4943593571623967
183+
},
184+
"center": {
185+
"x": 0.0634642139736937,
186+
"y": 0.08533175793925227,
187+
"z": -0.12431759394236179
188+
},
189+
"up": {
190+
"x": 0,
191+
"y": 0,
192+
"z": 1
193+
}
194+
}
186195
}
187196
}
188197
}

test/image/mocks/gl3d_opacity-surface.json

+17-8
Original file line numberDiff line numberDiff line change
@@ -1540,14 +1540,23 @@
15401540
"range": [1, 2],
15411541
"gridcolor": "rgb(255, 255, 255)"
15421542
},
1543-
"cameraposition": [
1544-
[
1545-
-0.8326258918343652, -0.31013201281074904, -0.14770225080852764,
1546-
0.4344379172943774
1547-
],
1548-
[-0.09586835824120499, -0.07248137902934104, 0.013764797418843955],
1549-
1.9263438581634802
1550-
],
1543+
"camera": {
1544+
"eye": {
1545+
"x": 0.8970225259545955,
1546+
"y": -1.289611163151606,
1547+
"z": -1.101386959324396
1548+
},
1549+
"center": {
1550+
"x": -0.09586835824120499,
1551+
"y": -0.07248137902934104,
1552+
"z": 0.013764797418843955
1553+
},
1554+
"up": {
1555+
"x": 0,
1556+
"y": 0,
1557+
"z":1
1558+
}
1559+
},
15511560
"bgcolor": "rgb(67, 67, 67)",
15521561
"zaxis": {
15531562
"showticklabels": false,

test/image/mocks/gl3d_surface-lighting.json

+17-8
Original file line numberDiff line numberDiff line change
@@ -244,14 +244,23 @@
244244
},
245245
"showlegend": false,
246246
"scene": {
247-
"cameraposition": [
248-
[
249-
-0.4605922047730424, 0.09969805401182547, 0.46756921524156575,
250-
-0.7478597113676797
251-
],
252-
[0, 0, 0],
253-
2.165063509461097
254-
],
247+
"camera": {
248+
"eye": {
249+
"x": -0.6096757261087671,
250+
"y": 1.6934005016751204,
251+
"z": 1.2034077654395448
252+
},
253+
"center": {
254+
"x":0,
255+
"y":0,
256+
"z":0
257+
},
258+
"up": {
259+
"x":0,
260+
"y":0,
261+
"z":1
262+
}
263+
},
255264
"xaxis": {
256265
"showbackground": true,
257266
"type": "linear",

test/plot-schema.json

-7
Original file line numberDiff line numberDiff line change
@@ -6691,13 +6691,6 @@
66916691
"_arrayAttrRegexps": [
66926692
{}
66936693
],
6694-
"_deprecated": {
6695-
"cameraposition": {
6696-
"description": "Obsolete. Use `camera` instead.",
6697-
"editType": "camera",
6698-
"valType": "info_array"
6699-
}
6700-
},
67016694
"_isSubplotObj": true,
67026695
"annotations": {
67036696
"items": {

0 commit comments

Comments
 (0)