Bug 1312687 - devtools-side-splitter now moves the correct direction in RTL locales r?ntim draft
authorNick <nick@foxsec.io>
Thu, 02 Mar 2017 13:03:41 -0500
changeset 492676 2a4d97aab5cc
parent 491665 e91de6fb2b3d
child 547720 fb636868546b
push id47602
push usernick@foxsec.io
push dateFri, 03 Mar 2017 02:27:07 +0000
reviewersntim
bugs1312687
milestone54.0a1
Bug 1312687 - devtools-side-splitter now moves the correct direction in RTL locales r?ntim MozReview-Commit-ID: CpSZwZSstgX
devtools/client/shared/components/h-split-box.js
--- a/devtools/client/shared/components/h-split-box.js
+++ b/devtools/client/shared/components/h-split-box.js
@@ -102,17 +102,19 @@ module.exports = createClass({
   _onMouseMove(event) {
     if (!this.state.mouseDown) {
       return;
     }
 
     const rect = this.refs.box.getBoundingClientRect();
     const { left, right } = rect;
     const width = right - left;
-    const relative = event.clientX - left;
+    const direction = this.refs.box.ownerDocument.dir;
+    const relative = direction == "rtl" ? right - event.clientX
+                                        : event.clientX - left;
     this.props.onResize(relative / width);
 
     event.preventDefault();
   },
 
   render() {
     /* eslint-disable no-shadow */
     const { start, end, startWidth, minStartWidth, minEndWidth } = this.props;