manu-unter / navigator Goto Github PK
View Code? Open in Web Editor NEWA file system navigator, written as a test assignment for JetBrains
A file system navigator, written as a test assignment for JetBrains
When using the keyboard to select a row which is above the current viewport, the animation which moves the selected item into the viewport jumps around instead of being a smooth glide. It first moves the selected item way too far down and then slowly slides it back up to end up in the right target position.
I believe I'm not doing anything wrong in my code and I'm suspecting that there is a bug in the underlying animateScrollToItem
implementation, but I'd be happy about any help!
It looks like the SVG preview is currently not being scaled and/or positioned correctly when the device pixel density is higher than 1 (1.5 in this example):
The image should be centered but it is not. I believe it is reporting scaled dimensions while the graphics aren't scaled during drawing and then end up being smaller than they should be. It also looks like the font size is correctly adhering to the factor while the shapes aren't.
And this is even though I'm passing the current LocalDensity
to loadSvgResource
:
navigator/src/main/kotlin/Preview.kt
Line 94 in ed02671
Do I need to pass this number somewhere again? I was assuming that passing this number to the painter once should ensure correct scaling - and it looks like it is already doing part of that since the image is not centered correctly. I believe this is because it is reporting the dimensions it should really use based on the density, but the scaling factor is maybe not passed to the paint method which really does the drawing?
All tests for the Preview
component which involve reading the image file data seem to contain a race condition which causes them to fail or pass randomly.
I tried to solve it with an IdlingResource
as described in the original Jetpack Compose testing documentation, but that doesn't seem to solve it entirely.
Is there something about the Skija/Skiko image processing that the testing setup doesn't catch yet?
I would be happy for any hints on how to make this stable!
The tests for the custom Modifier.sequentiallyDoubleClickable
don't currently work. It seems to be because the tests don't wait for the click event processing to go through but I'm not sure how I can enforce that.
I would be happy for any pointers as to how I can get those tests to work!
In my ImagePreview
component, I need to read the image bytes from the file input stream in their entirety since they need to be handed over to skija as a byte[]
. That's potentially heavy blocking operation, which is why I wrapped it into a withContext(Dispatchers.IO)
block and wait for the result in a produceState
block:
navigator/src/main/kotlin/Preview.kt
Lines 57 to 69 in 89de9d9
I believe this should be enough to unblock the main thread - it definitely doesn't become unresponsive when loading large images - and I don't know if I could do any better than this.
I still get a compiler warning about an Inappropriate thread-blocking method call
on the readAllBytes()
call.
Is this a false positive which I can @Suppress
without worrying or is there really something here that I should fix?
Something about the coroutine setup with listing large directories is not working as expected - when I open my Windows directory, it still freezes for a few seconds.
I was planning to show a tooltip for every tree node with an ellipsized label due to insufficient space. It seems like either I'm doing something wrong or the isLineEllipsized
method on the TextLayoutResult
passed into onTextLayout
doesn't work as expected. It always returns false
for me even though I see the text being ellipsized and even though I'm passing maxLines = 1
.
See the relevant code:
navigator/src/main/kotlin/DirectoryTreeItem.kt
Lines 45 to 53 in 627e7a0
navigator/src/main/kotlin/DirectoryTreeItem.kt
Lines 95 to 100 in 627e7a0
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.