|
8 | 8 |
|
9 | 9 | 'use strict';
|
10 | 10 |
|
11 |
| -var Registry = require('../../registry'); |
12 | 11 | var Lib = require('../../lib');
|
13 |
| -var colorscaleDefaults = require('../../components/colorscale/defaults'); |
14 | 12 | var attributes = require('./attributes');
|
| 13 | +var supplyIsoDefaults = require('./iso_defaults'); |
15 | 14 |
|
16 | 15 | module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) {
|
17 | 16 | function coerce(attr, dflt) {
|
18 | 17 | return Lib.coerce(traceIn, traceOut, attributes, attr, dflt);
|
19 | 18 | }
|
20 | 19 |
|
21 |
| - var isomin = coerce('isomin'); |
22 |
| - var isomax = coerce('isomax'); |
23 |
| - |
24 |
| - if(isomax !== undefined && isomax !== null && |
25 |
| - isomin !== undefined && isomin !== null && |
26 |
| - isomin > isomax) { |
27 |
| - // applying default values in this case: |
28 |
| - traceOut.isomin = null; |
29 |
| - traceOut.isomax = null; |
30 |
| - } |
31 |
| - |
32 |
| - var x = coerce('x'); |
33 |
| - var y = coerce('y'); |
34 |
| - var z = coerce('z'); |
35 |
| - var value = coerce('value'); |
36 |
| - |
37 |
| - if( |
38 |
| - !x || !x.length || |
39 |
| - !y || !y.length || |
40 |
| - !z || !z.length || |
41 |
| - !value || !value.length |
42 |
| - ) { |
43 |
| - traceOut.visible = false; |
44 |
| - return; |
45 |
| - } |
46 |
| - |
47 |
| - var handleCalendarDefaults = Registry.getComponentMethod('calendars', 'handleTraceDefaults'); |
48 |
| - handleCalendarDefaults(traceIn, traceOut, ['x', 'y', 'z'], layout); |
49 |
| - |
50 |
| - ['x', 'y', 'z'].forEach(function(dim) { |
51 |
| - var capDim = 'caps.' + dim; |
52 |
| - var showCap = coerce(capDim + '.show'); |
53 |
| - if(showCap) { |
54 |
| - coerce(capDim + '.fill'); |
55 |
| - } |
56 |
| - |
57 |
| - var sliceDim = 'slices.' + dim; |
58 |
| - var showSlice = coerce(sliceDim + '.show'); |
59 |
| - if(showSlice) { |
60 |
| - coerce(sliceDim + '.fill'); |
61 |
| - coerce(sliceDim + '.locations'); |
62 |
| - } |
63 |
| - }); |
64 |
| - |
65 |
| - var showSpaceframe = coerce('spaceframe.show'); |
66 |
| - if(showSpaceframe) { |
67 |
| - coerce('spaceframe.fill'); |
68 |
| - } |
69 |
| - |
70 |
| - var showSurface = coerce('surface.show'); |
71 |
| - if(showSurface) { |
72 |
| - coerce('surface.count'); |
73 |
| - coerce('surface.fill'); |
74 |
| - coerce('surface.pattern'); |
75 |
| - } |
76 |
| - |
77 |
| - var showContour = coerce('contour.show'); |
78 |
| - if(showContour) { |
79 |
| - coerce('contour.color'); |
80 |
| - coerce('contour.width'); |
81 |
| - } |
82 |
| - |
83 |
| - // Coerce remaining properties |
84 |
| - [ |
85 |
| - 'text', |
86 |
| - 'hovertext', |
87 |
| - 'hovertemplate', |
88 |
| - 'lighting.ambient', |
89 |
| - 'lighting.diffuse', |
90 |
| - 'lighting.specular', |
91 |
| - 'lighting.roughness', |
92 |
| - 'lighting.fresnel', |
93 |
| - 'lighting.vertexnormalsepsilon', |
94 |
| - 'lighting.facenormalsepsilon', |
95 |
| - 'lightposition.x', |
96 |
| - 'lightposition.y', |
97 |
| - 'lightposition.z', |
98 |
| - 'flatshading', |
99 |
| - 'opacity' |
100 |
| - ].forEach(function(x) { coerce(x); }); |
101 |
| - |
102 |
| - colorscaleDefaults(traceIn, traceOut, layout, coerce, {prefix: '', cLetter: 'c'}); |
103 |
| - |
104 |
| - // disable 1D transforms (for now) |
105 |
| - traceOut._length = null; |
| 20 | + supplyIsoDefaults(traceIn, traceOut, defaultColor, layout, coerce); |
106 | 21 | };
|
0 commit comments