Skip to content

Commit

Permalink
minore codestyle fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nickmelnikov82 committed May 27, 2022
1 parent ee97962 commit e26eb02
Showing 1 changed file with 9 additions and 14 deletions.
23 changes: 9 additions & 14 deletions src/plots/cartesian/axes.js
Original file line number Diff line number Diff line change
Expand Up @@ -2652,25 +2652,20 @@ axes.drawOne = function(gd, ax, opts) {
function filterPush(push, automargin) {
if(!push) return push;

var keepMargin = [];

Object.keys(MARGIN_MAPPING).forEach(function(key) {
if(automargin.indexOf(key) !== -1) {
MARGIN_MAPPING[key].forEach(function(item) {
keepMargin.push(item);
});
var keepMargin = Object.keys(MARGIN_MAPPING).reduce(function(data, nextKey) {
if(automargin.indexOf(nextKey) !== -1) {
MARGIN_MAPPING[nextKey].forEach(function(key) { data[key] = 1;});
}
});
return data;
}, {});

Object.keys(push).forEach(function(key) {
if(keepMargin.indexOf(key) === -1) {
if(key.length === 1) {
push[key] = 0;
} else {
delete push[key];
}
if(!keepMargin[key]) {
if(key.length === 1) push[key] = 0;
else delete push[key];
}
});

return push;
}

Expand Down

0 comments on commit e26eb02

Please sign in to comment.