adjusting some touch calculation

This commit is contained in:
tibbi 2022-09-24 22:49:15 +02:00
parent 6cf61d534a
commit 13c4f1fafb
2 changed files with 2 additions and 2 deletions

View File

@ -141,7 +141,7 @@ class MainActivity : SimpleActivity(), FlingListener {
} }
if (mLongPressedIcon != null) { if (mLongPressedIcon != null) {
home_screen_grid.draggedItemMoved(event.x.toInt(), event.y.toInt()) home_screen_grid.draggedItemMoved(getGridTouchedX(event.x), getGridTouchedY(event.y))
} }
if (mTouchDownY != -1 && !mIgnoreMoveEvents) { if (mTouchDownY != -1 && !mIgnoreMoveEvents) {

View File

@ -226,7 +226,7 @@ class HomeScreenGrid(context: Context, attrs: AttributeSet, defStyle: Int) : Vie
// show the app icon itself at dragging // show the app icon itself at dragging
val drawableX = draggedItemCurrentCoords.first - iconSize val drawableX = draggedItemCurrentCoords.first - iconSize
val drawableY = draggedItemCurrentCoords.second - (iconSize * 1.5f).toInt() val drawableY = draggedItemCurrentCoords.second - iconSize
draggedItem!!.drawable!!.setBounds(drawableX, drawableY, drawableX + iconSize, drawableY + iconSize) draggedItem!!.drawable!!.setBounds(drawableX, drawableY, drawableX + iconSize, drawableY + iconSize)
draggedItem!!.drawable!!.draw(canvas) draggedItem!!.drawable!!.draw(canvas)
} }