Skip to content

Instantly share code, notes, and snippets.

@jasonLaster
Created November 27, 2016 21:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasonLaster/0743b5e11ff495b99de3c2f72b22d505 to your computer and use it in GitHub Desktop.
Save jasonLaster/0743b5e11ff495b99de3c2f72b22d505 to your computer and use it in GitHub Desktop.
diff --git a/packages/devtools-modules/client/shared/components/splitter/SplitBox.js b/packages/devtools-modules/client/shared/components/splitter/SplitBox.js
index c046762..25adc95 100644
--- a/packages/devtools-modules/client/shared/components/splitter/SplitBox.js
+++ b/packages/devtools-modules/client/shared/components/splitter/SplitBox.js
@@ -110,6 +110,8 @@ const SplitBox = React.createClass({
const win = doc.defaultView;
let size;
+ let ratio = win.devicePixelRatio || 1;
+
let { endPanelControl } = this.props;
if (this.state.vert) {
@@ -120,7 +122,7 @@ const SplitBox = React.createClass({
endPanelControl = !endPanelControl;
}
- let innerOffset = x - this.screenX();
+ let innerOffset = (x / ratio) - this.screenX();
size = endPanelControl ?
(node.offsetLeft + node.offsetWidth) - innerOffset :
innerOffset - node.offsetLeft;
@@ -129,7 +131,7 @@ const SplitBox = React.createClass({
width: size
});
} else {
- let innerOffset = y - this.screenY();
+ let innerOffset = (y / ratio) - this.screenY();
size = endPanelControl ?
(node.offsetTop + node.offsetHeight) - innerOffset :
innerOffset - node.offsetTop;
@@ -186,7 +188,7 @@ const SplitBox = React.createClass({
// Calculate splitter size
let splitterStyle = {
- flex: "0 0 " + splitterSize + "px"
+ flex: `0 0 ${ splitterSize }px`
};
return (
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment