let BaseNode=require("../Utils/BaseNode").BaseNode,APJS=require("../../../amazingpro");class OnePointTouch extends BaseNode{constructor(){super(),this.moving=!1,this.idle=!0,this.frameSinceTouchBegin=0,this.lastTouchPosition=new APJS.Vector2f(-1,-1),this.currentTouchPosition=new APJS.Vector2f(-1,-1)}beforeStart(t){this.reset(),this.lastTouchPosition.x=-1,this.lastTouchPosition.y=-1}onEvent(t,s){s.type===APJS.EventType.Touch&&(s=s.args[0],this.currentTouchPosition=new APJS.Vector2f(s.position.x,1-s.position.y),this.outputs[4]=this.currentTouchPosition,this.moving=!1,s.phase===APJS.TouchPhase.Began?(this.frameSinceTouchBegin=0,this.idle=!1,this.nexts[1]&&this.nexts[1]()):s.phase!==APJS.TouchPhase.Ended&&s.phase!==APJS.TouchPhase.Canceled||(this.nexts[3]&&this.nexts[3](),this.reset()))}onUpdate(t,s){this.outputs[4]=this.currentTouchPosition,this.outputs[5]=this.lastTouchPosition,this.idle?this.nexts[0]&&this.nexts[0]():(this.nexts[2]&&this.nexts[2](),this.lastTouchPosition=this.currentTouchPosition)}resetOnRecord(t){this.frameSinceTouchBegin=0,this.lastTouchPosition.x=-1,this.lastTouchPosition.y=-1,this.reset()}reset(){this.idle=!0,this.moving=!1,this.currentTouchPosition.x=-1,this.currentTouchPosition.y=-1}}exports.OnePointTouch=OnePointTouch;