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

Fix issues with runaway sizing of the canvas when rendering more complex things in egui #140

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,28 @@
width: 100%;
}

/* Position canvas in center-top: */
/* This presumably fixes the issue described below.
But it also fixes an issue where,
depending on what you render, the canvas may have sizing issues.

This issue lead to runaway resizing, as described here:
https://github.com/emilk/egui/discussions/4660
*/
/* Position canvas in center-top.
This is rather arbitrarily chosen.
In particular, it seems like both Chromium and Firefox will still align
the canvas on the physical pixel grid, which is required to get
pixel-perfect (non-blurry) rendering in egui.
See https://github.com/emilk/egui/issues/4241 for more */
canvas {
margin-right: auto;
margin-left: auto;
display: block;
position: absolute;
top: 0%;
left: 50%;
transform: translate(-50%, 0%);
top: 0;
left: 0;
width: 100%;
height: 100%;
}

.centered {
Expand Down