Open msroid opened 4 years ago
@msroid I'll check this out.
Looks like they use a cool trick to keep the "corner buttons" consistent size here, at the very least we could apply that.
@burhanrashid52 could you assign this to me? Thanks.
Specifically they use a function called convertDpToPixel
to convert the handle to a fixed pixel size using the system screen's DPI measurement. Basically forcing the re-size of the handle to a fixed number of pixels for every redraw.
Ok, I took a closer look at this.
android-StickerView
(the repo linked in the first comment) uses a different method for scaling stickers than us:
PhotoEditor
scales stickers by adjusting the scaleX
/ scaleY
values of the frame view that wraps the ImageView
or TextView
(for text and emojis). You can see this in MultiTouchListener.kt
android-StickerView
sets scaleType
to be ImageView.ScaleType.FIT_XY
on it's images [1], then "scales" the x
and y
values manually on the ImageView
.Since android-StickerView
sets the x
and y
values directly, they don't have a view tree where the image, handles, graphic frame, etc are all scaled. Since it's just the inner image that is scaled, the handles have the same scale "transformation matrix" per se, which means they don't need adjusting.
We could use this technique for ImageView
types (stickers), but unfortunately, TextViews can't have FIT_XY
set as ScaleType
. So it wouldn't work for Text or Emoji. android-StickerView
gets around this by changing the font / dp size of the text when scaling.
The android-StickerView
technique is probably a superior solution, but it would require significant refactoring to use. Using the library directly probably isn't a good idea since hooking it into our callback system for other functionality would be difficult. The library also hasn't been updated in 5 years so I worry about long term maintenance.
Bottom Line: This is still a good idea, but it's not easy to implement. Will probably require one or two large refactorings (zoom and text / emoji frame logic) to implement. It's much more than just handle sizes.
Please use something like this for stickers and emojis. Right now it's hard to resize and rotate stickers and specially emojis and there is no option for flipping them.