-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
feat(web): use JS implementation of @immich-app/justified-layout #20461
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
base: main
Are you sure you want to change the base?
Conversation
Label error. Requires exactly 1 of: changelog:.*. Found: 🖥️web. A maintainer will add the required label. |
Possibly related issues: immich-app/justified-layout#9 FYI @mertalev |
This PR also adjusts the (commented out) WASM code, since the interface seems to have changed (assets may return their I could not get the WASM version running at all, even when adding But since the algorithm is now the same, I assume the WASM version would have the same optical behaviour than this PR. So it remains to be discussed whether we can solve the "line not finished" problem, since it does not look very nice, especially in shared albums with many assets of the same date. |
I completely understand that. Because of the WASM quirks I tried to provide this as JS-only implementation of the same algorithm (to have a good fallback which gives the same results). The bad wrapping needs to be addressed in the justified-layout repo, I'll open an issue. |
I updated my example and opened immich-app/justified-layout#20 |
I'd suggest starting with increasing the tolerance since it gives the algorithm more flexibility to get filled rows (0.3 was the number that I landed on earlier). |
There is room for improvement following immich-app/justified-layout#20 . I think it's fine to have a JS version as a fallback, though it's better for it to live in the justified layout repo rather than here. |
e417e0c
to
7c8ab97
Compare
I updated the JS implementation to the lastest WASM version (which is not released yet). |
Description
This PR uses an exact JS port of the
@immich-app/justified-layout
module to replacejustified-layout
.Some weeks ago, there was an attempt to use
@immich-app/justified-layout
instead of Flickr'sjustified-layout
module to render the layout boxes.However there seem to have been problems, since the WASM module requies a top-levelawait
, so this attempt was postponed.Once the WASM module becomes available, this can still be a fallback which behaves the same (see below). Also, even this JS implementation should be much faster than the
justified-layout
(I did not measure this, but since Flickr's implementation is quite complex, I assume with large timeline buckets this should already be noticable when resizing windows).How Has This Been Tested?
Tested in web.
Note: this implementation (just like the WASM version) produces slightly different results than
justified-layout
:justified-layout
sets the last line's height to the previous line's height if it is not filled while the Immich algorithm uses therowHeight
for unfinished last lines. This is not an issue here at all, it's just different (see screen recording below).rowHeight
).Screenshots (if appropriate)
Example of the last line, Flickr algorithm:
resize-old.mov
Example of the last line, Immich algorithm (notice the image in the unfinished line staying the same size):
resize-new.mov
Example of line being filled (Flickr algorithm):
wrap-old.mov
Example of line not being filled (Immich algorithm):
wrap-new.mov
Checklist:
src/services/
uses repositories implementations for database calls, filesystem operations, etc.src/repositories/
is pretty basic/simple and does not have any immich specific logic (that belongs insrc/services/
)