From 4040f07bb07610b51d3b530f3f9ca191cdb79a5f Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Fri, 15 Nov 2024 14:22:07 -0800 Subject: [PATCH] `fullscreen.state.get: UseBooleanGet` replaces `fullscreen` & export `SetControlAnchorTitleOptions` subtypes: - AnchorAssignTitleOptions - ControlAnchorTitleStates --- .../control/set-control-anchor-title.ts | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/leaf/map/fullscreen/control/set-control-anchor-title.ts b/src/leaf/map/fullscreen/control/set-control-anchor-title.ts index 0c80c86..adf0855 100644 --- a/src/leaf/map/fullscreen/control/set-control-anchor-title.ts +++ b/src/leaf/map/fullscreen/control/set-control-anchor-title.ts @@ -1,23 +1,27 @@ -import { type UseAnchor } from '../state/use-anchor' +import { type AnchorAssign } from '../state/use-anchor' +import { type UseBooleanGet } from '../state/use-boolean' + +export type ControlAnchorTitleStates = Record<'false' | 'true', string> +export type AnchorAssignTitleOptions = { + assign: AnchorAssign + titleStates: ControlAnchorTitleStates +} export type SetControlAnchorTitleOptions = { - anchor: { - assign: UseAnchor['assign'] - titleStates: Record<'false' | 'true', string> - } - fullscreen: boolean + anchor: AnchorAssignTitleOptions + fullscreen: { state: { get: UseBooleanGet } } } export function setControlAnchorTitle({ anchor: { assign: anchorAssign, titleStates: anchorTitleStates }, - fullscreen, + fullscreen: { + state: { get: getFullscreenState }, + }, }: SetControlAnchorTitleOptions): HTMLElement { return anchorAssign({ title: anchorTitleStates[ - ( - fullscreen.toString() - ) + getFullscreenState().toString() ], }) }