@@ -16,18 +16,18 @@ var id2name = require('./axis_ids').id2name;
1616module . exports = function handleConstraintDefaults ( containerIn , containerOut , coerce , counterAxes , layoutOut ) {
1717 var constraintGroups = layoutOut . _axisConstraintGroups ;
1818
19- if ( ! containerIn . scalewith ) return ;
19+ if ( ! containerIn . scaleanchor ) return ;
2020
2121 var constraintOpts = getConstraintOpts ( constraintGroups , containerOut . _id , counterAxes , layoutOut ) ;
2222
23- var scalewith = Lib . coerce ( containerIn , containerOut , {
24- scalewith : {
23+ var scaleanchor = Lib . coerce ( containerIn , containerOut , {
24+ scaleanchor : {
2525 valType : 'enumerated' ,
2626 values : constraintOpts . linkableAxes
2727 }
28- } , 'scalewith ' ) ;
28+ } , 'scaleanchor ' ) ;
2929
30- if ( scalewith ) {
30+ if ( scaleanchor ) {
3131 var scaleratio = coerce ( 'scaleratio' ) ;
3232 // TODO: I suppose I could do attribute.min: Number.MIN_VALUE to avoid zero,
3333 // but that seems hacky. Better way to say "must be a positive number"?
@@ -37,18 +37,18 @@ module.exports = function handleConstraintDefaults(containerIn, containerOut, co
3737 if ( ! scaleratio ) scaleratio = containerOut . scaleratio = 1 ;
3838
3939 updateConstraintGroups ( constraintGroups , constraintOpts . thisGroup ,
40- containerOut . _id , scalewith , scaleratio ) ;
40+ containerOut . _id , scaleanchor , scaleratio ) ;
4141 }
42- else if ( counterAxes . indexOf ( containerIn . scalewith ) !== - 1 ) {
43- Lib . warn ( 'ignored ' + containerOut . _name + '.scalewith : "' +
44- containerIn . scalewith + '" to avoid an infinite loop ' +
42+ else if ( counterAxes . indexOf ( containerIn . scaleanchor ) !== - 1 ) {
43+ Lib . warn ( 'ignored ' + containerOut . _name + '.scaleanchor : "' +
44+ containerIn . scaleanchor + '" to avoid an infinite loop ' +
4545 'and possibly inconsistent scaleratios.' ) ;
4646 }
4747} ;
4848
4949function getConstraintOpts ( constraintGroups , thisID , counterAxes , layoutOut ) {
5050 // If this axis is already part of a constraint group, we can't
51- // scalewith any other axis in that group, or we'd make a loop.
51+ // scaleanchor any other axis in that group, or we'd make a loop.
5252 // Filter counterAxes to enforce this, also matching axis types.
5353
5454 var thisType = layoutOut [ id2name ( thisID ) ] . type ;
@@ -84,10 +84,10 @@ function getConstraintOpts(constraintGroups, thisID, counterAxes, layoutOut) {
8484 *
8585 * thisGroup: the group the current axis is already in
8686 * thisID: the id if the current axis
87- * scalewith : the id of the axis to scale it with
88- * scaleratio: the ratio of this axis to the scalewith axis
87+ * scaleanchor : the id of the axis to scale it with
88+ * scaleratio: the ratio of this axis to the scaleanchor axis
8989 */
90- function updateConstraintGroups ( constraintGroups , thisGroup , thisID , scalewith , scaleratio ) {
90+ function updateConstraintGroups ( constraintGroups , thisGroup , thisID , scaleanchor , scaleratio ) {
9191 var i , j , groupi , keyj , thisGroupIndex ;
9292
9393 if ( thisGroup === null ) {
@@ -103,11 +103,11 @@ function updateConstraintGroups(constraintGroups, thisGroup, thisID, scalewith,
103103 var thisGroupKeys = Object . keys ( thisGroup ) ;
104104
105105 // we know that this axis isn't in any other groups, but we don't know
106- // about the scalewith axis. If it is, we need to merge the groups.
106+ // about the scaleanchor axis. If it is, we need to merge the groups.
107107 for ( i = 0 ; i < constraintGroups . length ; i ++ ) {
108108 groupi = constraintGroups [ i ] ;
109- if ( i !== thisGroupIndex && groupi [ scalewith ] ) {
110- var baseScale = groupi [ scalewith ] ;
109+ if ( i !== thisGroupIndex && groupi [ scaleanchor ] ) {
110+ var baseScale = groupi [ scaleanchor ] ;
111111 for ( j = 0 ; j < thisGroupKeys . length ; j ++ ) {
112112 keyj = thisGroupKeys [ j ] ;
113113 groupi [ keyj ] = baseScale * scaleratio * thisGroup [ keyj ] ;
@@ -117,12 +117,12 @@ function updateConstraintGroups(constraintGroups, thisGroup, thisID, scalewith,
117117 }
118118 }
119119
120- // otherwise, we insert the new scalewith axis as the base scale (1)
120+ // otherwise, we insert the new scaleanchor axis as the base scale (1)
121121 // in its group, and scale the rest of the group to it
122122 if ( scaleratio !== 1 ) {
123123 for ( j = 0 ; j < thisGroupKeys . length ; j ++ ) {
124124 thisGroup [ thisGroupKeys [ j ] ] *= scaleratio ;
125125 }
126126 }
127- thisGroup [ scalewith ] = 1 ;
127+ thisGroup [ scaleanchor ] = 1 ;
128128}
0 commit comments