mirror of
https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak.git
synced 2026-12-03 03:52:50 +08:00
fix: re-place floating host controls promptly on screen changes
Return to the default corner once it and the current spot are free, and skip the move confirmation/minimum interval for ~1.5 s after the home <-> voice page switch or a skin switch, so a spot picked for the previous screen no longer covers controls on the next one (e.g. Export identity).
This commit is contained in:
1 parent
2b019d82ff
commit
99d7b86d09
6 files changed
+87
-12
No files matched your search
+17
@@ -135,6 +135,23 @@ try {
|
||||
await settle();
|
||||
results.push(snap("wall-removed"));
|
||||
|
||||
// Screen change (voice page -> home): the dock goes away and a new control
|
||||
// appears exactly where the capsule was parked. screenChanged() re-places it
|
||||
// at once (back to the now-free default corner), without the confirm delay.
|
||||
const away = binding.position;
|
||||
const capRect = control.getBoundingClientRect();
|
||||
document.getElementById("mic").style.display = "none";
|
||||
document.body.insertAdjacentHTML("beforeend", `<button type="button" id="export" style="position:fixed;left:${capRect.left}px;top:${capRect.top}px;width:${capRect.width}px;height:${capRect.height}px">Export identity</button>`);
|
||||
binding.screenChanged();
|
||||
await sleep(150);
|
||||
results.push({ ...snap("screen-change"), away, exportCovered: (() => {
|
||||
const r = document.getElementById("export").getBoundingClientRect();
|
||||
return document.elementFromPoint(r.left + r.width / 2, r.top + r.height / 2) === host;
|
||||
})() });
|
||||
document.getElementById("export").remove();
|
||||
document.getElementById("mic").style.display = "";
|
||||
await settle();
|
||||
|
||||
// Weights: an unmarked skin button inside the protected "app" root is an
|
||||
// ordinary control; the microphone is protected; invisible controls do not
|
||||
// count; a custom div[tabindex] button does.
|
||||
|
||||
@@ -355,6 +355,12 @@ test("floating host controls move off skin controls at runtime", { skip: !CHROME
|
||||
assert.equal(byName.wall.capsuleHit, true);
|
||||
|
||||
assert.equal(byName["wall-removed"].compact, false);
|
||||
// A screen change re-places the capsule within ~150 ms: back to the free
|
||||
// default corner, off the control that appeared under its old spot.
|
||||
const screen = byName["screen-change"];
|
||||
assert.notEqual(screen.away, "bottom-left", JSON.stringify(screen));
|
||||
assert.equal(screen.position, "bottom-left", JSON.stringify(screen));
|
||||
assert.equal(screen.exportCovered, false, JSON.stringify(screen));
|
||||
// Weighting: plain skin buttons are ordinary even inside the protected app root.
|
||||
assert.deepEqual(
|
||||
{ plain: byName.weights.plain, mic: byName.weights.mic, ghost: byName.weights.ghost, custom: byName.weights.custom },
|
||||
|
||||
Reference in new issue
Block a user