;(function () {
const osName = __TEMPLATE_os_name__
const TAURI_DRAG_REGION_ATTR = 'data-tauri-drag-region'
let x = 0,
y = 0
document.addEventListener('mousedown', (e) => {
if (
e.target.hasAttribute(TAURI_DRAG_REGION_ATTR)
&& e.button === 0
&& (e.detail === 1 || e.detail === 2)
) {
if (osName === 'macos' && e.detail == 2) {
x = e.clientX
y = e.clientY
return
}
e.preventDefault()
e.stopImmediatePropagation()
const cmd = e.detail === 2 ? 'internal_toggle_maximize' : 'start_dragging'
window.__TAURI_INTERNALS__.invoke('plugin:window|' + cmd)
}
})
if (osName === 'macos') {
document.addEventListener('mouseup', (e) => {
if (
e.target.hasAttribute(TAURI_DRAG_REGION_ATTR)
&& e.button === 0
&& e.detail === 2
&& e.clientX === x
&& e.clientY === y
) {
window.__TAURI_INTERNALS__.invoke(
'plugin:window|internal_toggle_maximize'
)
}
})
}
})()