Fix a bug so when user clicks the SeekBarPanel, the x coordinate with the correct x-offset is sent to SeekBar.
This commit is contained in:
1 parent
c8c0a3aae0
commit
a0e957b1fd
1 file changed
+4
-2
@@ -21,6 +21,7 @@ import android.graphics.Rect;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.SeekBar;
|
||||
|
||||
@@ -54,8 +55,9 @@ public class SeekBarPanel extends LinearLayout {
|
||||
if (mSeekBar == null) {
|
||||
return super.onTouchEvent(event);
|
||||
} else {
|
||||
final float offsetX = -mSeekBar.getLeft();
|
||||
final float offsetY = -mSeekBar.getTop();
|
||||
View containingView = (View) mSeekBar.getParent();
|
||||
final float offsetX = -(containingView.getLeft() + mSeekBar.getLeft());
|
||||
final float offsetY = -(containingView.getTop() + mSeekBar.getTop());
|
||||
event.offsetLocation(offsetX, offsetY);
|
||||
mSeekBar.onTouchEvent(event);
|
||||
event.offsetLocation(-offsetX, -offsetY);
|
||||
|
||||
Reference in new issue
Block a user