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

High resolution rendering #896

Merged
merged 5 commits into from
Nov 24, 2024
Merged

High resolution rendering #896

merged 5 commits into from
Nov 24, 2024

Conversation

jaredkhan
Copy link
Collaborator

@jaredkhan jaredkhan commented Nov 13, 2024

Resolves #891

Before
image

After
image

Copy link
Collaborator Author

@jaredkhan jaredkhan left a comment

Choose a reason for hiding this comment

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

Turns out to be a fairly small change at the core that doesn't require any updates in projections or whatever, so filters through nicely to other views, OTOP and other trees too.

OZprivate/rawJS/OZTreeModule/src/tree_state.js Outdated Show resolved Hide resolved
OZprivate/rawJS/OZTreeModule/src/tree_state.js Outdated Show resolved Hide resolved
@jaredkhan jaredkhan marked this pull request as ready for review November 13, 2024 21:38
@jrosindell
Copy link
Member

jrosindell commented Nov 13, 2024

@jaredkhan looks brilliant - thanks for posting.

Copy link
Member

@jrosindell jrosindell left a comment

Choose a reason for hiding this comment

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

Looks great, thanks for solving this.

Copy link
Collaborator

@lentinj lentinj left a comment

Choose a reason for hiding this comment

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

This seems like a very definite improvement, good stuff!

OZprivate/rawJS/OZTreeModule/src/render/renderer.js Outdated Show resolved Hide resolved
OZprivate/rawJS/OZTreeModule/src/controller/controller.js Outdated Show resolved Hide resolved
@hyanwong
Copy link
Member

hyanwong commented Nov 16, 2024

Great, shall I merge this now @lentinj ?

@davidebbo
Copy link
Collaborator

Let's hold off, I found a bad issue. It works great on my external monitor, but on my laptop's monitor, it starts flashing like crazy and the site is essentially unusable. If you can't repro, let's work together to try to figure this out.

@@ -122,15 +122,17 @@ class Controller {
return;
}
call_hook("before_draw");
if ((tree_state.widthres != this.canvas.clientWidth)||(tree_state.heightres != this.canvas.clientHeight))
if ((tree_state.widthres != this.canvas.clientWidth)
||(tree_state.widthres * window.devicePixelRatio != this.canvas.width)
Copy link
Collaborator

Choose a reason for hiding this comment

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

If window.devicePixelRatio is not an integer (e.g. it's 2.5 in my case), you can end up with tree_state.widthres * window.devicePixelRatio not being an integer, so it will never match this.canvas.width, which gets rounded. This causes the canvas to be set up continually, causing endless flashing.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Flooring it fixes it:

      if ((tree_state.widthres != this.canvas.clientWidth)
        || (Math.floor(tree_state.widthres * window.devicePixelRatio) != this.canvas.width)
        || (tree_state.heightres != this.canvas.clientHeight)
        || (Math.floor(tree_state.heightres * window.devicePixelRatio) != this.canvas.height)) {

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ah great spot David thanks for this!
Have pushed that change throughout.

@davidebbo
Copy link
Collaborator

I found a small regression: with the new code, I need to zoom in significantly more on a leaf before it makes it to the URL. It doesn't happen until the leaf fills the entire screen, which is not something that would normally happen.

@davidebbo
Copy link
Collaborator

I found a small regression: with the new code, I need to zoom in significantly more on a leaf before it makes it to the URL. It doesn't happen until the leaf fills the entire screen, which is not something that would normally happen.

Hmmm, for some reason I don't see this now! Maybe it has to get into that state somehow. If no one else sees this, maybe we can ignore it (but I did see it! 😃)

@lentinj
Copy link
Collaborator

lentinj commented Nov 18, 2024

Hmmm, for some reason I don't see this now! Maybe it has to get into that state somehow.

You're not making this up! This is definitely possible, but I'd be very surprised if it was a related regression. This is most likely largest_visible_node / #547 tripping you up. "Visible" in this case may just be the invisible corner of the bounding box.

@davidebbo
Copy link
Collaborator

You're not making this up! This is definitely possible, but I'd be very surprised if it was a related regression. This is most likely largest_visible_node / #547 tripping you up. "Visible" in this case may just be the invisible corner of the bounding box.

Ah, good to know. Then let's definitely ignore it in the context of this change.

@davidebbo
Copy link
Collaborator

@lentinj is there anything needed before we can get his one approved? I think @hyanwong is waiting for this to kick off a new release. Thanks!

@lentinj
Copy link
Collaborator

lentinj commented Nov 19, 2024

@davidebbo glancing at the code it looks good to me, but I'd like to play with it first if there's time. I've tried to merge the 2 chunks of canvas-size-setting-code in the past and failed, if I can remember why it'd be good to see if it's still an issue.

@davidebbo
Copy link
Collaborator

@lentinj Yep, makes sense to take the time to play with it based on your previous experience.

I'm just eager as once I played with it on my big 4K monitor, there is no going back! 😄

@jaredkhan
Copy link
Collaborator Author

Fixed a regression with the 'life_expert' page's screenshot tool where it was not clipping the result correctly. Just applied the same scale factor to that.

@hyanwong
Copy link
Member

I'm keen to merge this: do you think it's ready @lentinj? There currently seems to me a conflict in renderer.js though?

@davidebbo
Copy link
Collaborator

Indeed there is a conflict. As far as I can see, refresh_by_image is not used, and probably doesn't need to be in this PR. Right @jaredkhan ?

@jaredkhan
Copy link
Collaborator Author

Yeah that’s right @davidebbo. That function (which required updates in this PR) was removed by another PR that was merged recently. So just scrap that function now.

Re merging this: can always revert it if there is something glaring that we’re missing?

@davidebbo
Copy link
Collaborator

Re merging this: can always revert it if there is something glaring that we’re missing?

Yes. Also, we can start by putting this in the extinct tree which has a much smaller audience. And maybe the beta site? Then if we don't see issues after a few days of playing with it, we can pull it in the main site.

@hyanwong
Copy link
Member

Definitely we can merge it and test on the extinct tree and then beta.onezoom.org too. I'm happy to press "merge" if we all thing this is generally fine.

@hyanwong
Copy link
Member

(but could you fix the merge conflict before I merge, @jaredkhan? - thanks)

@jaredkhan
Copy link
Collaborator Author

Conflicts resolved @hyanwong

@hyanwong hyanwong merged commit bc4633c into OneZoom:main Nov 24, 2024
1 check passed
@hyanwong
Copy link
Member

Thanks so much for this @jaredkhan . Such great work. It is now merged and is the version running the extinct tree at https://www.onezoom.org/extinct/life/ if you want to try it out.

@jaredkhan
Copy link
Collaborator Author

Wicked, thanks for the feedback everyone. New extinct tree is looking great with all those images!

@jaredkhan jaredkhan deleted the high-res branch December 4, 2024 19:29
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.

Low resolution
5 participants