Improve ToolApp edge back responsiveness
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: 24 },
|
TOOLAPP_BACK_EDGE_WIDTH_DP: { type: "int", min: 1, max: 120, default: 36 },
|
||||||
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: 72 },
|
TOOLAPP_BACK_COMMIT_DISTANCE_DP: { type: "int", min: 1, max: 480, default: 48 },
|
||||||
TOOLAPP_BACK_PROGRESS_DISTANCE_DP: { type: "int", min: 1, max: 720, default: 180 },
|
TOOLAPP_BACK_PROGRESS_DISTANCE_DP: { type: "int", min: 1, max: 720, default: 120 },
|
||||||
|
|
||||||
// 功能开关
|
// 功能开关
|
||||||
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: 24,
|
TOOLAPP_BACK_EDGE_WIDTH_DP: 36,
|
||||||
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: 72,
|
TOOLAPP_BACK_COMMIT_DISTANCE_DP: 48,
|
||||||
TOOLAPP_BACK_PROGRESS_DISTANCE_DP: 180,
|
TOOLAPP_BACK_PROGRESS_DISTANCE_DP: 120,
|
||||||
ENABLE_BOUNCE: true,
|
ENABLE_BOUNCE: true,
|
||||||
BOUNCE_TIMES: 2,
|
BOUNCE_TIMES: 2,
|
||||||
BOUNCE_MAX_SCALE: 0.88,
|
BOUNCE_MAX_SCALE: 0.88,
|
||||||
|
|||||||
@@ -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 || 72);
|
var commitDp = Number(self.config.TOOLAPP_BACK_COMMIT_DISTANCE_DP || 48);
|
||||||
if (isNaN(commitDp)) commitDp = 72;
|
if (isNaN(commitDp)) commitDp = 48;
|
||||||
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.2;
|
var ok = (action === android.view.MotionEvent.ACTION_UP) && moved && okDir && Math.abs(ux) > Math.abs(uy) * 1.05;
|
||||||
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 = 24;
|
var stripDp = 36;
|
||||||
try {
|
try {
|
||||||
stripDp = Number(this.config.TOOLAPP_BACK_EDGE_WIDTH_DP || 24);
|
stripDp = Number(this.config.TOOLAPP_BACK_EDGE_WIDTH_DP || 36);
|
||||||
if (isNaN(stripDp)) stripDp = 24;
|
if (isNaN(stripDp)) stripDp = 36;
|
||||||
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 = 24;
|
stripDp = 36;
|
||||||
}
|
}
|
||||||
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(24);
|
var edgeW = self.getToolAppBackEdgeWidthPx ? self.getToolAppBackEdgeWidthPx() : self.dp(36);
|
||||||
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;
|
||||||
@@ -1232,15 +1232,24 @@ FloatBallAppWM.prototype.buildToolAppShell = function(contentView, title, canBac
|
|||||||
var adx = Math.abs(dx);
|
var adx = Math.abs(dx);
|
||||||
var ady = Math.abs(dy);
|
var ady = Math.abs(dy);
|
||||||
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) * 2;
|
var slopDp = Number(self.config.CLICK_SLOP_DP || 6);
|
||||||
if (isNaN(slopDp)) slopDp = 12;
|
if (isNaN(slopDp)) slopDp = 6;
|
||||||
if (slopDp < 12) slopDp = 12;
|
if (slopDp < 6) slopDp = 6;
|
||||||
if (slopDp > 40) slopDp = 40;
|
if (slopDp > 18) slopDp = 18;
|
||||||
var touchSlop = self.dp(slopDp);
|
var touchSlop = self.dp(slopDp);
|
||||||
if (validDir && adx > touchSlop && adx > ady * 1.2) {
|
if (validDir && adx > touchSlop && adx > ady * 1.05) {
|
||||||
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 {
|
||||||
|
var triggerDp0 = Number(self.config.TOOLAPP_BACK_PROGRESS_DISTANCE_DP || 120);
|
||||||
|
if (isNaN(triggerDp0)) triggerDp0 = 120;
|
||||||
|
if (triggerDp0 < 1) triggerDp0 = 1;
|
||||||
|
if (triggerDp0 > 720) triggerDp0 = 720;
|
||||||
|
var triggerDistance0 = self.dp(triggerDp0);
|
||||||
|
var p0 = Math.min(1, adx / triggerDistance0);
|
||||||
|
self.applyToolAppBackPreviewProgress(rootEdge, p0, adx);
|
||||||
|
} catch(eFirstMove) {}
|
||||||
try { safeLog(self.L, 'd', 'root edge back intercept edge=' + String(rootEdge) + ' dx=' + String(dx)); } catch(eMoveLog) {}
|
try { safeLog(self.L, 'd', 'root edge back intercept edge=' + String(rootEdge) + ' dx=' + String(dx)); } catch(eMoveLog) {}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1261,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.2) {
|
if (validDir2 && Math.abs(mx) > Math.abs(my) * 1.05) {
|
||||||
var triggerDp = Number(self.config.TOOLAPP_BACK_PROGRESS_DISTANCE_DP || 180);
|
var triggerDp = Number(self.config.TOOLAPP_BACK_PROGRESS_DISTANCE_DP || 120);
|
||||||
if (isNaN(triggerDp)) triggerDp = 180;
|
if (isNaN(triggerDp)) triggerDp = 120;
|
||||||
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);
|
||||||
@@ -1275,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 || 72);
|
var commitDp = Number(self.config.TOOLAPP_BACK_COMMIT_DISTANCE_DP || 48);
|
||||||
if (isNaN(commitDp)) commitDp = 72;
|
if (isNaN(commitDp)) commitDp = 48;
|
||||||
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.2;
|
var ok = (action === android.view.MotionEvent.ACTION_UP) && rootBackMoved && okDir && Math.abs(ux) > Math.abs(uy) * 1.05;
|
||||||
var edgeDone = rootEdge;
|
var edgeDone = rootEdge;
|
||||||
rootBackActive = false;
|
rootBackActive = false;
|
||||||
rootBackMoved = false;
|
rootBackMoved = false;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
"alg": "SHA256withRSA",
|
"alg": "SHA256withRSA",
|
||||||
"files": {
|
"files": {
|
||||||
"th_01_base.js": {
|
"th_01_base.js": {
|
||||||
"sha256": "f228e3fda85ab9946934a9950515556d75df110da88432b339258036b8f3a3e2",
|
"sha256": "c4dce0bca4bec2b2414a5df65d57e37bd3c8c75cc23f2112b7e38bead15e5808",
|
||||||
"size": 57166
|
"size": 57166
|
||||||
},
|
},
|
||||||
"th_02_core.js": {
|
"th_02_core.js": {
|
||||||
@@ -58,8 +58,8 @@
|
|||||||
"size": 304993
|
"size": 304993
|
||||||
},
|
},
|
||||||
"th_15_extra.js": {
|
"th_15_extra.js": {
|
||||||
"sha256": "fb8349a61771903a8c2a3ca6fee15f8df88af79b684e7b444b35c38bcf354ed5",
|
"sha256": "a23da97c9832abd2956d5c303b7d1dab1e4f64ac55615ec078c4757cdee65048",
|
||||||
"size": 117741
|
"size": 118232
|
||||||
},
|
},
|
||||||
"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": 20260521235402
|
"version": 20260522000043
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
Ho5g8n2gFgHoMdeo0wpzG4b3ufGTSs7Ht1MbGOGU0h0r/u3QRAJKJTCf1JPmSb6mWCOdM8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