adjusting some touch calculation
This commit is contained in:
parent
6cf61d534a
commit
13c4f1fafb
|
@ -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) {
|
||||||
|
|
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue