Skip to content

Commit b6d2a15

Browse files
committed
mv zmin/zmax/zauto backward compat mappings in surface defaults:
- so that Plotly.restyle is also kept backward compatible.
1 parent 3c26428 commit b6d2a15

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

src/plot_api/plot_api.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -761,11 +761,6 @@ function cleanData(data, existingData) {
761761
if(cont.colorscale === 'YIGnBu') cont.colorscale = 'YlGnBu';
762762
if(cont.colorscale === 'YIOrRd') cont.colorscale = 'YlOrRd';
763763
}
764-
if(Plots.traceIs(trace, 'surface')) {
765-
if('zmin' in trace) trace.cmin = trace.zmin;
766-
if('zmax' in trace) trace.cmax = trace.zmax;
767-
if('zauto' in trace) trace.cauto = trace.zauto;
768-
}
769764

770765
// prune empty containers made before the new nestedProperty
771766
if(emptyContainer(trace, 'line')) delete trace.line;

src/traces/surface/defaults.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
5858
coerce('hidesurface');
5959
coerce('opacity');
6060

61-
coerce('surfacecolor');
61+
var surfaceColor = coerce('surfacecolor');
6262

6363
coerce('colorscale');
6464

@@ -87,7 +87,20 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
8787
}
8888
}
8989

90+
// backward compatibility block
91+
if(!surfaceColor) {
92+
mapLegacy(traceIn, 'zmin', 'cmin');
93+
mapLegacy(traceIn, 'zmax', 'cmax');
94+
mapLegacy(traceIn, 'zauto', 'cauto');
95+
}
96+
9097
colorscaleDefaults(
9198
traceIn, traceOut, layout, coerce, {prefix: '', cLetter: 'c'}
9299
);
93100
};
101+
102+
function mapLegacy(traceIn, oldAttr, newAttr) {
103+
if(oldAttr in traceIn && !(newAttr in traceIn)) {
104+
traceIn[newAttr] = traceIn[oldAttr];
105+
}
106+
}

0 commit comments

Comments
 (0)