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

Daniel

03/01/2021, 12:10 PM
I'm writing an ebook reader. I needed custom text drawing, so I needed to implement my own text selection. I've got that mostly working using ~700 lines of code copied from Jetpack compose internal and private functions and lightly modified. My current problem is that I detect drag events on the handles, but the handles are very small. The unit of selection is the character or word, and the handles should be at the start and end of the selection. That means the handles should jump as you drag them. The problem is then that as you drag the pointer goes temporarily out of the touch area for the handle between snaps, and thus I don't get drag events. I could just add some padding around the handles to increase the touch area, but that wouldn't have quite the behavior I want. I want to specify that a drag event must start with a pointer down in a small area, but can continue with a pointer move in a larger area. I could also just implement that myself (looking at the source PointerInputScope.detectDragGestures, it seems relatively straightforward) but I want to make sure there isn't a better way to do this. I'm also a bit puzzled by why Jetpack's implementation of handles doesn't run into the same issues, as it's almost the same code as I'm using.
j

jim

03/01/2021, 3:03 PM
cc @Siyamed
d

Daniel

03/01/2021, 3:04 PM
Thanks @jim. I want to make sure I'm not spamming you people though, you already cc'ed him on another more general question I asked
👍 1
12 Views