From 09415c48248275b3c623a84ffe579b9f661cd42e Mon Sep 17 00:00:00 2001 From: Tentone Date: Tue, 3 Sep 2024 23:21:14 +0100 Subject: [PATCH] Derp --- dist/index.js | 2 +- dist/source/main.d.ts | 4 +++- package.json | 8 ++++---- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/dist/index.js b/dist/index.js index 977d8bf..f01ad75 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1 +1 @@ -var t,e={d:(t,n)=>{for(var s in n)e.o(n,s)&&!e.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:n[s]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},n={};e.d(n,{zx:()=>o,Wc:()=>t,Qz:()=>r,nJ:()=>u,yb:()=>p,a7:()=>i,N1:()=>h,R8:()=>d,TK:()=>m,tc:()=>y,VP:()=>_,Xh:()=>w,GW:()=>E,FM:()=>l}),function(t){t[t.DOWN=-1]="DOWN",t[t.UP=1]="UP",t[t.RESET=0]="RESET"}(t||(t={}));var s,o=function(){function e(){this.pressed=!1,this.justPressed=!1,this.justReleased=!1}return e.prototype.update=function(e){this.justPressed=!1,this.justReleased=!1,e===t.DOWN?(this.pressed||(this.justPressed=!0),this.pressed=!0):e===t.UP?(this.pressed&&(this.justReleased=!0),this.pressed=!1):e===t.RESET&&(this.justReleased=!1,this.justPressed=!1)},e.prototype.set=function(t,e,n){this.justPressed=t,this.pressed=e,this.justReleased=n},e.prototype.reset=function(){this.justPressed=!1,this.pressed=!1,this.justReleased=!1},e}(),i=function(){function t(){}return t.prototype.initialize=function(){},t.prototype.dispose=function(){},t}(),r=function(){function t(){this.events=[]}return t.prototype.add=function(t,e,n){this.events.push([t,e,n,!1])},t.prototype.addAndCreate=function(t,e,n){t.addEventListener(e,n),this.events.push([t,e,n,!0])},t.prototype.clear=function(){this.destroy(),this.events=[]},t.prototype.remove=function(t,e){for(var n=this.events.length-1;n>=0;n--)this.events[n][0]===t&&this.events[n][1]===e&&(this.events[n][3]&&(this.events[n][0].removeEventListener(this.events[n][1],this.events[n][2]),this.events[n][3]=!1),this.events.splice(n,1))},t.prototype.create=function(){for(var t=0;tthis.buttons.length?0:this.applyDeadzone(this.gamepad.buttons[t].value)},n.prototype.getAxis=function(t){return!this.gamepad||t<0||t>this.gamepad.axes.length?0:this.applyDeadzone(this.gamepad.axes[t])},n.prototype.buttonExists=function(t){return t>=0&&te;){var n=this.actions.shift(),s=this.actions.shift();this.keys[n].update(s),(this.keys[n].justReleased||this.keys[n].justPressed)&&(this.actions.push(n),this.actions.push(t.RESET),e+=2)}},n.prototype.reset=function(){for(var t=0;t0)){var n=new l(0,0);this.events.add(this.domElement,"touchstart",(function(s){var o=s.touches[0];e.updatePosition(o.screenX,o.screenY,0,0),e.updateKey(y.LEFT,t.DOWN),n.set(o.screenX,o.screenY)})),this.events.add(this.domElement,"touchend",(function(n){e.updateKey(y.LEFT,t.UP)})),this.events.add(this.domElement,"touchcancel",(function(n){e.updateKey(y.LEFT,t.UP)})),this.events.add(document.body,"touchmove",(function(t){var s=t.touches[0];e.updatePosition(s.screenX,s.screenY,s.screenX-n.x,s.screenY-n.y),n.set(s.screenX,s.screenY)}))}this.events.add(this.domElement,"mousemove",(function(t){e.updatePosition(t.offsetX,t.offsetY,t.movementX,t.movementY)})),this.events.add(this.domElement,"mousedown",(function(n){e.updateKey(n.which-1,t.DOWN)})),this.events.add(this.domElement,"mouseup",(function(n){e.updateKey(n.which-1,t.UP)})),this.events.add(this.domElement,"mouseleave",(function(n){e.updateKey(n.which-1,t.UP)})),this.events.add(this.domElement,"dragstart",(function(n){e.updateKey(n.which-1,t.UP)})),this.events.add(this.domElement,"dblclick",(function(t){e.tempDoubleClicked=!0}))},n.prototype.setCanvas=function(t){this.canvas=t,t.mouseInside=!1,t.addEventListener("mouseenter",(function(t){this.mouseInside=!0})),t.addEventListener("mouseleave",(function(t){this.mouseInside=!1}))},n.prototype.insideCanvas=function(){return null!==this.canvas&&this.canvas.mouseInside},n.prototype.setLock=function(t){null!==this.canvas&&(t?this.canvas.requestPointerLock?this.canvas.requestPointerLock():this.canvas.mozRequestPointerLock?this.canvas.mozRequestPointerLock():this.canvas.webkitRequestPointerLock&&this.canvas.webkitRequestPointerLock():document.exitPointerLock?document.exitPointerLock():document.mozExitPointerLock?document.mozExitPointerLock():document.webkitExitPointerLock&&document.webkitExitPointerLock())},n.prototype.buttonPressed=function(t){return this.keys[t].pressed},n.prototype.buttonDoubleClicked=function(){return this.doubleClicked},n.prototype.buttonJustPressed=function(t){return this.keys[t].justPressed},n.prototype.buttonJustReleased=function(t){return this.keys[t].justReleased},n.prototype.updatePosition=function(t,e,n,s){this.tempPosition.set(t,e),this.tempDelta.x+=n,this.tempDelta.y+=s,this.positionUpdated=!0},n.prototype.updateKey=function(t,e){t>-1&&this.tempKeys[t].update(e)},n.prototype.update=function(){for(var t=0;t=e.maxPoints)){var i=new l(o.screenX,o.screenY);e.temp[o.identifier].first.copy(i),e.temp[o.identifier].last.copy(i),e.updatePoint(o.identifier,t.DOWN,o.force,o.rotationAngle,i,new l(o.radiusX,o.radiusY))}}})),this.events.add(this.domElement,"touchend",(function(n){for(var s=0;s=e.maxPoints||e.updatePoint(o.identifier,t.UP,o.force,o.rotationAngle,new l(o.screenX,o.screenY),new l(o.radiusX,o.radiusY))}})),this.events.add(this.domElement,"touchcancel",(function(n){for(var s=0;s=e.maxPoints||e.updatePoint(o.identifier,t.UP,o.force,o.rotationAngle,new l(o.screenX,o.screenY),new l(0,0))}})),this.events.add(document.body,"touchmove",(function(n){for(var s=0;s=e.maxPoints||e.updatePoint(o.identifier,t.DOWN,o.force,o.rotationAngle,new l(o.screenX,o.screenY),new l(o.radiusX,o.radiusY))}}))},n.prototype.updatePoint=function(t,e,n,s,o,i){this.temp[t].force=n,this.temp[t].rotation=s,this.temp[t].position.copy(o),this.temp[t].radius.copy(i),this.temp[t].action=e},n.prototype.update=function(){var t=null;this.points[0].pressed&&this.points[1].pressed&&(t=this.points[0].position.dist(this.points[1].position));for(var e=0;e{for(var s in n)e.o(n,s)&&!e.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:n[s]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},n={};e.d(n,{zx:()=>r,Wc:()=>t,Qz:()=>u,nJ:()=>d,bE:()=>h,yb:()=>c,Sl:()=>o,RN:()=>i,a7:()=>a,N1:()=>y,R8:()=>l,TK:()=>P,tc:()=>E,VP:()=>T,Xh:()=>g,GW:()=>_,FM:()=>m}),function(t){t[t.DOWN=-1]="DOWN",t[t.UP=1]="UP",t[t.RESET=0]="RESET"}(t||(t={}));var s,o,i,r=function(){function e(){this.pressed=!1,this.justPressed=!1,this.justReleased=!1}return e.prototype.update=function(e){this.justPressed=!1,this.justReleased=!1,e===t.DOWN?(this.pressed||(this.justPressed=!0),this.pressed=!0):e===t.UP?(this.pressed&&(this.justReleased=!0),this.pressed=!1):e===t.RESET&&(this.justReleased=!1,this.justPressed=!1)},e.prototype.set=function(t,e,n){this.justPressed=t,this.pressed=e,this.justReleased=n},e.prototype.reset=function(){this.justPressed=!1,this.pressed=!1,this.justReleased=!1},e}(),a=function(){function t(){}return t.prototype.initialize=function(){},t.prototype.dispose=function(){},t}(),u=function(){function t(){this.events=[]}return t.prototype.add=function(t,e,n){this.events.push([t,e,n,!1])},t.prototype.addAndCreate=function(t,e,n){t.addEventListener(e,n),this.events.push([t,e,n,!0])},t.prototype.clear=function(){this.destroy(),this.events=[]},t.prototype.remove=function(t,e){for(var n=this.events.length-1;n>=0;n--)this.events[n][0]===t&&this.events[n][1]===e&&(this.events[n][3]&&(this.events[n][0].removeEventListener(this.events[n][1],this.events[n][2]),this.events[n][3]=!1),this.events.splice(n,1))},t.prototype.create=function(){for(var t=0;tthis.buttons.length?0:this.applyDeadzone(this.gamepad.buttons[t].value)},n.prototype.getAxis=function(t){return!this.gamepad||t<0||t>this.gamepad.axes.length?0:this.applyDeadzone(this.gamepad.axes[t])},n.prototype.buttonExists=function(t){return t>=0&&te;){var n=this.actions.shift(),s=this.actions.shift();this.keys[n].update(s),(this.keys[n].justReleased||this.keys[n].justPressed)&&(this.actions.push(n),this.actions.push(t.RESET),e+=2)}},n.prototype.reset=function(){for(var t=0;t0)){var n=new m(0,0);this.events.add(this.domElement,"touchstart",(function(s){var o=s.touches[0];e.updatePosition(o.screenX,o.screenY,0,0),e.updateKey(E.LEFT,t.DOWN),n.set(o.screenX,o.screenY)})),this.events.add(this.domElement,"touchend",(function(n){e.updateKey(E.LEFT,t.UP)})),this.events.add(this.domElement,"touchcancel",(function(n){e.updateKey(E.LEFT,t.UP)})),this.events.add(document.body,"touchmove",(function(t){var s=t.touches[0];e.updatePosition(s.screenX,s.screenY,s.screenX-n.x,s.screenY-n.y),n.set(s.screenX,s.screenY)}))}this.events.add(this.domElement,"mousemove",(function(t){e.updatePosition(t.offsetX,t.offsetY,t.movementX,t.movementY)})),this.events.add(this.domElement,"mousedown",(function(n){e.updateKey(n.which-1,t.DOWN)})),this.events.add(this.domElement,"mouseup",(function(n){e.updateKey(n.which-1,t.UP)})),this.events.add(this.domElement,"mouseleave",(function(n){e.updateKey(n.which-1,t.UP)})),this.events.add(this.domElement,"dragstart",(function(n){e.updateKey(n.which-1,t.UP)})),this.events.add(this.domElement,"dblclick",(function(t){e.tempDoubleClicked=!0}))},n.prototype.setCanvas=function(t){this.canvas=t,t.mouseInside=!1,t.addEventListener("mouseenter",(function(t){this.mouseInside=!0})),t.addEventListener("mouseleave",(function(t){this.mouseInside=!1}))},n.prototype.insideCanvas=function(){return null!==this.canvas&&this.canvas.mouseInside},n.prototype.setLock=function(t){null!==this.canvas&&(t?this.canvas.requestPointerLock?this.canvas.requestPointerLock():this.canvas.mozRequestPointerLock?this.canvas.mozRequestPointerLock():this.canvas.webkitRequestPointerLock&&this.canvas.webkitRequestPointerLock():document.exitPointerLock?document.exitPointerLock():document.mozExitPointerLock?document.mozExitPointerLock():document.webkitExitPointerLock&&document.webkitExitPointerLock())},n.prototype.buttonPressed=function(t){return this.keys[t].pressed},n.prototype.buttonDoubleClicked=function(){return this.doubleClicked},n.prototype.buttonJustPressed=function(t){return this.keys[t].justPressed},n.prototype.buttonJustReleased=function(t){return this.keys[t].justReleased},n.prototype.updatePosition=function(t,e,n,s){this.tempPosition.set(t,e),this.tempDelta.x+=n,this.tempDelta.y+=s,this.positionUpdated=!0},n.prototype.updateKey=function(t,e){t>-1&&this.tempKeys[t].update(e)},n.prototype.update=function(){for(var t=0;t=e.maxPoints)){var i=new m(o.screenX,o.screenY);e.temp[o.identifier].first.copy(i),e.temp[o.identifier].last.copy(i),e.updatePoint(o.identifier,t.DOWN,o.force,o.rotationAngle,i,new m(o.radiusX,o.radiusY))}}})),this.events.add(this.domElement,"touchend",(function(n){for(var s=0;s=e.maxPoints||e.updatePoint(o.identifier,t.UP,o.force,o.rotationAngle,new m(o.screenX,o.screenY),new m(o.radiusX,o.radiusY))}})),this.events.add(this.domElement,"touchcancel",(function(n){for(var s=0;s=e.maxPoints||e.updatePoint(o.identifier,t.UP,o.force,o.rotationAngle,new m(o.screenX,o.screenY),new m(0,0))}})),this.events.add(document.body,"touchmove",(function(n){for(var s=0;s=e.maxPoints||e.updatePoint(o.identifier,t.DOWN,o.force,o.rotationAngle,new m(o.screenX,o.screenY),new m(o.radiusX,o.radiusY))}}))},n.prototype.updatePoint=function(t,e,n,s,o,i){this.temp[t].force=n,this.temp[t].rotation=s,this.temp[t].position.copy(o),this.temp[t].radius.copy(i),this.temp[t].action=e},n.prototype.update=function(){var t=null;this.points[0].pressed&&this.points[1].pressed&&(t=this.points[0].position.dist(this.points[1].position));for(var e=0;e