Skip to content

Add option to toggle ruler visibility#1479

Merged
Keavon merged 9 commits into
GraphiteEditor:masterfrom
zeroishero:master
Nov 28, 2023
Merged

Add option to toggle ruler visibility#1479
Keavon merged 9 commits into
GraphiteEditor:masterfrom
zeroishero:master

Conversation

@zeroishero

@zeroishero zeroishero commented Nov 26, 2023

Copy link
Copy Markdown
Contributor

Closes #1416
I added the menu, and made it send message to frontend to conditionally render the rulers element in svelte. I am using UpdateDocumentRuler and sending visible which is updated to rulersVisible. It works as intended but the markings and text is not being displayed. Here, as far as I know, the values necessary for computing markings and text is sent using UpdateDocumentRuler, and it has the data. I also tried updating spaces and interval and it did update it.

I watched the contribution video as guided by @Keavon and the process does match. I had tried making ToggleRuler message but it didn't send the data related to rulers along with it.

@0HyperCube

Copy link
Copy Markdown
Contributor

@zeroishero the issue is that the svg for the numbers is set with width=0 and height=0. This can be fixed by adding onMount(resize); to RulerInput.svelte. You may need to add import { onMount } from "svelte"; at the top of the js script.

@0HyperCube 0HyperCube marked this pull request as draft November 26, 2023 17:28
@0HyperCube

0HyperCube commented Nov 26, 2023

Copy link
Copy Markdown
Contributor

Note that the tests failed to because of the new rulers_visible field prevents the document for deserialising. To fix this you can simply set serde to use a default value of true - see serde-rs/serde#1030 (comment).

@zeroishero zeroishero marked this pull request as ready for review November 27, 2023 07:28

@0HyperCube 0HyperCube left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Works well, thanks for this contribution.

Comment thread package-lock.json Outdated
@0HyperCube 0HyperCube changed the title View Rulers. Help needed. Add option to toggle ruler visibility Nov 27, 2023
@Keavon

Keavon commented Nov 28, 2023

Copy link
Copy Markdown
Member

I just completed my code review and pushed some improvements split out into several commits. So you can learn from the changes I made, I'd encourage you to read over each of the commits. One other note for future consideration: when submitting PRs, please do so from a branch in your fork other than master so we can check out your branch without its name conflicting with our copy of master, and to make it easier for you to keep your local fork up to date with our master branch (since there will be conflicting history when your work is based on master). Thanks for this feature, congrats on your contribution!

@Keavon Keavon merged commit 4fead6e into GraphiteEditor:master Nov 28, 2023
@Keavon

Keavon commented Nov 28, 2023

Copy link
Copy Markdown
Member

!build

@github-actions

Copy link
Copy Markdown
📦 Build Complete for 4cddea5
https://ad8a61c6.graphite.pages.dev

@zeroishero

Copy link
Copy Markdown
Contributor Author

I was waiting for it to be reviewed and planned to make recommended changes myself. Anyway, thanks. I will look at changes.

@Keavon

Keavon commented Nov 28, 2023

Copy link
Copy Markdown
Member

Yeah, sometimes we do code review by leaving comments, other times it's just easier to fix the things directly and push them. Having you fix the comments is better for your learning but more effort to describe on my part, so I took the more efficient route this time. I hope you can learn from the commit message + implementation to see. I also followed this up with one more commit which fixed a bug that I introduced (but didn't notice until after merging), so consider this change to be a part of the things you look at to learn through osmosis: 9224ed9

Thanks again!

@Keavon

Keavon commented Jun 13, 2026

Copy link
Copy Markdown
Member

Hi @zeroishero, thanks again for this code contribution to the project! We're still hoping you will respond to the request to relicense this code. Please see #4208 ASAP, thank you!

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.

Add a View > Rulers toggle to disable rulers

3 participants