export function listenWindow<K extends keyof WindowEventMap>(event: K, handler: (e: WindowEventMap[K]) => void) {
  window.addEventListener(event, handler)

  return () => {
    window.removeEventListener<K>(event, handler)
  }
}

export interface Transform { k: number; x: number; y: number }
export interface Mouse { x: number; y: number }
export type ZoomSource = 'wheel' | 'touch' | 'dblclick'

