Skip to content

Commit

Permalink
nest control under map
Browse files Browse the repository at this point in the history
  • Loading branch information
Stassi committed Nov 15, 2024
1 parent bf7d047 commit 3f4ed46
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 23 deletions.
32 changes: 17 additions & 15 deletions src/leaf/map/fullscreen/control/control-added-listener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,31 @@ import {
} from './set-control-anchor-title'

export type ControlAddedListenerOptions = {
control: {
anchor: {
assign: UseAnchor['assign']
onClick: UseAnchor['onClick']
titleStates: SetControlAnchorTitleOptions['anchorTitleStates']
map: {
control: {
anchor: {
assign: UseAnchor['assign']
onClick: UseAnchor['onClick']
titleStates: SetControlAnchorTitleOptions['anchorTitleStates']
}
container: { element: HTMLElement }
}
container: { element: HTMLElement }
fullscreen: { state: { get: () => boolean } }
}
map: { fullscreen: { state: { get: () => boolean } } }
}

export type ControlAddedListener = (map: Map) => HTMLElement

export function controlAddedListener({
control: {
anchor: {
assign: anchorAssign,
onClick: anchorOnClick,
titleStates: anchorTitleStates,
},
container: { element: containerElement },
},
map: {
control: {
anchor: {
assign: anchorAssign,
onClick: anchorOnClick,
titleStates: anchorTitleStates,
},
container: { element: containerElement },
},
fullscreen: {
state: { get: getFullscreenState },
},
Expand Down
16 changes: 8 additions & 8 deletions src/leaf/map/fullscreen/fullscreen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,15 +132,15 @@ export function fullscreenMap({
})

control.onAdd = controlAddedListener({
control: {
anchor: {
assign: anchorAssign,
onClick: anchorOnClick,
titleStates: anchorTitleStates,
},
container: { element: containerElement },
},
map: {
control: {
anchor: {
assign: anchorAssign,
onClick: anchorOnClick,
titleStates: anchorTitleStates,
},
container: { element: containerElement },
},
fullscreen: {
state: { get: getFullscreenState },
},
Expand Down

0 comments on commit 3f4ed46

Please sign in to comment.