tldraw/state/cursor.ts

18 lines
326 B
TypeScript
Raw Normal View History

2021-06-07 21:12:14 +00:00
const cursorSvgs = {
default: 'pointer',
resize: 'resize',
grab: 'grab',
}
class Cursor {
setCursor(cursor: keyof typeof cursorSvgs, rotation = 0) {
document.body.style.setProperty('cursor', `url(${cursorSvgs[cursor]}.svg)`)
}
resetCursor() {
this.setCursor('default')
}
}
export default new Cursor()