UNPKG

3.32 kBPlain TextView Raw
1{"code":"function defineName$__(cls,name){\n\tObject.defineProperty(cls,\"name\",{value:name,configurable:true});\n};;\nfunction extend$__(target,ext){\n\t// @ts-ignore\n\tconst descriptors = Object.getOwnPropertyDescriptors(ext);\n\tdelete descriptors.constructor;\n\tif(target.extend__ instanceof Function){\n\t\ttarget.extend__(descriptors,ext);\n\t} else {\n\t\t// @ts-ignore\n\t\tObject.defineProperties(target,descriptors);\n\t}\n\treturn target;\n};\n\n/*body*/\n// imba$imbaPath=global\n\nimport {Event,PointerEvent,Element} from '../dom/core';\nimport {listen,once,emit,unlisten} from '../utils';\n\nimport {use_events_mouse} from './mouse';\nuse_events_mouse();\n\nimport * as helpers from './helpers';\n\nexport function use_events_pointer(){\n\t\n\tglobalThis.imba.uses_events_pointer = true;\n\treturn true;\n};\n\n// Adding the pointerevent modifiers\nclass ΩPointerEvent {\n\t\n\t\n\tαprimary(){\n\t\t\n\t\treturn !(!(this.isPrimary)) && (this.pointerType != 'mouse' || this.button == 0);\n\t}\n\t\n\tαmouse(){\n\t\t\n\t\treturn this.pointerType == 'mouse';\n\t}\n\t\n\tαpen(){\n\t\t\n\t\treturn this.pointerType == 'pen';\n\t}\n\t\n\tαtouch(){\n\t\t\n\t\treturn this.pointerType == 'touch';\n\t}\n\t\n\tαpressure(threshold = 0.5){\n\t\t\n\t\treturn this.pressure >= threshold;\n\t}\n\t\n\tαlock(){\n\t\t\n\t\treturn true;\n\t}\n\tstatic {\n\t\tdefineName$__(this,'PointerEvent');}\n};\nextend$__(PointerEvent.prototype,ΩPointerEvent.prototype);\n;\n","map":{"version":3,"file":"pointer.js","sourceRoot":"","sources":["/Users/abdellah/workspace/scrimba/imba/packages/imba/src/imba/events/pointer.imba"],"sourcesContent":["# imba$imbaPath=global\n\nimport {Event,PointerEvent,Element} from '../dom/core'\nimport {listen,once,emit,unlisten} from '../utils'\n\nimport {use_events_mouse} from './mouse'\nuse_events_mouse!\n\nimport * as helpers from './helpers'\n\nexport def use_events_pointer\n\tglobal.imba.uses_events_pointer = yes\n\tyes\n\n# Adding the pointerevent modifiers\nextend class PointerEvent\n\n\tdef @primary\n\t\treturn !!isPrimary and (pointerType != 'mouse' or button == 0)\n\n\tdef @mouse\n\t\treturn pointerType == 'mouse'\n\n\tdef @pen\n\t\treturn pointerType == 'pen'\n\n\tdef @touch\n\t\treturn pointerType == 'touch'\n\n\tdef @pressure threshold = 0.5\n\t\treturn pressure >= threshold\n\n\tdef @lock\n\t\treturn yes"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAEA,MAAM,EAAE,KAAK,CAAC,YAAY,CAAC,OAAO,OAAO,aAAa;AACtD,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,OAAO,UAAU;;AAElD,MAAM,EAAE,gBAAgB,OAAO,SAAS;AACxC,gBAAgB,EAAC;;AAEjB,MAAM,CAAC,CAAC,IAAI,OAAO,MAAM,WAAW;;AAEpC,MAAM,CAAC,QAAG,CAAC,kBAAkB,EAAA;;CAC5B,UAAM,CAAC,IAAI,CAAC,mBAAmB,GAAG,IAAG;CACrC,OAAA,IAAG;CAAA;;;AAGG,KAAK,CAAC,aAAY,EAAA;;;CAEpB,QAAQ,EAAA;;EACX,MAAM,CAAC,EAAC,EAAC,KAAA,SAAS,CAAA,CAAA,CAAC,EAAG,EAAE,KAAA,WAAW,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,KAAA,MAAM,CAAC,EAAE,CAAC,CAAC;EAAC;;CAE3D,MAAM,EAAA;;EACT,MAAM,CAAC,KAAA,WAAW,CAAC,EAAE,CAAC,OAAO;EAAA;;CAE1B,IAAI,EAAA;;EACP,MAAM,CAAC,KAAA,WAAW,CAAC,EAAE,CAAC,KAAK;EAAA;;CAExB,MAAM,EAAA;;EACT,MAAM,CAAC,KAAA,WAAW,CAAC,EAAE,CAAC,OAAO;EAAA;;CAE1B,SAAS,CAAC,SAAS,GAAG,GAAG,CAAA;;EAC5B,MAAM,CAAC,KAAA,QAAQ,CAAC,EAAE,CAAC,SAAS;EAAA;;CAEzB,KAAK,EAAA;;EACR,MAAM,CAAC,IAAG;EAAA;;;AAAA;UAlBC,YAAY;AAkBb;AAAA;"},"dependencies":[],"meta":{"vite":{"lang":"js"}}}
\No newline at end of file