Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3393543
D3356.id10243.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D3356.id10243.diff
View Options
diff --git a/web/chat/message-action-buttons.js b/web/chat/message-action-buttons.js
--- a/web/chat/message-action-buttons.js
+++ b/web/chat/message-action-buttons.js
@@ -20,6 +20,7 @@
ItemAndContainerPositionInfo,
MessagePositionInfo,
OnMessagePositionWithContainerInfo,
+ PositionInfo,
} from './position-types';
import { tooltipPositions, type TooltipPosition } from './tooltip-utils';
import {
@@ -67,25 +68,10 @@
return;
}
const rect = event.currentTarget.getBoundingClientRect();
- const { top, bottom, left, right, width, height } = rect;
-
- const iconPosition: ItemAndContainerPositionInfo = {
+ const iconPosition: ItemAndContainerPositionInfo = getIconPosition(
+ rect,
containerPosition,
- itemPosition: {
- top:
- top -
- containerPosition.top +
- messageActionIconExcessVerticalWhitespace,
- bottom:
- bottom -
- containerPosition.top -
- messageActionIconExcessVerticalWhitespace,
- left: left - containerPosition.left,
- right: right - containerPosition.left,
- width,
- height: height - messageActionIconExcessVerticalWhitespace * 2,
- },
- };
+ );
setPointingTo(iconPosition);
},
[containerPosition, tooltipVisible],
@@ -189,6 +175,28 @@
);
}
+function getIconPosition(
+ rect: ClientRect,
+ containerPosition: PositionInfo,
+): ItemAndContainerPositionInfo {
+ const { top, bottom, left, right, width, height } = rect;
+ return {
+ containerPosition,
+ itemPosition: {
+ top:
+ top - containerPosition.top + messageActionIconExcessVerticalWhitespace,
+ bottom:
+ bottom -
+ containerPosition.top -
+ messageActionIconExcessVerticalWhitespace,
+ left: left - containerPosition.left,
+ right: right - containerPosition.left,
+ width,
+ height: height - messageActionIconExcessVerticalWhitespace * 2,
+ },
+ };
+}
+
function getMessageActionTooltipStyle(
tooltipPosition: TooltipPosition,
): TooltipStyle {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Dec 1, 2:44 PM (18 h, 44 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2605021
Default Alt Text
D3356.id10243.diff (2 KB)
Attached To
Mode
D3356: [web] Pull `getIconPosition` out of `toggleTooltip`
Attached
Detach File
Event Timeline
Log In to Comment