devtools-modules
Advanced tools
Comparing version 0.0.16 to 0.0.17
@@ -30,5 +30,5 @@ /* This Source Code Form is subject to the terms of the Mozilla Public | ||
ev.preventDefault(); | ||
// Use screen coordinates so, moving mouse over iframes | ||
// doesn't mangle (relative) coordinates. | ||
this.props.onMove(ev.screenX, ev.screenY); | ||
// We pass the whole event because we don't know which properties | ||
// the callee needs. | ||
this.props.onMove(ev); | ||
}, | ||
@@ -35,0 +35,0 @@ |
@@ -63,4 +63,5 @@ const React = require("react"); | ||
vert: this.props.vert, | ||
width: this.props.initialWidth || this.props.initialSize, | ||
height: this.props.initialHeight || this.props.initialSize | ||
// We use integers for these properties | ||
width: parseInt(this.props.initialWidth || this.props.initialSize), | ||
height: parseInt(this.props.initialHeight || this.props.initialSize) | ||
}; | ||
@@ -104,12 +105,2 @@ }, | ||
screenX() { | ||
// NOTE: in practice the window might have a border which calls for comparing window.outerWidth and window.innerWidth | ||
return window.screenX; | ||
}, | ||
screenY() { | ||
// NOTE: in practice the window might have a border which calls for comparing window.outerHeight and window.innerHeight | ||
return window.screenY; | ||
}, | ||
/** | ||
@@ -120,35 +111,28 @@ * Adjust size of the controlled panel. Depending on the current | ||
*/ | ||
onMove(x, y) { | ||
onMove({ movementX, movementY }) { | ||
const node = ReactDOM.findDOMNode(this); | ||
const doc = node.ownerDocument; | ||
const win = doc.defaultView; | ||
let size; | ||
let { endPanelControl } = this.props; | ||
if (this.props.endPanelControl) { | ||
// For the end panel we need to increase the width/height when the | ||
// movement is towards the left/top. | ||
movementX = -movementX; | ||
movementY = -movementY; | ||
} | ||
if (this.state.vert) { | ||
// Switch the control flag in case of RTL. Note that RTL | ||
// has impact on vertical splitter only. | ||
let dir = win.getComputedStyle(doc.documentElement).direction; | ||
if (dir == "rtl") { | ||
endPanelControl = !endPanelControl; | ||
const isRtl = doc.dir === "rtl"; | ||
if (isRtl) { | ||
// In RTL we need to reverse the movement again -- but only for vertical | ||
// splitters | ||
movementX = -movementX; | ||
} | ||
let innerOffset = x - this.screenX(); | ||
size = endPanelControl ? | ||
(node.offsetLeft + node.offsetWidth) - innerOffset : | ||
innerOffset - node.offsetLeft; | ||
this.setState({ | ||
width: size | ||
}); | ||
this.setState((state, props) => ({ | ||
width: state.width + movementX | ||
})); | ||
} else { | ||
let innerOffset = y - this.screenY(); | ||
size = endPanelControl ? | ||
(node.offsetTop + node.offsetHeight) - innerOffset : | ||
innerOffset - node.offsetTop; | ||
this.setState({ | ||
height: size | ||
}); | ||
this.setState((state, props) => ({ | ||
height: state.height + movementY | ||
})); | ||
} | ||
@@ -155,0 +139,0 @@ }, |
{ | ||
"name": "devtools-modules", | ||
"version": "0.0.16", | ||
"version": "0.0.17", | ||
"description": "DevTools Modules from M-C", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10
41734
1168