Giter Site home page Giter Site logo

navigator's People

Stargazers

 avatar

Watchers

 avatar

navigator's Issues

Scrolling animation jumps around when moving upwards out of the viewport

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!

SVGs scaled and positioned incorrectly

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):

image

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:

"image/svg+xml" -> loadSvgResource(contentInputStream, localDensity)

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?

Tests for `Preview` component are flaky

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!

False positive for BlockingMethodInNonBlockingContext compilation warning?

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:

val imagePreviewPainter by produceState<Painter?>(initialValue = null, contentReadable, localDensity) {
withContext(Dispatchers.IO) {
val contentInputStream = contentReadable.contentInputStream()
@Suppress("BlockingMethodInNonBlockingContext")
value = when (contentReadable.contentType) {
"image/svg" -> loadSvgResource(contentInputStream, localDensity)
else -> BitmapPainter(
Image.makeFromEncoded(contentInputStream.readAllBytes()).asImageBitmap()
)
}
}
}

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?

Tooltips: Detection of ellipsized tree node labels doesn't work

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:

var wasLabelTruncated: Boolean by remember { mutableStateOf(false) }
BoxWithTooltip(tooltip = {
if (wasLabelTruncated) Surface {
Text(
viewNode.node.label,
Modifier.padding(12.dp)
)
}
}) {

Text(
viewNode.node.label,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
onTextLayout = { wasLabelTruncated = it.isLineEllipsized(0) }
)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.