diff options
author | yipstanley <stanley_yip@brown.edu> | 2019-02-10 22:12:04 -0500 |
---|---|---|
committer | yipstanley <stanley_yip@brown.edu> | 2019-02-10 22:12:04 -0500 |
commit | 69f0b463a78c82aaf78ceb6a5162431424452311 (patch) | |
tree | a54c7129f36d307420422b3babfa6da4d85db67e /src/client/util/ScrollBox.tsx | |
parent | 2e930b98726a09e597106d43a6763dd36d038771 (diff) | |
parent | 099c5823f05285fc5086c5a433658cf06dc4a04b (diff) |
Merge branch 'master' of https://github.com/browngraphicslab/Dash-Web into server_implementation
Diffstat (limited to 'src/client/util/ScrollBox.tsx')
-rw-r--r-- | src/client/util/ScrollBox.tsx | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/client/util/ScrollBox.tsx b/src/client/util/ScrollBox.tsx new file mode 100644 index 000000000..b6b088170 --- /dev/null +++ b/src/client/util/ScrollBox.tsx @@ -0,0 +1,21 @@ +import React = require("react") + +export class ScrollBox extends React.Component { + onWheel = (e: React.WheelEvent) => { + if (e.currentTarget.scrollHeight > e.currentTarget.clientHeight) { // If the element has a scroll bar, then we don't want the containing collection to zoom + e.stopPropagation(); + } + } + + render() { + return ( + <div style={{ + overflow: "auto", + width: "100%", + height: "100%", + }} onWheel={this.onWheel}> + {this.props.children} + </div> + ) + } +}
\ No newline at end of file |