@@ -26,11 +26,10 @@ exports.handleConstraintDefaults = function(containerIn, containerOut, coerce, a
26
26
var thisID = containerOut . _id ;
27
27
var letter = thisID . charAt ( 0 ) ;
28
28
29
- if ( containerOut . fixedrange ) return ;
30
-
31
29
// coerce the constraint mechanics even if this axis has no scaleanchor
32
30
// because it may be the anchor of another axis.
33
31
var constrain = coerce ( 'constrain' ) ;
32
+
34
33
Lib . coerce ( containerIn , containerOut , {
35
34
constraintoward : {
36
35
valType : 'enumerated' ,
@@ -39,27 +38,31 @@ exports.handleConstraintDefaults = function(containerIn, containerOut, coerce, a
39
38
}
40
39
} , 'constraintoward' ) ;
41
40
42
- if ( ! containerIn . scaleanchor && ! containerIn . matches && ! splomStash . matches ) return ;
41
+ var scaleOpts = containerIn . scaleanchor && ! ( containerOut . fixedrange && constrain !== 'domain' ) ?
42
+ getConstraintOpts ( constraintGroups , thisID , allAxisIds , layoutOut , constrain ) :
43
+ { } ;
43
44
44
- var opts = getConstraintOpts ( constraintGroups , thisID , allAxisIds , layoutOut ) ;
45
+ var matchOpts = ( containerIn . matches || splomStash . matches ) && ! containerOut . fixedrange ?
46
+ getConstraintOpts ( matchGroups , thisID , allAxisIds , layoutOut ) :
47
+ { } ;
45
48
46
49
var scaleanchor = Lib . coerce ( containerIn , containerOut , {
47
50
scaleanchor : {
48
51
valType : 'enumerated' ,
49
- values : opts . linkableAxes
52
+ values : scaleOpts . linkableAxes || [ ]
50
53
}
51
54
} , 'scaleanchor' ) ;
52
55
53
56
var matches = Lib . coerce ( containerIn , containerOut , {
54
57
matches : {
55
58
valType : 'enumerated' ,
56
- values : opts . linkableAxes ,
59
+ values : matchOpts . linkableAxes || [ ] ,
57
60
dflt : splomStash . matches
58
61
}
59
62
} , 'matches' ) ;
60
63
61
64
// disallow constraining AND matching range
62
- if ( constrain === 'range' && scaleanchor === matches ) {
65
+ if ( constrain === 'range' && scaleanchor && matches && scaleanchor === matches ) {
63
66
delete containerOut . scaleanchor ;
64
67
delete containerOut . constrain ;
65
68
scaleanchor = null ;
@@ -77,12 +80,12 @@ exports.handleConstraintDefaults = function(containerIn, containerOut, coerce, a
77
80
// Likewise with super-huge values.
78
81
if ( ! scaleratio ) scaleratio = containerOut . scaleratio = 1 ;
79
82
80
- updateConstraintGroups ( constraintGroups , opts . thisGroup , thisID , scaleanchor , scaleratio ) ;
83
+ updateConstraintGroups ( constraintGroups , scaleOpts . thisGroup , thisID , scaleanchor , scaleratio ) ;
81
84
found = true ;
82
85
}
83
86
84
87
if ( matches ) {
85
- updateConstraintGroups ( matchGroups , opts . thisGroup , thisID , matches , 1 ) ;
88
+ updateConstraintGroups ( matchGroups , matchOpts . thisGroup , thisID , matches , 1 ) ;
86
89
found = true ;
87
90
}
88
91
@@ -94,13 +97,12 @@ exports.handleConstraintDefaults = function(containerIn, containerOut, coerce, a
94
97
}
95
98
} ;
96
99
97
- function getConstraintOpts ( constraintGroups , thisID , allAxisIds , layoutOut ) {
98
- // If this axis is already part of a constraint group, we can't
99
- // scaleanchor any other axis in that group, or we'd make a loop .
100
- // Filter allAxisIds to enforce this, also matching axis types.
101
-
100
+ // If this axis is already part of a constraint group, we can't
101
+ // scaleanchor any other axis in that group, or we'd make a loop.
102
+ // Filter allAxisIds to enforce this, also matching axis types .
103
+ function getConstraintOpts ( groups , thisID , allAxisIds , layoutOut , constrain ) {
104
+ var doesNotConstrainRange = constrain !== 'range' ;
102
105
var thisType = layoutOut [ id2name ( thisID ) ] . type ;
103
-
104
106
var i , j , idj , axj ;
105
107
106
108
var linkableAxes = [ ] ;
@@ -109,12 +111,23 @@ function getConstraintOpts(constraintGroups, thisID, allAxisIds, layoutOut) {
109
111
if ( idj === thisID ) continue ;
110
112
111
113
axj = layoutOut [ id2name ( idj ) ] ;
112
- if ( axj . type === thisType && ! axj . fixedrange ) linkableAxes . push ( idj ) ;
114
+ if ( axj . type === thisType ) {
115
+ if ( ! axj . fixedrange ) {
116
+ linkableAxes . push ( idj ) ;
117
+ } else if ( doesNotConstrainRange && axj . anchor ) {
118
+ // allow domain constraints on subplots where
119
+ // BOTH axes have fixedrange:true and constrain:domain
120
+ var counterAxj = layoutOut [ id2name ( axj . anchor ) ] ;
121
+ if ( counterAxj . fixedrange ) {
122
+ linkableAxes . push ( idj ) ;
123
+ }
124
+ }
125
+ }
113
126
}
114
127
115
- for ( i = 0 ; i < constraintGroups . length ; i ++ ) {
116
- if ( constraintGroups [ i ] [ thisID ] ) {
117
- var thisGroup = constraintGroups [ i ] ;
128
+ for ( i = 0 ; i < groups . length ; i ++ ) {
129
+ if ( groups [ i ] [ thisID ] ) {
130
+ var thisGroup = groups [ i ] ;
118
131
119
132
var linkableAxesNoLoops = [ ] ;
120
133
for ( j = 0 ; j < linkableAxes . length ; j ++ ) {
0 commit comments