Skip to content

Commit

Permalink
Merge pull request uber#139 from uber/animated-grid-lines
Browse files Browse the repository at this point in the history
Add missing animation to grid lines
  • Loading branch information
jckr authored Sep 2, 2016
2 parents 4c72518 + fc9d583 commit 48a26b3
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/lib/plot/grid-lines.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import React from 'react';
import PureRenderComponent from '../pure-render-component';
import {getAttributeScale} from '../utils/scales-utils';
import Animation from '../animation';

import {
getTicksTotalFromSize,
Expand Down Expand Up @@ -61,6 +62,12 @@ const defaultProps = {
direction: VERTICAL
};

const animatedProps = [
'xRange', 'yRange', 'xDomain', 'yDomain',
'width', 'height', 'marginLeft', 'marginTop', 'marginRight', 'marginBottom',
'tickTotal'
];

class GridLines extends PureRenderComponent {

_getDefaultProps() {
Expand All @@ -85,6 +92,15 @@ class GridLines extends PureRenderComponent {
}

render() {
const {animation} = this.props;
if (animation) {
return (
<Animation {...this.props} {...{animatedProps}}>
<GridLines {...this.props} animation={null}/>
</Animation>
);
}

const props = {
...this._getDefaultProps(),
...this.props
Expand Down

0 comments on commit 48a26b3

Please sign in to comment.