theRAPTLab / meme-2023

MEME 2023 grant development (fork from MEME 2018)
MIT License
0 stars 0 forks source link

dev-tv/fix-offscreen-entity: Fixes #7 caused by UpdateDimensions() wrong height #17

Closed villagrat closed 2 weeks ago

villagrat commented 3 weeks ago

Summary

This PR fixes #7 where entities and models were being displayed offscreen when created. The issue was identified in the ViewMain.jsx file and has been addressed by modifying the calculation of viewHeight. Also we applied the styled util to a container <div /> element on ViewMainto avoid new entities/outcomes be covered by the sidebar


User-visible changes:

Entities and models are now correctly displayed within the screen boundaries when created.


Developer-relevant changes:

The calculation of viewHeight in ViewMain.jsx has been modified.


Testing Steps

  1. Pull the changes from the branch dev-tv/fix-outcome-entity-displayed-offscreen.
  2. Run the application.
  3. Create a new entity or model.
  4. Verify that the new entity or model is displayed within the screen boundaries.

Technical Notes

Changes to viewHeight calculation:

The line viewHeight: Math.min(viewHeight, innerHeight) was using Math.min to calculate the viewHeight. This was causing the container height to be set to 0, putting newly created entities offscreen when either viewHeight or innerHeight was 0. The calculation has been changed to use Math.max instead, ensuring that viewHeight is the larger of the two values.