Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

contextual zoom initial font size reduction #345

Closed
wants to merge 2 commits into from

Conversation

chimmyten
Copy link
Contributor

When a pod is initially collapsed, the font size for the contextual zoom summary will be smaller. When the canvas is zoomed out past a certain point, the font size of the summary will increase to the previous set size. Fixes #316.

Contextual.Zoom.Font.Size.Change.small.mov

@lihebi
Copy link
Collaborator

lihebi commented Jun 28, 2023

How about let's make the contextualZoomParams configurable? That is, add a setting in the sidebar allowing users to override these numbers (which are the expected font sizes for each level).

// TODO Make it configurable.
contextualZoomParams: {
prev: 56,
0: 48,
1: 32,
2: 24,
3: 16,
next: 8,
threshold: 16,
},

@lihebi
Copy link
Collaborator

lihebi commented Jun 28, 2023

Also, note that the same code (for computing and setting fonts) is used in three places: Code.tsx, Rich.tsx, Scope.tsx. We might want to make them with reasonable font size.

const fontSize = level2fontsize(node?.data.level);
const parentFontSize = level2fontsize(node?.data.level - 1);
if (
contextualZoom &&
node?.data.level > 0 &&
parentFontSize * zoomLevel < threshold
) {
// The parent scope is not shown, this node is not gonna be rendered at all.
return <Box></Box>;

const fontSize = level2fontsize(node?.data.level);
const parentFontSize = level2fontsize(node?.data.level - 1);
if (
contextualZoom &&
node?.data.level > 0 &&
parentFontSize * zoomLevel < threshold
) {

const zoomLevel = useReactFlowStore((s) => s.transform[2]);
const node = nodesMap.get(id);
const level2fontsize = useStore(store, (state) => state.level2fontsize);
const fontSize = level2fontsize(node?.data.level);
const parentFontSize = level2fontsize(node?.data.level - 1);
if (
contextualZoom &&
node?.data.level > 0 &&
parentFontSize * zoomLevel < threshold
) {

@lihebi
Copy link
Collaborator

lihebi commented Jun 28, 2023

This setting-in-sidebar thing sounds like another PR. Feel free to work on it and submit another PR if you find fit.

@chimmyten
Copy link
Contributor Author

Sounds good, I'll work on implementing that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Font size for summaries in contextual zooming
2 participants