Skip to content

Commit

Permalink
BaseAlignment only draws when pixel is set (bug fix).
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenshank committed Mar 19, 2020
1 parent 156309a commit 97b241f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "alignment.js",
"version": "0.2.2",
"version": "0.2.3",
"main": "library.js",
"license": "MIT",
"dependencies": {
Expand Down
5 changes: 4 additions & 1 deletion src/components/BaseAlignment.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ class BaseAlignment extends Component {
}
}
componentDidUpdate() {
this.draw(this.props.x_pixel || 0, this.props.y_pixel || 0);
const { x_pixel, y_pixel } = this.props;
if (x_pixel != undefined || y_pixel != undefined) {
this.draw(x_pixel || 0, y_pixel || 0);
}
}
draw(x_pixel, y_pixel) {
if (this.props.disableVerticalScrolling) y_pixel = 0;
Expand Down
3 changes: 3 additions & 0 deletions src/components/SiteAxis.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ class SiteAxis extends Component {
$("#alignmentjs-axis-div").scrollLeft(e.detail.x_pixel);
});
}
componentDidUpdate(nextProps) {
$("#alignmentjs-axis-div").scrollLeft(this.props.x_pixel);
}
handleWheel(e) {
e.preventDefault();
this.props.scroll_broadcaster.handleWheel(e, this.props.sender);
Expand Down

0 comments on commit 97b241f

Please sign in to comment.