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

update MRTextEntity to trigger update for innerText manual changes #561

Merged
merged 3 commits into from
Apr 4, 2024

Conversation

hanbollar
Copy link
Contributor

@hanbollar hanbollar commented Apr 4, 2024

Linking

The actual fix is related to https://discord.com/channels/1137890872688660500/1219366027545149462/1225566696086044693

Most of the cleanup implementation in the pr is related to #546

Problem

Updating innerText directly only updates the DOM and not the scene itself until there is an eventUpdate or direct update call to the

Solution

initial thought - add it to the main update loop

NOTE: i'm probably going to swap that in this pr once i finish writing this to a direct - if textContent was modified, do an event trigger update, because checking every loop is hella costly

updating directly from the entity trigger √

Notes

once this pr is in, To see this live - check out the text example: https://examples.mrjs.io/examples/text.html

when locally testing (or before is in): https://localhost:8080/examples/text.html


Required to Merge

  • PASS - all necessary actions must pass (excluding the auto-skipped ones)
  • TEST IN HEADSET - main dev-testing-example and any of the other examples still work as expected
    - [ ] VIDEO - if this pr changes something visually - post a video here of it in headset-MR and/or on desktop (depending on what it affects) for the reviewer to reference.
  • TITLE - make sure the pr's title is updated appropriately as it will be used to name the commit on merge
    - [ ] BREAKING CHANGE
    • DOCUMENTATION: This includes any changes to html tags and their components
      • make a pr in the documentation repo that updates the manual docs to match the breaking change
      • link the pr of the documentation repo here: #pr
      • that pr must be approved by @lobau
    • SAMPLES/INDEX.HTML: This includes any changes (html tags or otherwise) that must be done to our landing page submodule as an effect of this pr's updates
      • make a pr in the mrjs landing page repo that updates the landing page to match the breaking change
      • link the pr of the landing page repo here: #pr
      • that pr must be approved by @hanbollar

Copy link

render bot commented Apr 4, 2024

@hanbollar hanbollar changed the title update TextSystem to check the diff every frame, not just on eventUpdate update TextSystem to check diff when textContent changes Apr 4, 2024
@hanbollar hanbollar changed the title update TextSystem to check diff when textContent changes update MRTextEntity to trigger update when textContent changes Apr 4, 2024
Signed-off-by: hanbollar <[email protected]>
@hanbollar hanbollar changed the title update MRTextEntity to trigger update when textContent changes update MRTextEntity to trigger update when innerText changes Apr 4, 2024
@hanbollar hanbollar changed the title update MRTextEntity to trigger update when innerText changes update MRTextEntity to trigger update when innerText manually changes Apr 4, 2024
@hanbollar hanbollar changed the title update MRTextEntity to trigger update when innerText manually changes update MRTextEntity to trigger update for innerText manual changes Apr 4, 2024
Signed-off-by: hanbollar <[email protected]>
*/
async connected() {
await super.connected();
_textWasManuallyUpdated() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this needed? Aren't we checking entity.textContent == entity.textObj.text every frame?

Copy link
Contributor Author

@hanbollar hanbollar Apr 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nope, we had removed that back when text updating was a big problem - right now we're only checking it when an overall eventUpdate is triggered - the TextSystem's update call is empty since it was too costly per frame: https://github.com/Volumetrics-io/mrjs/blob/main/src/core/componentSystems/TextSystem.js#L137

also in the incoming pr later where i rework some of the text system, i bring more of it into the main changes, but i still keep that update empty - didnt want to add all those system changes to this pr as even though it introduces readability and some fixes related to this - a lot of them arent needed until it gets merged

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmmm I still think there might be a need for some stuff in the main update. particularly dynamic CSS updates, which we can't detect changes to via events.

This is good for now but dynamic CSS changes is a table stakes requirement for V1.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s.g, dynamic CSS changes we can add to the main update in #546 since that's just the add of one function call - i'll keep this pr as is

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new issue #562

@hanbollar hanbollar merged commit 5af0d4b into main Apr 4, 2024
6 checks passed
@hanbollar hanbollar deleted the hb-textsys-fix branch April 4, 2024 23:17
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.

2 participants