Comments (4)
There are two reasons why this is happening:
- The
resize_canvas_to_screen_size
function, somewhat confusingly named, attempts to set thewidth
andheight
CSS properties (not the DOM attributes!) of the canvas element to the size of its parent element rounded to the nearest integer value. This then overwrites any other CSS width/height that may have been applied by users' stylesheets. This is also likely what causes the infinite expansion of the canvas when the parent element has no max width/height. - A bug in the IME/mobile text input handling code. It attempts to shrink the canvas to accomodate the space required by a touchscreen keyboard... by updating the style of the canvas. While well intentioned, the handling of that is better left to the application. I believe it is a bug because the code should not even run at all on non-mobile platforms
First issue should be addressed by:
from egui.
I dont think this will address my problem. Your still setting the canvas size in your code. (At least as far as I could tell from an inital glance) I asked for an option where the rust code does not touch the canvas dom element at all (other than drawing to it of course). Maybe I am misunderstanding your PR, in that case sorry.
from egui.
It's setting the width and height DOM attributes, not the style properties. You control the size of the canvas on the page, eframe
controls the size of the framebuffer. It has to do that, otherwise you get a stretched image.
Try clicking "play" on this MDN widget: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/canvas#result - change the width
on the <canvas>
and press run
. The green square's size doesn't change.
from egui.
You are correct. I misread this part in the rust code.
I would appreciate your improvment getting merged by the maintainers.
from egui.
Related Issues (20)
- Phantom key presses when focusing an egui/winit window HOT 3
- Configurable plot cursor "snap" radius HOT 1
- TableBuilder / available_width() HOT 1
- Smooth zooming
- High CPU usage when accesskit enabled HOT 11
- Crashing on startup HOT 4
- Zoom out the plot with right mouse drag
- Store a Ui/Frame-stack
- Sizing-pass flag
- Wayland dependencies are pulled in for eframe, even when `wayland` feature is disabled. HOT 1
- egui_plot legend: add shortcut to hide all series but this one
- Grid layout for windows HOT 3
- Input not focused when selecting text
- Tooltips jitter when first shown
- On iOS safari, clicking a text field won't always bring up the on-screen keyboard
- Focus tracking for input on web is janky
- Text field is covered by keyboard on mobile web
- Mobile keyboard should not behave like IME
- windows系统中使用自定义窗口实现拖动效果但是右键后无法再次拖动 HOT 1
- Skip `tooltip_delay` if a tooltip was recently open.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from egui.