mirror of
https://github.com/SableClient/Sable.git
synced 2026-11-21 09:31:17 -08:00
refactor: adopt getMouseEventCords at the hand-rolled literals
This commit is contained in:
1 parent
791fe4451b
commit
7e5ba5d758
3 files changed
+9
-13
No files matched your search
@@ -0,0 +1,5 @@
|
||||
---
|
||||
default: patch
|
||||
---
|
||||
|
||||
Adopt the existing getMouseEventCords helper at the two remaining hand-rolled coordinate literals.
|
||||
@@ -31,7 +31,7 @@ import { useMatrixClient } from '$hooks/useMatrixClient';
|
||||
import { useRoomUnread } from '$state/hooks/unread';
|
||||
import { roomToUnreadAtom } from '$state/room/roomToUnread';
|
||||
import { usePowerLevels } from '$hooks/usePowerLevels';
|
||||
import { copyToClipboard } from '$utils/dom';
|
||||
import { copyToClipboard, getMouseEventCords } from '$utils/dom';
|
||||
import { markAsRead } from '$utils/notifications';
|
||||
import { confirm } from '$components/confirm/confirm';
|
||||
import { showToast } from '$state/toast';
|
||||
@@ -406,12 +406,7 @@ export function RoomNavItem({
|
||||
}
|
||||
|
||||
evt.preventDefault();
|
||||
setMenuAnchor({
|
||||
x: evt.clientX,
|
||||
y: evt.clientY,
|
||||
width: 0,
|
||||
height: 0,
|
||||
});
|
||||
setMenuAnchor(getMouseEventCords(evt.nativeEvent));
|
||||
};
|
||||
|
||||
const handleOpenMenu: MouseEventHandler<HTMLButtonElement> = (evt) => {
|
||||
|
||||
@@ -41,6 +41,7 @@ import {
|
||||
} from '$components/message';
|
||||
import { canEditEvent, getEditedEvent, getMemberAvatarMxc } from '$utils/room';
|
||||
import { getMxIdLocalPart, mxcUrlToHttp } from '$utils/matrix';
|
||||
import { getMouseEventCords } from '$utils/dom';
|
||||
import type { MessageSpacing } from '$state/settings';
|
||||
import { getSettings, MessageLayout, settingsAtom } from '$state/settings';
|
||||
import { useMatrixClient } from '$hooks/useMatrixClient';
|
||||
@@ -912,12 +913,7 @@ function MessageInternal(
|
||||
}
|
||||
|
||||
evt.preventDefault();
|
||||
setMenuAnchor({
|
||||
x: evt.clientX,
|
||||
y: evt.clientY,
|
||||
width: 0,
|
||||
height: 0,
|
||||
});
|
||||
setMenuAnchor(getMouseEventCords(evt.nativeEvent));
|
||||
};
|
||||
|
||||
const handleOpenMenu: MouseEventHandler<HTMLButtonElement> = (evt) => {
|
||||
|
||||
Reference in new issue
Block a user