mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-06 03:14:00 +00:00
fix: cancel Nepal media preloads and respect drawing ownership
Retain active-flight preloading while canceling hidden frames and pending Facebook sessions on stop, disable, and replacement. Add lifecycle and pointer-ownership regression coverage. Apply the runtime formatting adopted on main and keep the existing source-shape check insensitive to that formatting.
This commit is contained in:
1 parent
1a936ebac1
commit
a9482f0a5b
15 files changed
+3584
-1803
No files matched your search
@@ -504,18 +504,22 @@ export function normalizeOverlayEntry(sourceId, entry) {
|
||||
: 'keyhole',
|
||||
horizonCull: entry.horizonCull !== false,
|
||||
terrainOcclusion: entry.terrainOcclusion === true,
|
||||
sourceAlpha: typeof (entry.sourceAlpha ?? entry.alpha) === 'function'
|
||||
? (entry.sourceAlpha ?? entry.alpha)
|
||||
: clamp01(entry.sourceAlpha ?? entry.alpha, 1),
|
||||
presentationScale: typeof entry.presentationScale === 'function'
|
||||
? entry.presentationScale
|
||||
: Math.max(0, Number(entry.presentationScale) || 1),
|
||||
leaderProgress: typeof entry.leaderProgress === 'function'
|
||||
? entry.leaderProgress
|
||||
: clamp01(entry.leaderProgress, 1),
|
||||
contentAlpha: typeof entry.contentAlpha === 'function'
|
||||
? entry.contentAlpha
|
||||
: clamp01(entry.contentAlpha, 1),
|
||||
sourceAlpha:
|
||||
typeof (entry.sourceAlpha ?? entry.alpha) === 'function'
|
||||
? (entry.sourceAlpha ?? entry.alpha)
|
||||
: clamp01(entry.sourceAlpha ?? entry.alpha, 1),
|
||||
presentationScale:
|
||||
typeof entry.presentationScale === 'function'
|
||||
? entry.presentationScale
|
||||
: Math.max(0, Number(entry.presentationScale) || 1),
|
||||
leaderProgress:
|
||||
typeof entry.leaderProgress === 'function'
|
||||
? entry.leaderProgress
|
||||
: clamp01(entry.leaderProgress, 1),
|
||||
contentAlpha:
|
||||
typeof entry.contentAlpha === 'function'
|
||||
? entry.contentAlpha
|
||||
: clamp01(entry.contentAlpha, 1),
|
||||
anchorDot: entry.anchorDot === true,
|
||||
leaderStyle: entry.leaderStyle === 'elbow' ? 'elbow' : 'straight',
|
||||
temporalAlpha: clamp01(entry.temporalAlpha, 1),
|
||||
@@ -1805,19 +1809,36 @@ function resetFrameDomains() {
|
||||
// ordinary moving-source workload at a non-inlined call boundary.
|
||||
function applyPresentation(entry, source, record) {
|
||||
try {
|
||||
const scale = Number(typeof entry.presentationScale === 'function'
|
||||
? entry.presentationScale() : entry.presentationScale);
|
||||
const scale = Number(
|
||||
typeof entry.presentationScale === 'function'
|
||||
? entry.presentationScale()
|
||||
: entry.presentationScale,
|
||||
);
|
||||
record.paintScale *= Number.isFinite(scale) ? Math.max(0, scale) : 1;
|
||||
const alpha = Number(typeof entry.sourceAlpha === 'function'
|
||||
? entry.sourceAlpha() : entry.sourceAlpha);
|
||||
record.sourceAlpha = source.options.alpha
|
||||
* (Number.isFinite(alpha) ? Math.max(0, Math.min(1, alpha)) : 1);
|
||||
const leader = Number(typeof entry.leaderProgress === 'function'
|
||||
? entry.leaderProgress() : entry.leaderProgress);
|
||||
record.leaderProgress = Number.isFinite(leader) ? Math.max(0, Math.min(1, leader)) : 1;
|
||||
const content = Number(typeof entry.contentAlpha === 'function'
|
||||
? entry.contentAlpha() : entry.contentAlpha);
|
||||
record.contentAlpha = Number.isFinite(content) ? Math.max(0, Math.min(1, content)) : 1;
|
||||
const alpha = Number(
|
||||
typeof entry.sourceAlpha === 'function'
|
||||
? entry.sourceAlpha()
|
||||
: entry.sourceAlpha,
|
||||
);
|
||||
record.sourceAlpha =
|
||||
source.options.alpha *
|
||||
(Number.isFinite(alpha) ? Math.max(0, Math.min(1, alpha)) : 1);
|
||||
const leader = Number(
|
||||
typeof entry.leaderProgress === 'function'
|
||||
? entry.leaderProgress()
|
||||
: entry.leaderProgress,
|
||||
);
|
||||
record.leaderProgress = Number.isFinite(leader)
|
||||
? Math.max(0, Math.min(1, leader))
|
||||
: 1;
|
||||
const content = Number(
|
||||
typeof entry.contentAlpha === 'function'
|
||||
? entry.contentAlpha()
|
||||
: entry.contentAlpha,
|
||||
);
|
||||
record.contentAlpha = Number.isFinite(content)
|
||||
? Math.max(0, Math.min(1, content))
|
||||
: 1;
|
||||
return true;
|
||||
} catch {
|
||||
return false;
|
||||
@@ -1942,19 +1963,31 @@ function snapshotAndProject(entry, source, viewProjection, keyhole) {
|
||||
}
|
||||
record.paintScale *= altitudeFactor;
|
||||
}
|
||||
record.altitudeAlpha = entry.altitudeFadeEnd === Number.POSITIVE_INFINITY
|
||||
? (Number.isFinite(cameraAltitude) && cameraAltitude < entry.minAltitude ? 0 : 1)
|
||||
: altitudeFade(cameraAltitude, record.altitudeOptions);
|
||||
record.altitudeAlpha =
|
||||
entry.altitudeFadeEnd === Number.POSITIVE_INFINITY
|
||||
? Number.isFinite(cameraAltitude) && cameraAltitude < entry.minAltitude
|
||||
? 0
|
||||
: 1
|
||||
: altitudeFade(cameraAltitude, record.altitudeOptions);
|
||||
record.leaderProgress = 1;
|
||||
record.contentAlpha = 1;
|
||||
if (entry.presentationScale !== 1 || entry.leaderProgress !== 1
|
||||
|| entry.contentAlpha !== 1 || typeof entry.sourceAlpha === 'function') {
|
||||
if (
|
||||
entry.presentationScale !== 1 ||
|
||||
entry.leaderProgress !== 1 ||
|
||||
entry.contentAlpha !== 1 ||
|
||||
typeof entry.sourceAlpha === 'function'
|
||||
) {
|
||||
if (!applyPresentation(entry, source, record)) return null;
|
||||
} else {
|
||||
record.sourceAlpha = source.options.alpha * entry.sourceAlpha;
|
||||
}
|
||||
if (record.distanceAlpha <= 0 || record.paintScale <= 0
|
||||
|| record.altitudeAlpha <= 0 || record.sourceAlpha <= 0) return null;
|
||||
if (
|
||||
record.distanceAlpha <= 0 ||
|
||||
record.paintScale <= 0 ||
|
||||
record.altitudeAlpha <= 0 ||
|
||||
record.sourceAlpha <= 0
|
||||
)
|
||||
return null;
|
||||
|
||||
measureOverlayEntry(_ctx, entry, record.layout);
|
||||
record.placementInput.anchorX = record.screen.x;
|
||||
|
||||
@@ -572,13 +572,11 @@ function drawLeader(
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(startX, startY);
|
||||
if (
|
||||
style === 'elbow'
|
||||
&& (placement.corner === 'left' || placement.corner === 'right')
|
||||
style === 'elbow' &&
|
||||
(placement.corner === 'left' || placement.corner === 'right')
|
||||
) {
|
||||
const elbowY = placement.rect.y + Math.min(
|
||||
Math.max(12, placement.rect.h * 0.12),
|
||||
26,
|
||||
);
|
||||
const elbowY =
|
||||
placement.rect.y + Math.min(Math.max(12, placement.rect.h * 0.12), 26);
|
||||
const verticalLength = Math.abs(elbowY - startY);
|
||||
const horizontalLength = Math.abs(placement.leadToX - startX);
|
||||
const totalLength = verticalLength + horizontalLength;
|
||||
@@ -590,7 +588,10 @@ function drawLeader(
|
||||
ctx.lineTo(startX, elbowY);
|
||||
const remaining = Math.max(0, visibleLength - verticalLength);
|
||||
const direction = Math.sign(placement.leadToX - startX);
|
||||
ctx.lineTo(startX + Math.min(horizontalLength, remaining) * direction, elbowY);
|
||||
ctx.lineTo(
|
||||
startX + Math.min(horizontalLength, remaining) * direction,
|
||||
elbowY,
|
||||
);
|
||||
}
|
||||
ctx.stroke();
|
||||
return;
|
||||
@@ -615,10 +616,17 @@ function drawAnchorDot(ctx, entry, placement) {
|
||||
ctx.stroke();
|
||||
}
|
||||
|
||||
function drawCardChrome(ctx, entry, placement, selected = false, drawLeaderLine = true) {
|
||||
function drawCardChrome(
|
||||
ctx,
|
||||
entry,
|
||||
placement,
|
||||
selected = false,
|
||||
drawLeaderLine = true,
|
||||
) {
|
||||
const { x, y, w, h } = placement.rect;
|
||||
const accent = entry.accent || WORLD_OVERLAY_STYLE.accent;
|
||||
if (drawLeaderLine) drawLeader(ctx, placement, accent, 1, 1, entry.leaderStyle);
|
||||
if (drawLeaderLine)
|
||||
drawLeader(ctx, placement, accent, 1, 1, entry.leaderStyle);
|
||||
ctx.beginPath();
|
||||
roundedRectPath(ctx, x, y, w, h);
|
||||
ctx.fillStyle = selected
|
||||
@@ -893,7 +901,8 @@ export function paintCard(
|
||||
entry.leaderStyle,
|
||||
);
|
||||
drawAnchorDot(ctx, entry, placement);
|
||||
ctx.globalAlpha = alpha * Math.max(0, Math.min(1, Number(contentAlpha) || 0));
|
||||
ctx.globalAlpha =
|
||||
alpha * Math.max(0, Math.min(1, Number(contentAlpha) || 0));
|
||||
drawCardChrome(ctx, entry, placement, false, false);
|
||||
} else {
|
||||
drawCardChrome(ctx, entry, placement, false);
|
||||
@@ -1112,15 +1121,33 @@ export function paintOverlayEntry(
|
||||
leaderProgress = 1,
|
||||
contentAlpha = 1,
|
||||
) {
|
||||
if (entry.cardStyle === 'tactical') return paintTacticalCard(ctx, entry, placement, alpha);
|
||||
if (entry.variant === 'tracked') return paintTracked(ctx, entry, placement, alpha);
|
||||
if (entry.selected || entry.variant === 'selected') return paintSelected(ctx, entry, placement, alpha);
|
||||
if (entry.cardStyle === 'tactical')
|
||||
return paintTacticalCard(ctx, entry, placement, alpha);
|
||||
if (entry.variant === 'tracked')
|
||||
return paintTracked(ctx, entry, placement, alpha);
|
||||
if (entry.selected || entry.variant === 'selected')
|
||||
return paintSelected(ctx, entry, placement, alpha);
|
||||
if (entry.variant === 'thumbnail') {
|
||||
return paintThumbnail(ctx, entry, placement, alpha, leaderProgress, contentAlpha);
|
||||
return paintThumbnail(
|
||||
ctx,
|
||||
entry,
|
||||
placement,
|
||||
alpha,
|
||||
leaderProgress,
|
||||
contentAlpha,
|
||||
);
|
||||
}
|
||||
if (entry.variant === 'card') {
|
||||
return paintCard(ctx, entry, placement, alpha, leaderProgress, contentAlpha);
|
||||
return paintCard(
|
||||
ctx,
|
||||
entry,
|
||||
placement,
|
||||
alpha,
|
||||
leaderProgress,
|
||||
contentAlpha,
|
||||
);
|
||||
}
|
||||
if (entry.variant === 'track') return paintTrack(ctx, entry, placement, alpha);
|
||||
if (entry.variant === 'track')
|
||||
return paintTrack(ctx, entry, placement, alpha);
|
||||
return paintLabel(ctx, entry, placement, alpha);
|
||||
}
|
||||
Reference in new issue
Block a user