From 52c20db963dc4a6ed6a1a8ed8d649cd5a8d63b38 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Mon, 9 Dec 2019 23:58:09 +0000 Subject: [PATCH] Fix chevron offset for toRightOf Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/structures/ContextMenu.js | 2 +- src/components/views/dialogs/ShareDialog.js | 2 +- src/components/views/messages/TextualBody.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/structures/ContextMenu.js b/src/components/structures/ContextMenu.js index 455deb4708..f9fc6b84ee 100644 --- a/src/components/structures/ContextMenu.js +++ b/src/components/structures/ContextMenu.js @@ -411,7 +411,7 @@ export const toRightOf = (elementRect, chevronOffset=12) => { const left = elementRect.right + window.pageXOffset + 3; let top = elementRect.top + (elementRect.height / 2) + window.pageYOffset; top -= chevronOffset + 8; // where 8 is half the height of the chevron - return {left, top}; + return {left, top, chevronOffset}; }; // Placement method for to position context menu right-aligned and flowing to the left of elementRect diff --git a/src/components/views/dialogs/ShareDialog.js b/src/components/views/dialogs/ShareDialog.js index a45eff0d53..97e29bb7d2 100644 --- a/src/components/views/dialogs/ShareDialog.js +++ b/src/components/views/dialogs/ShareDialog.js @@ -106,7 +106,7 @@ export default class ShareDialog extends React.Component { const buttonRect = e.target.getBoundingClientRect(); const GenericTextContextMenu = sdk.getComponent('context_menus.GenericTextContextMenu'); const {close} = ContextMenu.createMenu(GenericTextContextMenu, { - ...toRightOf(buttonRect, 11), + ...toRightOf(buttonRect, 2), message: successful ? _t('Copied!') : _t('Failed to copy'), }); // Drop a reference to this close handler for componentWillUnmount diff --git a/src/components/views/messages/TextualBody.js b/src/components/views/messages/TextualBody.js index 6e06a6e7b5..fc55612b57 100644 --- a/src/components/views/messages/TextualBody.js +++ b/src/components/views/messages/TextualBody.js @@ -276,7 +276,7 @@ module.exports = createReactClass({ const buttonRect = e.target.getBoundingClientRect(); const GenericTextContextMenu = sdk.getComponent('context_menus.GenericTextContextMenu'); const {close} = ContextMenu.createMenu(GenericTextContextMenu, { - ...toRightOf(buttonRect, 11), + ...toRightOf(buttonRect, 2), message: successful ? _t('Copied!') : _t('Failed to copy'), }); e.target.onmouseleave = close;