Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3386413
D8831.id30402.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D8831.id30402.diff
View Options
diff --git a/web/utils/text-utils.js b/web/utils/text-utils.js
--- a/web/utils/text-utils.js
+++ b/web/utils/text-utils.js
@@ -6,8 +6,12 @@
function calculateMaxTextWidth(
texts: $ReadOnlyArray<string>,
- font: string,
+ fontSize: number,
): number {
+ const font =
+ `${fontSize}px "Inter", -apple-system, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", ` +
+ '"Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", ui-sans-serif';
+
if (!canvas) {
canvas = document.createElement('canvas');
}
diff --git a/web/utils/tooltip-utils.js b/web/utils/tooltip-utils.js
--- a/web/utils/tooltip-utils.js
+++ b/web/utils/tooltip-utils.js
@@ -46,10 +46,6 @@
+actionButtonContent: React.Node,
};
-const font =
- '14px "Inter", -apple-system, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", ' +
- '"Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", ui-sans-serif';
-
type FindTooltipPositionArgs = {
+sourcePositionInfo: PositionInfo,
+tooltipSize: TooltipSize,
@@ -335,7 +331,7 @@
+height: number,
} {
const textWidth =
- calculateMaxTextWidth([...tooltipLabels, timestamp], font) +
+ calculateMaxTextWidth([...tooltipLabels, timestamp], 14) +
2 * tooltipLabelStyle.padding;
const buttonsWidth =
tooltipLabels.length *
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 30, 4:35 AM (20 h, 48 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2599380
Default Alt Text
D8831.id30402.diff (1 KB)
Attached To
Mode
D8831: [web] update calculateMaxTextWidth to consider different font sizes
Attached
Detach File
Event Timeline
Log In to Comment