{ "version": 3, "sources": ["../../../../../src/lib/shapes/geo/toolStates/Idle.ts"], "sourcesContent": ["import { StateNode, TLEventHandlers } from '@tldraw/editor'\n\nexport class Idle extends StateNode {\n\tstatic override id = 'idle'\n\n\toverride onPointerDown: TLEventHandlers['onPointerDown'] = (info) => {\n\t\tthis.parent.transition('pointing', info)\n\t}\n\n\toverride onEnter = () => {\n\t\tthis.editor.setCursor({ type: 'cross', rotation: 0 })\n\t}\n\n\toverride onKeyUp: TLEventHandlers['onKeyUp'] = (info) => {\n\t\tif (info.key === 'Enter') {\n\t\t\tif (this.editor.instanceState.isReadonly) return null\n\n\t\t\tconst { onlySelectedShape } = this.editor\n\t\t\t// If the only selected shape is editable, start editing it\n\t\t\tif (\n\t\t\t\tonlySelectedShape &&\n\t\t\t\tthis.editor.getShapeUtil(onlySelectedShape).canEdit(onlySelectedShape)\n\t\t\t) {\n\t\t\t\tthis.editor.setCurrentTool('select')\n\t\t\t\tthis.editor.setEditingShape(onlySelectedShape.id)\n\t\t\t\tthis.editor.root.current.value!.transition('editing_shape', {\n\t\t\t\t\t...info,\n\t\t\t\t\ttarget: 'shape',\n\t\t\t\t\tshape: onlySelectedShape,\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t}\n\n\toverride onCancel = () => {\n\t\tthis.editor.setCurrentTool('select')\n\t}\n}\n"], "mappings": "AAAA,SAAS,iBAAkC;AAEpC,MAAM,aAAa,UAAU;AAAA,EACnC,OAAgB,KAAK;AAAA,EAEZ,gBAAkD,CAAC,SAAS;AACpE,SAAK,OAAO,WAAW,YAAY,IAAI;AAAA,EACxC;AAAA,EAES,UAAU,MAAM;AACxB,SAAK,OAAO,UAAU,EAAE,MAAM,SAAS,UAAU,EAAE,CAAC;AAAA,EACrD;AAAA,EAES,UAAsC,CAAC,SAAS;AACxD,QAAI,KAAK,QAAQ,SAAS;AACzB,UAAI,KAAK,OAAO,cAAc;AAAY,eAAO;AAEjD,YAAM,EAAE,kBAAkB,IAAI,KAAK;AAEnC,UACC,qBACA,KAAK,OAAO,aAAa,iBAAiB,EAAE,QAAQ,iBAAiB,GACpE;AACD,aAAK,OAAO,eAAe,QAAQ;AACnC,aAAK,OAAO,gBAAgB,kBAAkB,EAAE;AAChD,aAAK,OAAO,KAAK,QAAQ,MAAO,WAAW,iBAAiB;AAAA,UAC3D,GAAG;AAAA,UACH,QAAQ;AAAA,UACR,OAAO;AAAA,QACR,CAAC;AAAA,MACF;AAAA,IACD;AAAA,EACD;AAAA,EAES,WAAW,MAAM;AACzB,SAAK,OAAO,eAAe,QAAQ;AAAA,EACpC;AACD;", "names": [] }