fix: put window on top if clicked on, not just being dragged
All checks were successful
create archive with lfs / tag (push) Successful in 9s

This commit is contained in:
dusk 2024-11-02 01:10:09 +03:00
parent b9688e5765
commit 1065b9ddda
Signed by: dusk
SSH Key Fingerprint: SHA256:Abmvag+juovVufZTxyWY8KcVgrznxvBjQpJesv071Aw

View File

@ -25,18 +25,23 @@
const isOnMobile = isMobile() const isOnMobile = isMobile()
const _draggable = isOnMobile ? () => {} : draggable; const _draggable = isOnMobile ? () => {} : draggable;
const focusWindow = (node: HTMLElement) => {
$highestZIndex += 1
node.style.zIndex = $highestZIndex.toString()
}
</script> </script>
<!-- svelte-ignore a11y-no-static-element-interactions -->
<!-- svelte-ignore a11y-click-events-have-key-events -->
<div <div
use:_draggable={{ use:_draggable={{
disabled: isOnMobile, disabled: isOnMobile,
applyUserSelectHack: true, applyUserSelectHack: true,
handle: '.window-titlebar', handle: '.window-titlebar',
onDragStart: (data) => { onDragStart: (data) => {focusWindow(data.currentNode)},
$highestZIndex += 1
data.currentNode.style.zIndex = $highestZIndex.toString()
},
}} }}
on:click={(data) => {focusWindow(data.currentTarget)}}
class=" class="
relative flex flex-col {sticky ? 'md:sticky md:-top-9' : ''} {center ? "mx-auto" : ""} relative flex flex-col {sticky ? 'md:sticky md:-top-9' : ''} {center ? "mx-auto" : ""}
max-w-screen-md xl:max-w-screen-lg 2xl:max-w-screen-xl min-w-[30ch] lg:min-w-[40ch] w-full md:w-fit [height:fit-content] max-w-screen-md xl:max-w-screen-lg 2xl:max-w-screen-xl min-w-[30ch] lg:min-w-[40ch] w-full md:w-fit [height:fit-content]