mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-06-17 03:13:30 -07:00
feat(notifications): add overlay notifications with position config (#110)
This commit is contained in:
@@ -146,6 +146,29 @@ function measuredRectsForInput(measurement: OverlayContentMeasurementLike): Poin
|
||||
: [];
|
||||
}
|
||||
|
||||
function hasMeasuredInputRects(measurement: OverlayContentMeasurementLike): boolean {
|
||||
return measuredRectsForInput(measurement).some((rect) => rect.width > 0 && rect.height > 0);
|
||||
}
|
||||
|
||||
export function shouldPrimeLinuxOverlayInteractionFromMeasurement(deps: {
|
||||
getVisibleOverlayVisible: () => boolean;
|
||||
getMainWindow: () => PointerInteractionWindow | null;
|
||||
getSubtitleMeasurement: () => OverlayContentMeasurementLike;
|
||||
shouldSuspend: () => boolean;
|
||||
shouldSuppressInteraction?: () => boolean;
|
||||
}): boolean {
|
||||
if (!deps.getVisibleOverlayVisible()) return false;
|
||||
if (deps.shouldSuspend()) return false;
|
||||
|
||||
const mainWindow = deps.getMainWindow();
|
||||
if (!mainWindow || mainWindow.isDestroyed() || !mainWindow.isVisible()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (deps.shouldSuppressInteraction?.()) return false;
|
||||
return hasMeasuredInputRects(deps.getSubtitleMeasurement());
|
||||
}
|
||||
|
||||
function clampRectToWindow(rect: PointerRect, bounds: PointerRect): PointerRect | null {
|
||||
const left = Math.max(0, Math.floor(rect.x));
|
||||
const top = Math.max(0, Math.floor(rect.y));
|
||||
|
||||
Reference in New Issue
Block a user