https://kotlinlang.org logo
i

Ian Warwick

01/09/2020, 10:37 PM
Hey folks not sure why this is happening, I have a vector that seems to draw over itself depending on how I structure my compose tree, I have two
@Composable
s, one
DrawVectorToggle()
and another version
DrawVectorToggleDRY()
The first one draws a toggle and toggles up and down fine but the second ones vector draws over the first state when toggled, anyone see anything wrong here in usage pattern that could be causing this?
this is what happens with the
DrawVectorToggleDRY()
version
The
DrawVectorToggle()
version draws vectors without the glitch when toggling
c

Chuck Jazdzewski [G]

01/10/2020, 12:33 AM
There are a couple of bugs at work here that are tripping you up, both of which we have fixed in master. First there was a vector caching bug. If the sizes of the vector graphic images are identical it doesn't realize it changed. Second, effects were not correctly memoized in this case (the + unary operator always used the same key for different source locations) which causes the same vectors objects to be used instead of different version causing the above issue to manifest. Until dev04, the easiest way to work around this, you can make the size of the vector images different in some visually indistinguishable way.
i

Ian Warwick

01/10/2020, 8:33 AM
Thanks @Chuck Jazdzewski [G] that explains it cheers 🙂
2 Views