Web: Components: ContextMenu: add leftOffset prop
This commit is contained in:
parent
31fbe6f058
commit
e2a8f2a62d
@ -119,7 +119,7 @@ class ContextMenu extends Component {
|
|||||||
if (event) {
|
if (event) {
|
||||||
const rects = this.props.containerRef?.current.getBoundingClientRect();
|
const rects = this.props.containerRef?.current.getBoundingClientRect();
|
||||||
|
|
||||||
let left = rects ? rects.left : event.pageX + 1;
|
let left = rects ? rects.left - this.props.leftOffset : event.pageX + 1;
|
||||||
let top = rects ? rects.top : event.pageY + 1;
|
let top = rects ? rects.top : event.pageY + 1;
|
||||||
let width = this.menuRef.current.offsetParent
|
let width = this.menuRef.current.offsetParent
|
||||||
? this.menuRef.current.offsetWidth
|
? this.menuRef.current.offsetWidth
|
||||||
@ -392,7 +392,10 @@ ContextMenu.propTypes = {
|
|||||||
containerRef: PropTypes.any,
|
containerRef: PropTypes.any,
|
||||||
/** Scale with by container component*/
|
/** Scale with by container component*/
|
||||||
scaled: PropTypes.bool,
|
scaled: PropTypes.bool,
|
||||||
|
|
||||||
getContextModel: PropTypes.func,
|
getContextModel: PropTypes.func,
|
||||||
|
|
||||||
|
leftOffset: PropTypes.number,
|
||||||
};
|
};
|
||||||
|
|
||||||
ContextMenu.defaultProps = {
|
ContextMenu.defaultProps = {
|
||||||
@ -407,6 +410,7 @@ ContextMenu.defaultProps = {
|
|||||||
onHide: null,
|
onHide: null,
|
||||||
scaled: false,
|
scaled: false,
|
||||||
containerRef: null,
|
containerRef: null,
|
||||||
|
leftOffset: 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default ContextMenu;
|
export default ContextMenu;
|
||||||
|
Loading…
Reference in New Issue
Block a user