Skip to content

Commit ca33fe3

Browse files
authored
Merge pull request #571 from THL-DEV/fix/keep-moving-left
Fixed the auto-scroll right bug in a scaled browser.
2 parents d47d779 + 71af413 commit ca33fe3

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1175,8 +1175,6 @@ If you are using Custom Headers then you need to add `SidebarHeader` component u
11751175

11761176
you need to add sticky to the header like [this example](https://github.com/FoothillSolutions/react-calendar-timeline/tree/dest-build/examples#sticky-header).
11771177

1178-
```
1179-
11801178
## I'm using Babel with Rollup or Webpack 2+ and I'm getting strange bugs with click events
11811179

11821180
These module bundlers don't use the transpiled (ES5) code of this module. They load the original ES2015+ source. Thus your babel configuration needs to match ours. We recommend adding the [`stage-0` preset](https://babeljs.io/docs/plugins/preset-stage-0/) to your `.babelrc` to make sure everything works as intended.

src/lib/Timeline.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -425,12 +425,10 @@ export default class ReactCalendarTimeline extends Component {
425425
(this.state.visibleTimeStart - this.state.canvasTimeStart)) /
426426
newZoom
427427
)
428-
if (this.scrollComponent.scrollLeft !== scrollLeft) {
429-
this.scrollComponent.scrollLeft = scrollLeft
430-
}
431-
432-
if (this.scrollHeaderRef.scrollLeft !== scrollLeft) {
433-
this.scrollHeaderRef.scrollLeft = scrollLeft
428+
const componentScrollLeft = Math.round(this.scrollComponent.scrollLeft);
429+
if (componentScrollLeft !== scrollLeft) {
430+
this.scrollComponent.scrollLeft = scrollLeft;
431+
this.scrollHeaderRef.scrollLeft = scrollLeft;
434432
}
435433
}
436434

@@ -1071,4 +1069,4 @@ export default class ReactCalendarTimeline extends Component {
10711069
</TimelineStateProvider>
10721070
)
10731071
}
1074-
}
1072+
}

0 commit comments

Comments
 (0)