forked from Blendman974/faceclaw
Fix double-dimming when app menu submenus are open
This commit is contained in:
1 parent
a82184316e
commit
79ea7858ca
4 files changed
+43
-5
No files matched your search
+12
-1
@@ -102,6 +102,15 @@ export interface Layer {
|
||||
readonly depth?: number;
|
||||
paintParts?(): Plane[];
|
||||
readonly paintOverBase?: boolean;
|
||||
/**
|
||||
* True when this layer stands in for `below`, a stacked layer directly
|
||||
* beneath it (or beneath another layer it stands in for): when this layer
|
||||
* calls paintBelow, the stack skips `below` and paints what is under it
|
||||
* instead. A submenu replacing the menu it opened from uses this, so the
|
||||
* hidden menu costs no plane and its dimUnderneath doesn't dim the content
|
||||
* a second time; popping the submenu still returns to it.
|
||||
*/
|
||||
replacesLayerBelow?(below: Layer): boolean;
|
||||
/**
|
||||
* Dim everything painted beneath this layer: a 0..1 brightness factor
|
||||
* applied to the pixels and glyphs of every plane below it in the stack
|
||||
@@ -326,7 +335,9 @@ export class LayerStack {
|
||||
return [ownPlane];
|
||||
}
|
||||
const dim = layer.dimUnderneath || 1;
|
||||
const below = this.paintLayer(layer.paintOverBase ? 0 : index - 1, dimSoFar * dim, raw);
|
||||
let belowIndex = layer.paintOverBase ? 0 : index - 1;
|
||||
while (belowIndex > 0 && layer.replacesLayerBelow?.(this.layers[belowIndex]!)) belowIndex--;
|
||||
const below = this.paintLayer(belowIndex, dimSoFar * dim, raw);
|
||||
return [...(!raw && dim < 1 ? dimPlanes(below, dim) : below), ownPlane];
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user