mirror of https://github.com/vector-im/riot-web
Tweak custom status menu size and placement
parent
6597e977c8
commit
fc3055f541
|
@ -79,18 +79,18 @@ export default class MemberStatusMessageAvatar extends React.Component {
|
||||||
|
|
||||||
const elementRect = e.target.getBoundingClientRect();
|
const elementRect = e.target.getBoundingClientRect();
|
||||||
|
|
||||||
// The window X and Y offsets are to adjust position when zoomed in to page
|
const x = (elementRect.left + window.pageXOffset);
|
||||||
const x = (elementRect.left + window.pageXOffset) - (elementRect.width / 2) + 3;
|
const chevronWidth = 16; // See .mx_ContextualMenu_chevron_bottom
|
||||||
const chevronOffset = 12;
|
const chevronOffset = (elementRect.width - chevronWidth) / 2;
|
||||||
let y = elementRect.top + (elementRect.height / 2) + window.pageYOffset;
|
const chevronMargin = 1; // Add some spacing away from target
|
||||||
y = y - (chevronOffset + 4); // where 4 is 1/4 the height of the chevron
|
const y = elementRect.top + window.pageYOffset - chevronMargin;
|
||||||
|
|
||||||
ContextualMenu.createMenu(StatusMessageContextMenu, {
|
ContextualMenu.createMenu(StatusMessageContextMenu, {
|
||||||
chevronOffset: chevronOffset,
|
chevronOffset: chevronOffset,
|
||||||
chevronFace: 'bottom',
|
chevronFace: 'bottom',
|
||||||
left: x,
|
left: x,
|
||||||
top: y,
|
top: y,
|
||||||
menuWidth: 190,
|
menuWidth: 226,
|
||||||
user: this.props.member.user,
|
user: this.props.member.user,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue