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

render: no js fit to screen alternative #725

Merged
merged 12 commits into from
Feb 25, 2023

Conversation

gavin-ts
Copy link
Contributor

@gavin-ts gavin-ts commented Jan 26, 2023

Summary

An alternative method to fit to screen without js.

Details

wide diagram before .svg

Note: you likely need to download the file (save as) for the js resizing to run.
Note the height overflows
Screen Shot 2023-01-26 at 1 24 39 PM

wide diagram after .svg

No download needed since resizing isn't via js.
Screen Shot 2023-01-26 at 1 24 32 PM

small diagram before .svg

Screen Shot 2023-01-26 at 1 25 59 PM

small diagram after .svg

Screen Shot 2023-01-26 at 1 49 28 PM

tall diagram before .svg

Screen Shot 2023-01-26 at 1 51 03 PM

tall diagram after .svg

Screen Shot 2023-01-26 at 1 48 57 PM

disabling fit can be done by setting width/height on the outer svg

Related: #721 if we add the option to enable/disable fitting

Kapture.2023-01-26.at.14.43.19.mp4

fixes #645

@gavin-ts gavin-ts marked this pull request as ready for review January 26, 2023 22:14
@gavin-ts gavin-ts requested a review from a team January 26, 2023 22:14
@alixander
Copy link
Collaborator

hold off on this, will need to look into it more later

@nhooyr
Copy link
Contributor

nhooyr commented Feb 2, 2023

@gavin-ts is the alternative method here nesting an svg under an svg?

@gavin-ts
Copy link
Contributor Author

gavin-ts commented Feb 3, 2023

@gavin-ts is the alternative method here nesting an svg under an svg?

could you clarify? are you asking how it works?

@nhooyr
Copy link
Contributor

nhooyr commented Feb 3, 2023

are you asking how it works?

Yes!

@gavin-ts
Copy link
Contributor Author

gavin-ts commented Feb 4, 2023

Yes!

oh okay so it is basically the same svg with width and height set, but viewed through the outer svg with preserveAspectRatio set to place it in the top left corner and scale it based on the outer svg's size which is just the whole window when you open it. The preserveAspectRatio attribute handles the scaling and with width/height unset on the outer svg it is based on the dimensions you open it at.

@gavin-ts
Copy link
Contributor Author

@alixander rebased, updated adding the appendix and updated watch mode

@vfosnar
Copy link
Contributor

vfosnar commented Feb 25, 2023

@alixander It looks like this actually fixes rendering when scaled in Firefox!

Original

there are clearly visible rendering issues near borders of the SVG

20230225_11h53m58s_grim

After

they are no more

20230225_11h54m03s_grim

thank you @gavin-ts!

Copy link
Collaborator

@alixander alixander left a comment

Choose a reason for hiding this comment

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

wow this works so well. well done, good riddance to a js resize script

@bo-ku-ra
Copy link
Contributor

#943 (comment)

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.

resizing script makes SVGs un-embeddable the initial display to fit the window size
6 participants