Fix buttons not being snappable when snappable

This commit is contained in:
SerpentSpirale 2021-07-29 15:33:48 +02:00 committed by ArtDev
parent 6ec0dfbbed
commit 8b0db45d02

View File

@ -351,14 +351,14 @@ public class ControlButton extends androidx.appcompat.widget.AppCompatButton imp
//Step 2: Get Coordinates //Step 2: Get Coordinates
float button_top = button.getY(); float button_top = button.getY();
float button_bottom = button_top + button.getBottom(); float button_bottom = button_top + button.getHeight();
float button_left = button.getX(); float button_left = button.getX();
float button_right = button_left + button.getRight(); float button_right = button_left + button.getWidth();
float top = getY(); float top = getY();
float bottom = getY() + getBottom(); float bottom = getY() + getHeight();
float left = getX(); float left = getX();
float right = getX() + getRight(); float right = getX() + getWidth();
//Step 3: For each axis, we try to snap to the nearest //Step 3: For each axis, we try to snap to the nearest
if(Math.abs(top - button_bottom) < MIN_DISTANCE){ // Bottom snap if(Math.abs(top - button_bottom) < MIN_DISTANCE){ // Bottom snap