@@ -1326,9 +1326,7 @@ plots.computeFrame = function(gd, frameName) {
1326
1326
// Merge, starting with the last and ending with the desired frame:
1327
1327
while ( ( framePtr = frameStack . pop ( ) ) ) {
1328
1328
if ( framePtr . layout ) {
1329
- copy = Lib . extendDeepNoArrays ( { } , framePtr . layout ) ;
1330
- expandedObj = Lib . expandObjectPaths ( copy ) ;
1331
- result . layout = Lib . extendDeepNoArrays ( result . layout || { } , expandedObj ) ;
1329
+ result . layout = plots . extendLayout ( result . layout , framePtr . layout ) ;
1332
1330
}
1333
1331
1334
1332
if ( framePtr . data ) {
@@ -1363,16 +1361,51 @@ plots.computeFrame = function(gd, frameName) {
1363
1361
result . traces [ destIndex ] = traceIndex ;
1364
1362
}
1365
1363
1366
- copy = Lib . extendDeepNoArrays ( { } , framePtr . data [ i ] ) ;
1367
- expandedObj = Lib . expandObjectPaths ( copy ) ;
1368
- result . data [ destIndex ] = Lib . extendDeepNoArrays ( result . data [ destIndex ] || { } , expandedObj ) ;
1364
+ try {
1365
+ result . data [ destIndex ] = plots . extendTrace ( result . data [ destIndex ] , framePtr . data [ i ] ) ;
1366
+ } catch ( e ) {
1367
+ console . error ( e ) ;
1368
+ }
1369
1369
}
1370
1370
}
1371
1371
}
1372
1372
1373
1373
return result ;
1374
1374
} ;
1375
1375
1376
+ plots . extendObjectWithContainers = function ( dest , src , containerPaths ) {
1377
+ var copy = Lib . extendDeepNoArrays ( { } , src || { } ) ;
1378
+ var expandedObj = Lib . expandObjectPaths ( copy ) ;
1379
+
1380
+ if ( containerPaths && containerPaths . length ) {
1381
+ for ( var i = 0 ; i < containerPaths . length ; i ++ ) {
1382
+ var srcProp = Lib . nestedProperty ( src , containerPaths [ i ] ) ;
1383
+ var srcVal = srcProp . get ( ) ;
1384
+
1385
+ console . log ( 'src, containerPaths[i], srcVal:' , src , containerPaths [ i ] , srcVal ) ;
1386
+
1387
+
1388
+ if ( ! srcVal ) continue ;
1389
+
1390
+ var destProp = Lib . nestedProperty ( src , containerPaths [ i ] ) ;
1391
+ var destVal = destProp . get ( ) ;
1392
+
1393
+
1394
+
1395
+ }
1396
+ }
1397
+
1398
+ return Lib . extendDeepNoArrays ( dest || { } , expandedObj ) ;
1399
+ } ;
1400
+
1401
+ plots . extendTrace = function ( destTrace , srcTrace ) {
1402
+ return plots . extendObjectWithContainers ( destTrace , srcTrace , [ 'transforms' ] ) ;
1403
+ } ;
1404
+
1405
+ plots . extendLayout = function ( destLayout , srcLayout ) {
1406
+ return plots . extendObjectWithContainers ( destLayout , srcLayout , [ ] ) ;
1407
+ } ;
1408
+
1376
1409
/**
1377
1410
* Transition to a set of new data and layout properties
1378
1411
*
@@ -1411,16 +1444,7 @@ plots.transition = function(gd, data, layout, traces, frameOpts, transitionOpts)
1411
1444
1412
1445
transitionedTraces . push ( traceIdx ) ;
1413
1446
1414
- // This is a multi-step process. First clone w/o arrays so that
1415
- // we're not modifying the original:
1416
- var update = Lib . extendDeepNoArrays ( { } , data [ i ] ) ;
1417
-
1418
- // Then expand object paths since we don't obey object-overwrite
1419
- // semantics here:
1420
- update = Lib . expandObjectPaths ( update ) ;
1421
-
1422
- // Finally apply the update (without copying arrays, of course):
1423
- Lib . extendDeepNoArrays ( gd . data [ traceIndices [ i ] ] , update ) ;
1447
+ gd . data [ traceIndices [ i ] ] = plots . extendTrace ( gd . data [ traceIndices [ i ] ] , data [ i ] ) ;
1424
1448
}
1425
1449
1426
1450
// Follow the same procedure. Clone it so we don't mangle the input, then
0 commit comments