Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions draftlogs/7217_remove.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Drop support for deprecated attribute `gl3d.cameraposition` (use `gl3d.camera` instead) [[#7217](https://github.com/plotly/plotly.js/pull/7217)]
23 changes: 0 additions & 23 deletions src/plot_api/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,29 +108,6 @@ exports.cleanLayout = function(layout) {

var scene = layout[key];

// clean old Camera coords
var cameraposition = scene.cameraposition;

if(Array.isArray(cameraposition) && cameraposition[0].length === 4) {
var rotation = cameraposition[0];
var center = cameraposition[1];
var radius = cameraposition[2];
var mat = m4FromQuat([], rotation);
var eye = [];

for(j = 0; j < 3; ++j) {
eye[j] = center[j] + radius * mat[2 + 4 * j];
}

scene.camera = {
eye: {x: eye[0], y: eye[1], z: eye[2]},
center: {x: center[0], y: center[1], z: center[2]},
up: {x: 0, y: 0, z: 1} // we just ignore calculating camera z up in this case
};

delete scene.cameraposition;
}

// clean axis titles
cleanTitle(scene.xaxis);
cleanTitle(scene.yaxis);
Expand Down
8 changes: 0 additions & 8 deletions src/plots/gl3d/layout/layout_attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,4 @@ module.exports = {
].join(' ')
},
editType: 'plot',

_deprecated: {
cameraposition: {
valType: 'info_array',
editType: 'camera',
description: 'Obsolete. Use `camera` instead.'
}
}
};
25 changes: 17 additions & 8 deletions test/image/mocks/gl3d_ibm-plot.json
Original file line number Diff line number Diff line change
Expand Up @@ -175,14 +175,23 @@
"zerolinecolor": "rgb(255, 255, 255)",
"zerolinewidth": 0.7000000000000001
},
"cameraposition": [
[
0.29286395317284275, 0.5148424663837641, 0.6900510261325995,
-0.4159297068895228
],
[0.0634642139736937, 0.08533175793925227, -0.12431759394236179],
2.0737597910908456
]
"camera": {
"eye": {
"x": 1.7897835835805567,
"y": 1.0535982168424982,
"z": 0.4943593571623967
},
"center": {
"x": 0.0634642139736937,
"y": 0.08533175793925227,
"z": -0.12431759394236179
},
"up": {
"x": 0,
"y": 0,
"z": 1
}
}
}
}
}
25 changes: 17 additions & 8 deletions test/image/mocks/gl3d_opacity-surface.json
Original file line number Diff line number Diff line change
Expand Up @@ -1540,14 +1540,23 @@
"range": [1, 2],
"gridcolor": "rgb(255, 255, 255)"
},
"cameraposition": [
[
-0.8326258918343652, -0.31013201281074904, -0.14770225080852764,
0.4344379172943774
],
[-0.09586835824120499, -0.07248137902934104, 0.013764797418843955],
1.9263438581634802
],
"camera": {
"eye": {
"x": 0.8970225259545955,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aaaand we just know these numbers? :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used the existing conversion function before deleting it. :-)

But I'll admit I don't actually know what the numbers in the old format mean. The meaning of the new format is documented here.

"y": -1.289611163151606,
"z": -1.101386959324396
},
"center": {
"x": -0.09586835824120499,
"y": -0.07248137902934104,
"z": 0.013764797418843955
},
"up": {
"x": 0,
"y": 0,
"z":1
}
},
"bgcolor": "rgb(67, 67, 67)",
"zaxis": {
"showticklabels": false,
Expand Down
25 changes: 17 additions & 8 deletions test/image/mocks/gl3d_surface-lighting.json
Original file line number Diff line number Diff line change
Expand Up @@ -244,14 +244,23 @@
},
"showlegend": false,
"scene": {
"cameraposition": [
[
-0.4605922047730424, 0.09969805401182547, 0.46756921524156575,
-0.7478597113676797
],
[0, 0, 0],
2.165063509461097
],
"camera": {
"eye": {
"x": -0.6096757261087671,
"y": 1.6934005016751204,
"z": 1.2034077654395448
},
"center": {
"x":0,
"y":0,
"z":0
},
"up": {
"x":0,
"y":0,
"z":1
}
},
"xaxis": {
"showbackground": true,
"type": "linear",
Expand Down
7 changes: 0 additions & 7 deletions test/plot-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -6698,13 +6698,6 @@
"_arrayAttrRegexps": [
{}
],
"_deprecated": {
"cameraposition": {
"description": "Obsolete. Use `camera` instead.",
"editType": "camera",
"valType": "info_array"
}
},
"_isSubplotObj": true,
"annotations": {
"items": {
Expand Down