import type { CursorSet } from '@/demo/pointer'
/**
* The bundled pointer artwork, drawn as vector markup rather than read from a
* theme on disk. Spike 3 proved the browser decodes a Windows cursor resource
* directly, so `--cursor` points at a theme folder and gets that path instead.
* This set is what makes the command work in a target that has no theme to
* point at, which is every target on first run.
*
* Each drawing sits in a 48 by 48 box so one hotspot scale factor covers the
* set, and each carries a drop shadow so it stays visible over a light surface
* and a dark one.
*/
const SHADOW =
'' +
''
function svg(body: string): string {
return `data:image/svg+xml;utf8,${encodeURIComponent(
``,
)}`
}
const STROKE = 'fill="#ffffff" stroke="#1b1b1b" stroke-width="2.2"'
/**
* Hotspots are stated against the 48 by 48 box each drawing uses, so the
* pointer scales them the same way it scales a hotspot read off a real cursor
* resource. Skipping the scale offsets the artwork by roughly a third of a
* cursor, which is the defect spike 3 recorded.
*/
export const DEFAULT_CURSORS: CursorSet = {
default: {
image: svg(
``,
),
hotspot: { width: 48, height: 48, hotspotX: 5, hotspotY: 3 },
},
pointer: {
image: svg(
``,
),
hotspot: { width: 48, height: 48, hotspotX: 21, hotspotY: 4 },
},
// Drawn as one filled outline rather than three stroked segments. A stroked
// version needs its own fill, and a second fill attribute on a path carrying
// STROKE makes the markup invalid, which renders as a broken image.
text: {
image: svg(
``,
),
hotspot: { width: 48, height: 48, hotspotX: 24, hotspotY: 24 },
},
}