Skip to content

Conversation

caizoryan
Copy link
Contributor

@caizoryan caizoryan commented Feb 21, 2025

Support for css scaling for BlockCursor based on this commit

Everything works as expected...

scaling.mp4

... except font scaling. I'm not sure what the correct way to scale the font would be.

style.fontFamily, style.fontSize, style.fontWeight, style.color,
primary ? "cm-fat-cursor cm-cursor-primary" : "cm-fat-cursor cm-cursor-secondary",
letter, hCoeff != 1)
return new Piece(left - base.left, pos.top - base.top + h * (1 - hCoeff), h * hCoeff, style.fontFamily, parseFloat(style.fontSize) * view.scaleX + "px", style.fontWeight, style.color, primary ? "cm-fat-cursor cm-cursor-primary" : "cm-fat-cursor cm-cursor-secondary", letter, hCoeff != 1)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please keep the old formatting for readability.
As for parseFloat(style.fontSize) * view.scaleX, this does not work when scaleX and scaleY are different, and when they are the same, it still causes small mismatch in the appearance of letter inside cursor and inside the editor, so i think we need to find a different way of applying the scale. E.g. maybe we can skip applying the transform online 97 and change the way we calculate sizes?

@nightwing nightwing merged commit 53fcdc9 into replit:master Mar 26, 2025
3 checks passed
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.

2 participants