https://kotlinlang.org logo
#compose
Title
# compose
m

Mihai Hrincescu

10/29/2019, 12:33 PM
Is there a way to align a
DrawVector
inside a container or i need to wrap the
DrawVector
with another container that gets its dimensions from the
vectorAsset
? I feel like I'm missing something.
j

Jason Ostrander

10/29/2019, 12:52 PM
I ran into this same issue. I was told it’s a bug in
DrawVector
(it always draws at the parent 0,0 coordinates) so you have to wrap it in a
Container
with the exact width/height set to the Vector size
m

Mihai Hrincescu

10/29/2019, 1:11 PM
OK, Double wrapping seems like overkill for a
DrawVector
because it generates 2 layout nodes. After looking at the current implementations i think the way to go is just to write a new component that takes some extra
prams
that just does basic canvas transforms before the draw call.
a

Andrey Kulikov

10/29/2019, 1:22 PM
we didn't add this for dev-02 but we work on this right now: https://android-review.googlesource.com/c/platform/frameworks/support/+/1148923. so for now you can wrap with an additional container, yes
👍 1