aboutsummaryrefslogtreecommitdiff
path: root/src/client/util/ScrollBox.tsx
diff options
context:
space:
mode:
authorTyler Schicke <tyler_schicke@brown.edu>2019-02-09 19:13:24 -0500
committerTyler Schicke <tyler_schicke@brown.edu>2019-02-09 19:13:24 -0500
commit11134bc5ce01d0a025d311a4f83e67ff6e63ce1c (patch)
treee401d8004481b3d664c751ae2e668c72b6be7aac /src/client/util/ScrollBox.tsx
parentc06745a99ed85b215d0ae48bfb2af7c955f0b016 (diff)
Moved client code to client folder
Diffstat (limited to 'src/client/util/ScrollBox.tsx')
-rw-r--r--src/client/util/ScrollBox.tsx21
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