@@ -31,6 +31,8 @@ var svgTextUtils = require('../lib/svg_text_utils');
31
31
var manageArrays = require ( './manage_arrays' ) ;
32
32
var helpers = require ( './helpers' ) ;
33
33
var subroutines = require ( './subroutines' ) ;
34
+ var editTypes = require ( './edit_types' ) ;
35
+
34
36
var cartesianConstants = require ( '../plots/cartesian/constants' ) ;
35
37
var axisConstraints = require ( '../plots/cartesian/constraints' ) ;
36
38
var enforceAxisConstraints = axisConstraints . enforce ;
@@ -1264,16 +1266,7 @@ function _restyle(gd, aobj, _traces) {
1264
1266
var traces = helpers . coerceTraceIndices ( gd , _traces ) ;
1265
1267
1266
1268
// initialize flags
1267
- var flags = {
1268
- docalc : false ,
1269
- docalcAutorange : false ,
1270
- doplot : false ,
1271
- dostyle : false ,
1272
- docolorbars : false ,
1273
- autorangeOn : false ,
1274
- clearCalc : false ,
1275
- fullReplot : false
1276
- } ;
1269
+ var flags = editTypes . traces ( ) ;
1277
1270
1278
1271
// copies of the change (and previous values of anything affected)
1279
1272
// for the undo / redo queue
@@ -1304,8 +1297,6 @@ function _restyle(gd, aobj, _traces) {
1304
1297
'reversescale' , 'marker.reversescale' ,
1305
1298
'autobinx' , 'nbinsx' , 'xbins' , 'xbins.start' , 'xbins.end' , 'xbins.size' ,
1306
1299
'autobiny' , 'nbinsy' , 'ybins' , 'ybins.start' , 'ybins.end' , 'ybins.size' ,
1307
- 'autocontour' , 'ncontours' , 'contours' , 'contours.coloring' ,
1308
- 'contours.operation' , 'contours.value' , 'contours.type' , 'contours.value[0]' , 'contours.value[1]' ,
1309
1300
'error_y' , 'error_y.visible' , 'error_y.value' , 'error_y.type' ,
1310
1301
'error_y.traceref' , 'error_y.array' , 'error_y.symmetric' ,
1311
1302
'error_y.arrayminus' , 'error_y.valueminus' , 'error_y.tracerefminus' ,
@@ -1373,9 +1364,6 @@ function _restyle(gd, aobj, _traces) {
1373
1364
'marker.cmin' , 'marker.cmax' , 'marker.cauto' ,
1374
1365
'line.cmin' , 'line.cmax' ,
1375
1366
'marker.line.cmin' , 'marker.line.cmax' ,
1376
- 'contours.start' , 'contours.end' , 'contours.size' ,
1377
- 'contours.showlines' , 'contours.showlabels' , 'contours.labelformat' ,
1378
- 'contours.font' , 'contours.font.family' , 'contours.font.size' ,
1379
1367
'line' , 'line.smoothing' , 'line.shape' ,
1380
1368
'error_y.width' , 'error_x.width' , 'error_x.copy_ystyle' ,
1381
1369
'marker.maxdisplayed'
@@ -1620,23 +1608,35 @@ function _restyle(gd, aobj, _traces) {
1620
1608
flags . docalc = true ;
1621
1609
}
1622
1610
else {
1623
- var moduleAttrs = ( contFull . _module || { } ) . attributes || { } ;
1624
- var valObject = Lib . nestedProperty ( moduleAttrs , ai ) . get ( ) ||
1625
- Lib . nestedProperty ( Plots . attributes , ai ) . get ( ) ||
1626
- { } ;
1611
+ var aiHead = param . parts [ 0 ] ;
1612
+ var moduleAttrs = ( contFull . _module || { } ) . attributes ;
1613
+ var valObject = moduleAttrs && moduleAttrs [ aiHead ] ;
1614
+ if ( ! valObject ) valObject = Plots . attributes [ aiHead ] ;
1615
+ if ( valObject ) {
1616
+ /*
1617
+ * In occasional cases we can't the innermost valObject
1618
+ * doesn't exist, for example `valType: 'any'` items like
1619
+ * contourcarpet `contours.value` where we might set
1620
+ * `contours.value[0]`. In that case, stop at the deepest
1621
+ * valObject we *do* find.
1622
+ */
1623
+ for ( var parti = 1 ; parti < param . parts . length ; parti ++ ) {
1624
+ var newValObject = valObject [ param . parts [ parti ] ] ;
1625
+ if ( newValObject ) valObject = newValObject ;
1626
+ else break ;
1627
+ }
1627
1628
1628
- // if restyling entire attribute container, assume worse case
1629
- if ( ! valObject . valType ) {
1630
- flags . docalc = true ;
1631
- }
1629
+ // must redo calcdata when restyling array values of arrayOk attributes
1630
+ if ( valObject . arrayOk && ( Array . isArray ( newVal ) || Array . isArray ( oldVal ) ) ) {
1631
+ flags . docalc = true ;
1632
+ }
1632
1633
1633
- // must redo calcdata when restyling array values of arrayOk attributes
1634
- if ( valObject . arrayOk && ( Array . isArray ( newVal ) || Array . isArray ( oldVal ) ) ) {
1635
- flags . docalc = true ;
1634
+ // some attributes declare an 'editType' flaglist
1635
+ editTypes . update ( flags , valObject ) ;
1636
1636
}
1637
-
1638
- // some attributes declare an 'editType' flaglist
1639
- if ( valObject . editType === 'docalc' ) {
1637
+ else {
1638
+ // if we couldn't find valObject even at the root,
1639
+ // assume a full recalc.
1640
1640
flags . docalc = true ;
1641
1641
}
1642
1642
@@ -1864,16 +1864,7 @@ function _relayout(gd, aobj) {
1864
1864
}
1865
1865
1866
1866
// initialize flags
1867
- var flags = {
1868
- dolegend : false ,
1869
- doticks : false ,
1870
- dolayoutstyle : false ,
1871
- doplot : false ,
1872
- docalc : false ,
1873
- domodebar : false ,
1874
- docamera : false ,
1875
- layoutReplot : false
1876
- } ;
1867
+ var flags = editTypes . layout ( ) ;
1877
1868
1878
1869
// copies of the change (and previous values of anything affected)
1879
1870
// for the undo / redo queue
0 commit comments