Fix MIST gallery scene controls, video positioning and audio overlap
This commit is contained in:
1 parent
19924e1c5a
commit
4dc660f786
10 files changed
+197
-12
No files matched your search
@@ -1400,6 +1400,19 @@ export class ScreenManager {
|
||||
const sensitive = props.sensitive ? truthy(this.ev(props.sensitive)) && this.actionSensitive(action) : this.actionSensitive(action);
|
||||
const selected = props.selected ? truthy(this.ev(props.selected)) : this.actionSelected(action);
|
||||
let hover = false;
|
||||
// Keep every state in the same grid cell. Replacing the idle image with an
|
||||
// unloaded hover image collapses the hit area and causes enter/leave loops.
|
||||
const pictures = new Map<any, HTMLElement>();
|
||||
if (images) for (const file of Object.values(images)) {
|
||||
if (!file || pictures.has(file)) continue;
|
||||
const picture = this.displayable(file);
|
||||
if (!picture) continue;
|
||||
picture.classList.add("pg-simg");
|
||||
picture.style.gridArea = "1 / 1";
|
||||
picture.style.pointerEvents = "none";
|
||||
pictures.set(file, picture);
|
||||
el.append(picture);
|
||||
}
|
||||
const paint = () => {
|
||||
const state = !sensitive ? (selected ? "selected_insensitive" : "insensitive")
|
||||
: selected ? (hover ? "selected_hover" : "selected_idle") : hover ? "hover" : "idle";
|
||||
@@ -1409,10 +1422,7 @@ export class ScreenManager {
|
||||
}
|
||||
el.dataset.state = state;
|
||||
if (images) {
|
||||
const file = images[state];
|
||||
const picture = file ? this.displayable(file) : null;
|
||||
el.replaceChildren(...(picture ? [picture] : []));
|
||||
picture?.classList.add("pg-simg");
|
||||
for (const [file, picture] of pictures) picture.style.opacity = file === images[state] ? "1" : "0";
|
||||
} else {
|
||||
this.look(el, props, state);
|
||||
if (label) this.textLook(label, { ...props, ...Object.fromEntries(Object.entries(textProps).map(([k, v]) => [k, v])) }, state);
|
||||
@@ -1741,7 +1751,9 @@ export class ScreenManager {
|
||||
|
||||
/** Run what a widget's `action` evaluated to. */
|
||||
run(action: any, screen: Instance | null) {
|
||||
if (this.suspended) return;
|
||||
// Absent hover actions must not rebuild the button under the pointer:
|
||||
// its replacement would receive mouseenter again and replay hover_sound.
|
||||
if (this.suspended || action === null || action === undefined || action === false) return;
|
||||
// actions act on the game, not on the screen's own variable scope
|
||||
const { py } = this.host;
|
||||
const savedFn = py.fn;
|
||||
|
||||
Reference in new issue
Block a user