Bug 1328895 - use clientX/Y instead of screenX/Y when moving devtools splitter;r=Honza

MozReview-Commit-ID: 54bqux7tE5f

--HG--
extra : rebase_source : d6863831aef393be9fdf2a08a29a444aef5d75ed
This commit is contained in:
Julian Descottes 2017-01-10 23:13:04 +01:00
Родитель 5261463586
Коммит e7ee70fc24
2 изменённых файлов: 6 добавлений и 9 удалений

Просмотреть файл

@ -29,9 +29,9 @@ const Draggable = React.createClass({
onMove(ev) { onMove(ev) {
ev.preventDefault(); ev.preventDefault();
// Use screen coordinates so, moving mouse over iframes // Use viewport coordinates so, moving mouse over iframes
// doesn't mangle (relative) coordinates. // doesn't mangle (relative) coordinates.
this.props.onMove(ev.screenX, ev.screenY); this.props.onMove(ev.clientX, ev.clientY);
}, },
onUp(ev) { onUp(ev) {

Просмотреть файл

@ -103,7 +103,6 @@ const SplitBox = React.createClass({
const win = doc.defaultView; const win = doc.defaultView;
let size; let size;
let ratio = win.devicePixelRatio || 1;
let { endPanelControl } = this.props; let { endPanelControl } = this.props;
if (this.state.vert) { if (this.state.vert) {
@ -114,19 +113,17 @@ const SplitBox = React.createClass({
endPanelControl = !endPanelControl; endPanelControl = !endPanelControl;
} }
let innerOffset = (x / ratio) - win.mozInnerScreenX;
size = endPanelControl ? size = endPanelControl ?
(node.offsetLeft + node.offsetWidth) - innerOffset : (node.offsetLeft + node.offsetWidth) - x :
innerOffset - node.offsetLeft; x - node.offsetLeft;
this.setState({ this.setState({
width: size width: size
}); });
} else { } else {
let innerOffset = (y / ratio) - win.mozInnerScreenY;
size = endPanelControl ? size = endPanelControl ?
(node.offsetTop + node.offsetHeight) - innerOffset : (node.offsetTop + node.offsetHeight) - y :
innerOffset - node.offsetTop; y - node.offsetTop;
this.setState({ this.setState({
height: size height: size