Skip to content

Commit abd4bcf

Browse files
committed
move axis range/autorange/domain regex to module scope
1 parent 23964ca commit abd4bcf

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/plot_api/plot_api.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1721,6 +1721,10 @@ exports.relayout = function relayout(gd, astr, val) {
17211721
});
17221722
};
17231723

1724+
var AX_RANGE_RE = /^[xyz]axis[0-9]*\.range(\[[0|1]\])?$/;
1725+
var AX_AUTORANGE_RE = /^[xyz]axis[0-9]*\.autorange$/;
1726+
var AX_DOMAIN_RE = /^[xyz]axis[0-9]*\.domain(\[[0|1]\])?$/;
1727+
17241728
function _relayout(gd, aobj) {
17251729
var layout = gd.layout,
17261730
fullLayout = gd._fullLayout,
@@ -1834,11 +1838,11 @@ function _relayout(gd, aobj) {
18341838
fullLayout[ai] = gd._initialAutoSize[ai];
18351839
}
18361840
// check autorange vs range
1837-
else if(pleafPlus.match(/^[xyz]axis[0-9]*\.range(\[[0|1]\])?$/)) {
1841+
else if(pleafPlus.match(AX_RANGE_RE)) {
18381842
recordAlteredAxis(pleafPlus);
18391843
Lib.nestedProperty(fullLayout, ptrunk + '._inputRange').set(null);
18401844
}
1841-
else if(pleafPlus.match(/^[xyz]axis[0-9]*\.autorange$/)) {
1845+
else if(pleafPlus.match(AX_AUTORANGE_RE)) {
18421846
recordAlteredAxis(pleafPlus);
18431847
Lib.nestedProperty(fullLayout, ptrunk + '._inputRange').set(null);
18441848
var axFull = Lib.nestedProperty(fullLayout, ptrunk).get();
@@ -1848,7 +1852,7 @@ function _relayout(gd, aobj) {
18481852
axFull._input.domain = axFull._inputDomain.slice();
18491853
}
18501854
}
1851-
else if(pleafPlus.match(/^[xyz]axis[0-9]*\.domain(\[[0|1]\])?$/)) {
1855+
else if(pleafPlus.match(AX_DOMAIN_RE)) {
18521856
Lib.nestedProperty(fullLayout, ptrunk + '._inputDomain').set(null);
18531857
}
18541858

0 commit comments

Comments
 (0)