Improve ToolApp edge back gesture sensitivity
This commit is contained in:
@@ -100,11 +100,11 @@ var ConfigValidator = {
|
|||||||
LONG_PRESS_TRIGGERED_MOVE_SLOP_DP: { type: "int", min: 8, max: 80, default: 28 },
|
LONG_PRESS_TRIGGERED_MOVE_SLOP_DP: { type: "int", min: 8, max: 80, default: 28 },
|
||||||
LONG_PRESS_VIBRATE_MS: { type: "int", min: 10, max: 100, default: 40 },
|
LONG_PRESS_VIBRATE_MS: { type: "int", min: 10, max: 100, default: 40 },
|
||||||
CLICK_SLOP_DP: { type: "int", min: 2, max: 20, default: 6 },
|
CLICK_SLOP_DP: { type: "int", min: 2, max: 20, default: 6 },
|
||||||
TOOLAPP_BACK_EDGE_WIDTH_DP: { type: "int", min: 1, max: 120, default: 36 },
|
TOOLAPP_BACK_EDGE_WIDTH_DP: { type: "int", min: 1, max: 120, default: 56 },
|
||||||
ENABLE_TOOLAPP_INNER_BACK_STRIPS: { type: "bool", default: false },
|
ENABLE_TOOLAPP_INNER_BACK_STRIPS: { type: "bool", default: false },
|
||||||
ENABLE_TOOLAPP_SCREEN_BACK_STRIPS: { type: "bool", default: false },
|
ENABLE_TOOLAPP_SCREEN_BACK_STRIPS: { type: "bool", default: false },
|
||||||
TOOLAPP_BACK_COMMIT_DISTANCE_DP: { type: "int", min: 1, max: 480, default: 48 },
|
TOOLAPP_BACK_COMMIT_DISTANCE_DP: { type: "int", min: 1, max: 480, default: 36 },
|
||||||
TOOLAPP_BACK_PROGRESS_DISTANCE_DP: { type: "int", min: 1, max: 720, default: 120 },
|
TOOLAPP_BACK_PROGRESS_DISTANCE_DP: { type: "int", min: 1, max: 720, default: 96 },
|
||||||
|
|
||||||
// 功能开关
|
// 功能开关
|
||||||
ENABLE_SNAP_TO_EDGE: { type: "bool", default: true },
|
ENABLE_SNAP_TO_EDGE: { type: "bool", default: true },
|
||||||
@@ -736,11 +736,11 @@ var ConfigManager = {
|
|||||||
LONG_PRESS_MS: 520,
|
LONG_PRESS_MS: 520,
|
||||||
LONG_PRESS_TRIGGERED_MOVE_SLOP_DP: 28,
|
LONG_PRESS_TRIGGERED_MOVE_SLOP_DP: 28,
|
||||||
CLICK_SLOP_DP: 6,
|
CLICK_SLOP_DP: 6,
|
||||||
TOOLAPP_BACK_EDGE_WIDTH_DP: 36,
|
TOOLAPP_BACK_EDGE_WIDTH_DP: 56,
|
||||||
ENABLE_TOOLAPP_INNER_BACK_STRIPS: false,
|
ENABLE_TOOLAPP_INNER_BACK_STRIPS: false,
|
||||||
ENABLE_TOOLAPP_SCREEN_BACK_STRIPS: false,
|
ENABLE_TOOLAPP_SCREEN_BACK_STRIPS: false,
|
||||||
TOOLAPP_BACK_COMMIT_DISTANCE_DP: 48,
|
TOOLAPP_BACK_COMMIT_DISTANCE_DP: 36,
|
||||||
TOOLAPP_BACK_PROGRESS_DISTANCE_DP: 120,
|
TOOLAPP_BACK_PROGRESS_DISTANCE_DP: 96,
|
||||||
ENABLE_BOUNCE: true,
|
ENABLE_BOUNCE: true,
|
||||||
BOUNCE_TIMES: 2,
|
BOUNCE_TIMES: 2,
|
||||||
BOUNCE_MAX_SCALE: 0.88,
|
BOUNCE_MAX_SCALE: 0.88,
|
||||||
|
|||||||
@@ -1070,13 +1070,13 @@ FloatBallAppWM.prototype.createToolAppEdgeBackStrip = function(edge) {
|
|||||||
var mx = event.getRawX() - downX;
|
var mx = event.getRawX() - downX;
|
||||||
var my = event.getRawY() - downY;
|
var my = event.getRawY() - downY;
|
||||||
var validDir = (edge === 0 && mx > 0) || (edge === 1 && mx < 0);
|
var validDir = (edge === 0 && mx > 0) || (edge === 1 && mx < 0);
|
||||||
if (validDir && Math.abs(mx) > self.dp(4) && Math.abs(mx) > Math.abs(my)) {
|
if (validDir && Math.abs(mx) > self.dp(3) && Math.abs(mx) > Math.abs(my) * 0.85) {
|
||||||
if (!moved) {
|
if (!moved) {
|
||||||
try { safeLog(self.L, 'd', 'edge strip move edge=' + String(edge) + ' mx=' + String(mx)); } catch(eMoveLog) {}
|
try { safeLog(self.L, 'd', 'edge strip move edge=' + String(edge) + ' mx=' + String(mx)); } catch(eMoveLog) {}
|
||||||
}
|
}
|
||||||
moved = true;
|
moved = true;
|
||||||
var triggerDp = Number(self.config.TOOLAPP_BACK_PROGRESS_DISTANCE_DP || 180);
|
var triggerDp = Number(self.config.TOOLAPP_BACK_PROGRESS_DISTANCE_DP || 96);
|
||||||
if (isNaN(triggerDp)) triggerDp = 180;
|
if (isNaN(triggerDp)) triggerDp = 96;
|
||||||
if (triggerDp < 1) triggerDp = 1;
|
if (triggerDp < 1) triggerDp = 1;
|
||||||
if (triggerDp > 720) triggerDp = 720;
|
if (triggerDp > 720) triggerDp = 720;
|
||||||
var triggerDistance = self.dp(triggerDp);
|
var triggerDistance = self.dp(triggerDp);
|
||||||
@@ -1088,13 +1088,13 @@ FloatBallAppWM.prototype.createToolAppEdgeBackStrip = function(edge) {
|
|||||||
if (action === android.view.MotionEvent.ACTION_UP || action === android.view.MotionEvent.ACTION_CANCEL) {
|
if (action === android.view.MotionEvent.ACTION_UP || action === android.view.MotionEvent.ACTION_CANCEL) {
|
||||||
var ux = event.getRawX() - downX;
|
var ux = event.getRawX() - downX;
|
||||||
var uy = event.getRawY() - downY;
|
var uy = event.getRawY() - downY;
|
||||||
var commitDp = Number(self.config.TOOLAPP_BACK_COMMIT_DISTANCE_DP || 48);
|
var commitDp = Number(self.config.TOOLAPP_BACK_COMMIT_DISTANCE_DP || 36);
|
||||||
if (isNaN(commitDp)) commitDp = 48;
|
if (isNaN(commitDp)) commitDp = 36;
|
||||||
if (commitDp < 1) commitDp = 1;
|
if (commitDp < 1) commitDp = 1;
|
||||||
if (commitDp > 480) commitDp = 480;
|
if (commitDp > 480) commitDp = 480;
|
||||||
var completeDistance = self.dp(commitDp);
|
var completeDistance = self.dp(commitDp);
|
||||||
var okDir = (edge === 0 && ux > completeDistance) || (edge === 1 && ux < -completeDistance);
|
var okDir = (edge === 0 && ux > completeDistance) || (edge === 1 && ux < -completeDistance);
|
||||||
var ok = (action === android.view.MotionEvent.ACTION_UP) && moved && okDir && Math.abs(ux) > Math.abs(uy) * 1.05;
|
var ok = (action === android.view.MotionEvent.ACTION_UP) && moved && okDir && Math.abs(ux) > Math.abs(uy) * 0.85;
|
||||||
active = false;
|
active = false;
|
||||||
self.finishToolAppBackPreview(edge, ok);
|
self.finishToolAppBackPreview(edge, ok);
|
||||||
return true;
|
return true;
|
||||||
@@ -1120,14 +1120,14 @@ FloatBallAppWM.prototype.hideToolAppScreenBackStrips = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
FloatBallAppWM.prototype.getToolAppBackEdgeWidthPx = function() {
|
FloatBallAppWM.prototype.getToolAppBackEdgeWidthPx = function() {
|
||||||
var stripDp = 36;
|
var stripDp = 56;
|
||||||
try {
|
try {
|
||||||
stripDp = Number(this.config.TOOLAPP_BACK_EDGE_WIDTH_DP || 36);
|
stripDp = Number(this.config.TOOLAPP_BACK_EDGE_WIDTH_DP || 56);
|
||||||
if (isNaN(stripDp)) stripDp = 36;
|
if (isNaN(stripDp)) stripDp = 56;
|
||||||
if (stripDp < 1) stripDp = 1;
|
if (stripDp < 1) stripDp = 1;
|
||||||
if (stripDp > 120) stripDp = 120;
|
if (stripDp > 120) stripDp = 120;
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
stripDp = 36;
|
stripDp = 56;
|
||||||
}
|
}
|
||||||
return this.dp(stripDp);
|
return this.dp(stripDp);
|
||||||
};
|
};
|
||||||
@@ -1216,7 +1216,7 @@ FloatBallAppWM.prototype.buildToolAppShell = function(contentView, title, canBac
|
|||||||
rootEdge = -1;
|
rootEdge = -1;
|
||||||
var canBackNow = !!(self.state && self.state.toolAppActive && self.hasToolAppBackTarget && self.hasToolAppBackTarget());
|
var canBackNow = !!(self.state && self.state.toolAppActive && self.hasToolAppBackTarget && self.hasToolAppBackTarget());
|
||||||
if (canBackNow) {
|
if (canBackNow) {
|
||||||
var edgeW = self.getToolAppBackEdgeWidthPx ? self.getToolAppBackEdgeWidthPx() : self.dp(36);
|
var edgeW = self.getToolAppBackEdgeWidthPx ? self.getToolAppBackEdgeWidthPx() : self.dp(56);
|
||||||
var rw = 0;
|
var rw = 0;
|
||||||
try { rw = this.getWidth(); } catch(eW) { rw = 0; }
|
try { rw = this.getWidth(); } catch(eW) { rw = 0; }
|
||||||
if (rootDownX <= edgeW) rootEdge = 0;
|
if (rootDownX <= edgeW) rootEdge = 0;
|
||||||
@@ -1234,16 +1234,16 @@ FloatBallAppWM.prototype.buildToolAppShell = function(contentView, title, canBac
|
|||||||
var validDir = (rootEdge === 0 && dx > 0) || (rootEdge === 1 && dx < 0);
|
var validDir = (rootEdge === 0 && dx > 0) || (rootEdge === 1 && dx < 0);
|
||||||
var slopDp = Number(self.config.CLICK_SLOP_DP || 6);
|
var slopDp = Number(self.config.CLICK_SLOP_DP || 6);
|
||||||
if (isNaN(slopDp)) slopDp = 6;
|
if (isNaN(slopDp)) slopDp = 6;
|
||||||
if (slopDp < 6) slopDp = 6;
|
if (slopDp < 3) slopDp = 3;
|
||||||
if (slopDp > 18) slopDp = 18;
|
if (slopDp > 18) slopDp = 18;
|
||||||
var touchSlop = self.dp(slopDp);
|
var touchSlop = self.dp(slopDp);
|
||||||
if (validDir && adx > touchSlop && adx > ady * 1.05) {
|
if (validDir && adx > touchSlop && adx > ady * 0.85) {
|
||||||
rootBackActive = true;
|
rootBackActive = true;
|
||||||
rootBackMoved = true;
|
rootBackMoved = true;
|
||||||
try { self.prepareToolAppBackPreview(rootEdge); } catch(ePrep) { try { safeLog(self.L, 'w', 'root back preview prepare fail: ' + String(ePrep)); } catch(eLogPrep) {} }
|
try { self.prepareToolAppBackPreview(rootEdge); } catch(ePrep) { try { safeLog(self.L, 'w', 'root back preview prepare fail: ' + String(ePrep)); } catch(eLogPrep) {} }
|
||||||
try {
|
try {
|
||||||
var triggerDp0 = Number(self.config.TOOLAPP_BACK_PROGRESS_DISTANCE_DP || 120);
|
var triggerDp0 = Number(self.config.TOOLAPP_BACK_PROGRESS_DISTANCE_DP || 96);
|
||||||
if (isNaN(triggerDp0)) triggerDp0 = 120;
|
if (isNaN(triggerDp0)) triggerDp0 = 96;
|
||||||
if (triggerDp0 < 1) triggerDp0 = 1;
|
if (triggerDp0 < 1) triggerDp0 = 1;
|
||||||
if (triggerDp0 > 720) triggerDp0 = 720;
|
if (triggerDp0 > 720) triggerDp0 = 720;
|
||||||
var triggerDistance0 = self.dp(triggerDp0);
|
var triggerDistance0 = self.dp(triggerDp0);
|
||||||
@@ -1270,9 +1270,9 @@ FloatBallAppWM.prototype.buildToolAppShell = function(contentView, title, canBac
|
|||||||
var mx = ev.getX() - rootDownX;
|
var mx = ev.getX() - rootDownX;
|
||||||
var my = ev.getY() - rootDownY;
|
var my = ev.getY() - rootDownY;
|
||||||
var validDir2 = (rootEdge === 0 && mx > 0) || (rootEdge === 1 && mx < 0);
|
var validDir2 = (rootEdge === 0 && mx > 0) || (rootEdge === 1 && mx < 0);
|
||||||
if (validDir2 && Math.abs(mx) > Math.abs(my) * 1.05) {
|
if (validDir2 && Math.abs(mx) > Math.abs(my) * 0.85) {
|
||||||
var triggerDp = Number(self.config.TOOLAPP_BACK_PROGRESS_DISTANCE_DP || 120);
|
var triggerDp = Number(self.config.TOOLAPP_BACK_PROGRESS_DISTANCE_DP || 96);
|
||||||
if (isNaN(triggerDp)) triggerDp = 120;
|
if (isNaN(triggerDp)) triggerDp = 96;
|
||||||
if (triggerDp < 1) triggerDp = 1;
|
if (triggerDp < 1) triggerDp = 1;
|
||||||
if (triggerDp > 720) triggerDp = 720;
|
if (triggerDp > 720) triggerDp = 720;
|
||||||
var triggerDistance = self.dp(triggerDp);
|
var triggerDistance = self.dp(triggerDp);
|
||||||
@@ -1284,13 +1284,13 @@ FloatBallAppWM.prototype.buildToolAppShell = function(contentView, title, canBac
|
|||||||
if (action === android.view.MotionEvent.ACTION_UP || action === android.view.MotionEvent.ACTION_CANCEL) {
|
if (action === android.view.MotionEvent.ACTION_UP || action === android.view.MotionEvent.ACTION_CANCEL) {
|
||||||
var ux = ev.getX() - rootDownX;
|
var ux = ev.getX() - rootDownX;
|
||||||
var uy = ev.getY() - rootDownY;
|
var uy = ev.getY() - rootDownY;
|
||||||
var commitDp = Number(self.config.TOOLAPP_BACK_COMMIT_DISTANCE_DP || 48);
|
var commitDp = Number(self.config.TOOLAPP_BACK_COMMIT_DISTANCE_DP || 36);
|
||||||
if (isNaN(commitDp)) commitDp = 48;
|
if (isNaN(commitDp)) commitDp = 36;
|
||||||
if (commitDp < 1) commitDp = 1;
|
if (commitDp < 1) commitDp = 1;
|
||||||
if (commitDp > 480) commitDp = 480;
|
if (commitDp > 480) commitDp = 480;
|
||||||
var completeDistance = self.dp(commitDp);
|
var completeDistance = self.dp(commitDp);
|
||||||
var okDir = (rootEdge === 0 && ux > completeDistance) || (rootEdge === 1 && ux < -completeDistance);
|
var okDir = (rootEdge === 0 && ux > completeDistance) || (rootEdge === 1 && ux < -completeDistance);
|
||||||
var ok = (action === android.view.MotionEvent.ACTION_UP) && rootBackMoved && okDir && Math.abs(ux) > Math.abs(uy) * 1.05;
|
var ok = (action === android.view.MotionEvent.ACTION_UP) && rootBackMoved && okDir && Math.abs(ux) > Math.abs(uy) * 0.85;
|
||||||
var edgeDone = rootEdge;
|
var edgeDone = rootEdge;
|
||||||
rootBackActive = false;
|
rootBackActive = false;
|
||||||
rootBackMoved = false;
|
rootBackMoved = false;
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
"alg": "SHA256withRSA",
|
"alg": "SHA256withRSA",
|
||||||
"files": {
|
"files": {
|
||||||
"th_01_base.js": {
|
"th_01_base.js": {
|
||||||
"sha256": "c4dce0bca4bec2b2414a5df65d57e37bd3c8c75cc23f2112b7e38bead15e5808",
|
"sha256": "92f780e907b99c485510363252617c004d1c37ef0fde010e4fe93f9df90d207e",
|
||||||
"size": 57166
|
"size": 57164
|
||||||
},
|
},
|
||||||
"th_02_core.js": {
|
"th_02_core.js": {
|
||||||
"sha256": "3c5c498d200e961d48fc9ca3f885475e770ecb32b83ec6a89d23df3f88aed1c9",
|
"sha256": "3c5c498d200e961d48fc9ca3f885475e770ecb32b83ec6a89d23df3f88aed1c9",
|
||||||
@@ -58,8 +58,8 @@
|
|||||||
"size": 304993
|
"size": 304993
|
||||||
},
|
},
|
||||||
"th_15_extra.js": {
|
"th_15_extra.js": {
|
||||||
"sha256": "a23da97c9832abd2956d5c303b7d1dab1e4f64ac55615ec078c4757cdee65048",
|
"sha256": "f74276d86315538a45e141294a913a2384a4c99b862dc8d5325e77d4fd7e93d2",
|
||||||
"size": 118232
|
"size": 118233
|
||||||
},
|
},
|
||||||
"th_16_entry.js": {
|
"th_16_entry.js": {
|
||||||
"sha256": "6c59d9891cd010647f84c3db93f1cf95c7bbfb758470ea21044bf72eb8ff73d1",
|
"sha256": "6c59d9891cd010647f84c3db93f1cf95c7bbfb758470ea21044bf72eb8ff73d1",
|
||||||
@@ -68,5 +68,5 @@
|
|||||||
},
|
},
|
||||||
"keyId": "toolhub-targets-2026-rsa3072",
|
"keyId": "toolhub-targets-2026-rsa3072",
|
||||||
"schema": 2,
|
"schema": 2,
|
||||||
"version": 20260522000043
|
"version": 20260522002703
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
NG/M+dqs3jZZU1qlAw4NQiXM/V4jV2nNK4zr7xz7+A1XQO/SIGXbEivfi7p94J4NC6bPRqcIOhLkavsBiFd3L1C2GITTBxtpa3MuW5YkZi3iYjyQ2AdP6EcpUz+wzokFBN9I0Pm5hfwOwCtd46sqyqdk1CHH4m2DjzYUC4FsX1LnZV0s2dX58xI9u3VZVOEahudK2ecvJuXgV/N6tvpPNaYAqG42yS1CqAVsmzjCJFkJaNOLkAAu26pMmFSKwldST1asnd4+TYbKZjuGcgRud8QkSU2rHIEj4wSImr6q0N1DLgv19HTXkRxWkKFcqhOhjBn6flzBNjQwpAVn7r56fPMc4sjk4Td4M/WNBleSOQvsqoXStF94JeP6f5qcfzp+4RU8+mLcYKW/MpeMPgT93q0N4unztpR+OjWZqhst8EO1GxDPcRrkO+h6cTtDQvkpWQjt9/rp79zlf+7oGn0zpDCM6ZVe0FxNTRBmNm+xao3YV73dZRxtidUkRKaIx2yx
|
Gysf9o2vKtTjx3vTsUMvkdZFNuHkwkzj8NQjh9diIgleVYSs/vgbf54+k6H7DqbY+sJSFIAUitjSBEmDYc1l/xaSTmZgRE5yQqTp8Ll8sQXXKlC8r8teMzdOdNVeVyOg+zYTM+NfE5UpcpDkq+JdFZgJhCAN0I0O7MD+qTVrdnYxbYOuoGkgPuEcDrZ8S7zG6Jc+dryqLlH/QgvWZnLjb+/Id73jpT3WTNlCPKdka3+sDvvTuqQ1AHFaf9c9jJAeWme8uloK98qqEVehKtUC8lglVrK4f9ZVhhUHkvTWITwgj2ALRsCOy6IH2IlNB5Uhw1rwgDyqBnld43aKCiw4upMnVc3IZTXdLcMBqjL5XctHzhmWZN4BAtZtJQqkyysaPy2XeO6uTzqES2w7Zynfy44N/0oikcXddnQ99afD6H57z34OBSbARGxY5vRae+96kw2izkeL5KwLaYmOhBln+C6bZYBq001U2wz/QSNI+liJc209UljZ61fBcNCgtCk+
|
||||||
|
|||||||
Reference in New Issue
Block a user