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 text scaling and font size issues in Level Editor #752

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ShivamKR12
Copy link

@ShivamKR12 ShivamKR12 commented Jan 28, 2025

Fixes #748

Update LevelEditor and Help classes to ensure consistent text scaling and font size adjustments.

  • LevelEditor Class:

    • Add ui_scale_factor attribute for default scale.
    • Modify origin_mode_menu and local_global_menu to scale with ui_scale_factor.
    • Update update_text_scale function to scale text entities in button groups.
    • Adjust editor_camera position scaling.
    • Scale gizmo, gizmo_toggler, and quick_grabber with ui_scale_factor.
    • Scale inspector and help with ui_scale_factor.
    • Scale point_renderer model thickness.
    • Scale cubes in render_selection.
    • Scale ui in on_enable and on_disable methods.
    • Adjust entity_list_text and selected_renderer scale.
    • Update text_field scale in InspectorButton.
  • Help Class:

    • Modify tooltip scale to 1 for noticeable text size changes.

For more details, open the Copilot Workspace session.

Fixes pokepetter#748

Update `LevelEditor` and `Help` classes to ensure consistent text scaling and font size adjustments.

* **LevelEditor Class:**
  - Add `ui_scale_factor` attribute for default scale.
  - Modify `origin_mode_menu` and `local_global_menu` to scale with `ui_scale_factor`.
  - Update `update_text_scale` function to scale text entities in button groups.
  - Adjust `editor_camera` position scaling.
  - Scale `gizmo`, `gizmo_toggler`, and `quick_grabber` with `ui_scale_factor`.
  - Scale `inspector` and `help` with `ui_scale_factor`.
  - Scale `point_renderer` model thickness.
  - Scale `cubes` in `render_selection`.
  - Scale `ui` in `on_enable` and `on_disable` methods.
  - Adjust `entity_list_text` and `selected_renderer` scale.
  - Update `text_field` scale in `InspectorButton`.

* **Help Class:**
  - Modify `tooltip` scale to 1 for noticeable text size changes.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/pokepetter/ursina/issues/748?shareId=XXXX-XXXX-XXXX-XXXX).
@ShivamKR12
Copy link
Author

Hi @pokepetter,

I’ve been working on addressing the issue described in #748 and made some modifications to level_editor.py in an attempt to resolve it. The changes include:

  1. Adjusting the world_scale and scale for text_entity and text_field elements to better match the UI elements.
  2. Scaling up individual components of dropdown menus, buttons, and other UI fields to ensure consistency in layout and appearance.
  3. Adding tweaks to prevent text overlap and misalignment where possible.

Current Progress:

  • The text size issue has been partially resolved. Text now scales more appropriately in most cases, but there are still some areas where text overflow occurs (e.g., Hierarchy List and tooltips).
  • The mismatch between button sizes/UI element sizes and their corresponding text still needs to be addressed. This is especially noticeable in smaller UI elements, where the text appears larger or misaligned compared to the buttons.

Let me know if you’d like me to share the updated level_editor.py or if further adjustments should be made!

Thanks,
Shivam

@pokepetter
Copy link
Owner

What about if instead of every UI element having it's own scale factor, the UI scaler stores a single scale value and scales all the elements? I think that would be cleaner.

@ShivamKR12
Copy link
Author

Hi @pokepetter,

Thank you for your feedback! While I agree that a single global UI scaler would simplify the implementation, I believe it might be very challenging to use in this case. The reason is that the scaling values for each of the components being scaled are different from each other, as they depend on the specific requirements of the individual elements.

Could you share your thoughts or insights on how this could be approached effectively while maintaining flexibility for components with varying scale factors?

Additionally, I’m struggling to address the issue of combining text scaling with the scaling of UI elements (like buttons) in a way that avoids text overlapping or misalignment. Do you have any recommendations on how to manage this effectively?

Looking forward to hearing your thoughts!

Best regards,
@ShivamKR12

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.

Text Scaling and Font Size Issues in Level Editor
2 participants