Fix ToolApp edge back drag progress

This commit is contained in:
Hermes
2026-05-22 06:14:44 +08:00
parent dcd3fcb9ee
commit 67fad1d7f8
4 changed files with 44 additions and 8 deletions

View File

@@ -370,7 +370,31 @@ FloatBallAppWM.prototype.applyPanelPredictiveBackProgress = function(panel, even
try { edge = Number(event.getSwipeEdge()); } catch (eE) { edge = 0; }
if (panel && this.state && this.state.toolAppRoot === panel && this.applyToolAppBackPreviewProgress && this.hasToolAppBackTarget && this.hasToolAppBackTarget()) {
this.state.toolAppBackEdge = edge;
this.applyToolAppBackPreviewProgress(edge, p);
var dragPx = 0;
try {
var panelW = 0;
try { panelW = Number(panel.getWidth ? panel.getWidth() : 0); } catch(ePW) { panelW = 0; }
if (!panelW || panelW < this.dp(120)) {
try { panelW = Number((this.state.viewerPanelLp && this.state.viewerPanelLp.width) || 0); } catch(eLpW) { panelW = 0; }
}
if (!panelW || panelW < this.dp(120)) panelW = this.dp(320);
var maxFollow = Math.min(this.dp(220), Math.floor(panelW * 0.45));
dragPx = Math.round(maxFollow * p);
} catch(eDrag) {
dragPx = Math.round(this.dp(180) * p);
}
try {
var nowPb = Date.now();
if (!this.state.toolAppPredictiveBackLogAt || (nowPb - Number(this.state.toolAppPredictiveBackLogAt || 0)) > 300) {
this.state.toolAppPredictiveBackLogAt = nowPb;
safeLog(this.L, 'd', 'predictive back progress edge=' + String(edge) + ' p=' + String(p) + ' dragPx=' + String(dragPx));
}
} catch(eLogPb) {}
this.applyToolAppBackPreviewProgress(edge, p, dragPx);
return;
}
var dir = edge === 1 ? -1 : 1;

View File

@@ -846,7 +846,16 @@ FloatBallAppWM.prototype.applyToolAppBackPreviewProgress = function(edge, progre
}
} catch(eFollow) {}
if (body) {
body.setTranslationX(dir * w * eased * 0.42);
var bodyMove = dir * w * eased * 0.42;
try {
if (dragPx !== undefined && dragPx !== null) {
var rawDrag = Number(dragPx || 0);
if (isNaN(rawDrag)) rawDrag = 0;
if (rawDrag < 0) rawDrag = -rawDrag;
bodyMove = dir * Math.min(rawDrag, Math.floor(w * 0.45));
}
} catch(eBodyMove) {}
body.setTranslationX(bodyMove);
body.setAlpha(1.0 - 0.10 * eased);
var s = 1.0 - 0.015 * eased;
body.setScaleX(s);
@@ -934,6 +943,9 @@ FloatBallAppWM.prototype.createToolAppEdgeBackStrip = function(edge) {
var my = event.getRawY() - downY;
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 (!moved) {
try { safeLog(self.L, 'd', 'edge strip move edge=' + String(edge) + ' mx=' + String(mx)); } catch(eMoveLog) {}
}
moved = true;
var triggerDp = Number(self.config.TOOLAPP_BACK_PROGRESS_DISTANCE_DP || 180);
if (isNaN(triggerDp)) triggerDp = 180;