YCP-Swarm-Robotics-Capstone-2020-2021 / swarm-website-visualization

Visualization Software for Swarm Website
1 stars 0 forks source link

Canvas Sizing #58

Closed Mnenmenth closed 3 years ago

Mnenmenth commented 3 years ago

The canvas has to have a set height and width pixel value in the html attributes. Assigning CSS height and width will call up or down scaling and possible blurriness: https://stackoverflow.com/a/4939066

Possible solution would be to have a window onload/onresize callback to set the canvas width and height proportionally to the current window size (i.e. canvas.width = window.height * 0.75). Something to keep in mind also is that if we support the window being resized mid execution, the visualization would have to have a callback to support this as well to adjust the viewport resolution

Mnenmenth commented 3 years ago

Commit cf25aef adds a fix in JavaScript, but it should probably be moved into the actual visualization code to make it as easy as possible to just add the visualization to a webpage

Mnenmenth commented 3 years ago

Commit 3d07a6a moves the fix into the visualization itself. Some things, like how the context is being obtained, aren't being done in particularly good ways but this will be taken care of in #60 as all of these issues tie into some bigger changes/cleanup that will be made