mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-17 08:35:37 -04:00
Mouse pass-thru (can be enabled per-button)
This commit is contained in:
parent
72ef1808f9
commit
28338f42f8
@ -197,6 +197,13 @@ public class ControlButton extends androidx.appcompat.widget.AppCompatButton imp
|
||||
public boolean onTouchEvent(MotionEvent event) {
|
||||
if (!mModifiable) {
|
||||
mCanTriggerLongClick = false;
|
||||
if(event.getAction() == MotionEvent.ACTION_MOVE && CallbackBridge.isGrabbing() && mProperties.passThruEnabled) {
|
||||
MinecraftGLView v = ((ControlLayout) this.getParent()).findViewById(R.id.main_game_render_view);
|
||||
if(v != null) {
|
||||
v.dispatchTouchEvent(event);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (mProperties.keycode >= 0) {
|
||||
if (!mProperties.isToggle) {
|
||||
switch (event.getActionMasked()) {
|
||||
|
@ -38,7 +38,7 @@ public class ControlData implements Cloneable
|
||||
* bigger device or vice versa.
|
||||
*/
|
||||
public String dynamicX, dynamicY;
|
||||
public boolean isDynamicBtn, isToggle;
|
||||
public boolean isDynamicBtn, isToggle, passThruEnabled;
|
||||
|
||||
public static ControlData[] getSpecialButtons(){
|
||||
if (SPECIAL_BUTTONS == null) {
|
||||
|
@ -115,7 +115,8 @@ public class ActionPopupWindow extends PinnedPopupWindow implements OnClickListe
|
||||
|
||||
final CheckBox checkToggle = dialog.findViewById(R.id.controlsetting_checkbox_toggle);
|
||||
checkToggle.setChecked(properties.isToggle);
|
||||
|
||||
final CheckBox checkPassthru = dialog.findViewById(R.id.controlsetting_checkbox_passthru);
|
||||
checkPassthru.setChecked(properties.passThruEnabled);
|
||||
final EditText editWidth = dialog.findViewById(R.id.controlsetting_edit_width);
|
||||
final EditText editHeight = dialog.findViewById(R.id.controlsetting_edit_height);
|
||||
editWidth.setText(Float.toString(properties.width));
|
||||
@ -205,6 +206,7 @@ public class ActionPopupWindow extends PinnedPopupWindow implements OnClickListe
|
||||
|
||||
properties.hidden = false;
|
||||
properties.isToggle = checkToggle.isChecked();
|
||||
properties.passThruEnabled = checkPassthru.isChecked();
|
||||
properties.isDynamicBtn = checkDynamicPos.isChecked();
|
||||
properties.width = Float.parseFloat(editWidth.getText().toString());
|
||||
properties.height = Float.parseFloat(editHeight.getText().toString());
|
||||
|
@ -1,6 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ScrollView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="match_parent">
|
||||
|
||||
@ -46,6 +47,12 @@
|
||||
android:text="@string/customctrl_toggle"
|
||||
android:id="@+id/controlsetting_checkbox_toggle"/>
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/controlsetting_checkbox_passthru"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
tools:text="@string/customctrl_passthru" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -215,4 +215,5 @@
|
||||
<string name="mcl_disable_gestures_subtitle">Disables gestures, such as hold to break block, and tap to place a block.</string>
|
||||
<string name="mcl_setting_title_mousespeed">Mouse Speed</string>
|
||||
<string name="mcl_setting_subtitle_mousespeed">Changes the speed of the software mouse</string>
|
||||
<string name="customctrl_passthru">Mouse pass-thru</string>
|
||||
</resources>
|
||||
|
Loading…
x
Reference in New Issue
Block a user