-
Notifications
You must be signed in to change notification settings - Fork 16
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 font size adjustment #376
Conversation
Very cool! You used one slider to control the font-size of all scope levels. We actually want to have different fontSize for different levels. The codepod/ui/src/components/nodes/Code.tsx Line 581 in 28c442e
So, it's better to use separate sliders to control each scope level individually. I.e., add six sliders to control and set the six font sizes codepod/ui/src/lib/store/settingSlice.tsx Lines 83 to 110 in 28c442e
|
But are separate sliders for different levels too much? Would letting users set the minimal font be more manageable? |
At this stage, we want to tune the parameters (ourselves). Making all font sizes configurable can better suit this need. The sliders won't show when "contextual zoom" is not enabled, so it won't be that visible. |
Good point. @lihebi |
I could also make all of them only input boxes if there are concerns with sliders taking up too much space. |
I like input boxes, as long as I can quickly use arrow keys on my keyboard to increase or decrease the value. keystrokes are more effective than mouse drags. |
I also thought about using only input boxes to save space last night. But i also liked the sliders for quick operation and more explicit visual appearance. Let’s have both the sliders and input boxes in this PR? This setting is at an alpha stage, so we can have some redundant UI here. We can refine the UI once it is ready to release. |
Sounds good 👍 |
Maybe we can consider hotkeys for those operations at the same time. For example, |
Yeah, let's add some shortcuts when we have fewer sliders in the future. |
Hello, I'm a bit confused about the first property of the contextualZoomParams. https://github.com/chimmyten/codepod/blob/main/ui/src/lib/store/settingSlice.tsx#L85C3-L93C5 |
You are right; the Essentially we just need levels 0,1,2,3 and a default value for all levels beyond 3. |
Got it, thank you. |
I added different sliders to control font sizes for different levels. AdjustableFontSizeSliders.Small.movA couple of notes/questions: I commented out a couple lines of code to prevent the pods from disappearing when the font sizes got too small. https://github.com/chimmyten/codepod/blob/817eb1ff0841b8a14b053997c9ba8618768fb5d2/ui/src/components/nodes/Code.tsx#L587-L594. Please let me know if there are any issues. |
The reason is that when your slider changes Your The preferred way is to remove // utils.ts:
export function level2fontsize(level, contextualZoomParams) {...} // move level2fontsize out of Zustand store
// Code.tsx/Rich.tsx/Scope.tsx:
import {level2fontsize} from "./utils"
function Code() {
...
contextualZoomParams = useStore(...)
...
const fontSize = level2fontsize(node?.data.level, contextualZoomParams);
} |
Thank you, that makes sense. I'll make the changes. |
Good catch. These are indeed not needed, because a collapsed scope won't have their children rendered at all. |
I applied a little clean up and code formatting. Thanks, Timmy! |
I forgot to link the issue, but this PR should fix #316. |
When contextual zoom is active, users can adjust the font size using a slider/input box in the sidebar. Fixes #345. Please let me know any feedback.
Zoomed.Font.Size.Adjustment.Small.mov