dist/melonjs.js
function setEvent(event, pageX, pageY, clientX, clientY, pointerId) {
         var width = 1;
         var height = 1; // the original event object

         this.event = event;
         this.pageX = pageX || 0;
         this.pageY = pageY || 0;
         this.clientX = clientX || 0;
         this.clientY = clientY || 0; // translate to local coordinates

         me.input.globalToLocal(this.pageX, this.pageY, this.pos); // true if not originally a pointer event

         this.isNormalized = !me.device.PointerEvent || me.device.PointerEvent && !(event instanceof window.PointerEvent);

         if (event.type === "wheel") {
           this.deltaMode = 1;
           this.deltaX = event.deltaX;
           this.deltaY = -1 / 40 * event.wheelDelta;
           event.wheelDeltaX && (this.deltaX = -1 / 40 * event.wheelDeltaX);
         } // could be 0, so test if defined


         this.pointerId = typeof pointerId !== "undefined" ? pointerId : 1;
         this.isPrimary = typeof event.isPrimary !== "undefined" ? event.isPrimary : true; // in case of touch events, button is not defined

         this.button = event.button || 0;
         this.type = event.type;
         this.gameScreenX = this.pos.x;
         this.gameScreenY = this.pos.y; // get the current screen to world offset

         if (typeof me.game.viewport !== "undefined") {
           me.game.viewport.localToWorld(this.gameScreenX, this.gameScreenY, viewportOffset);
         }
         /* Initialize the two coordinate space properties. */


         this.gameWorldX = viewportOffset.x;
         this.gameWorldY = viewportOffset.y; // get the pointer size

         if (this.isNormalized === false) {
           // native PointerEvent
           width = event.width || 1;
           height = event.height || 1;
         } else if (typeof event.radiusX === "number") {
           // TouchEvent
           width = event.radiusX * 2 || 1;
           height = event.radiusY * 2 || 1;
         } // resize the pointer object accordingly


         this.resize(width, height);
       }
function setEvent(event, pageX, pageY, clientX, clientY, pointerId) {
         var width = 1;
         var height = 1; // the original event object

         this.event = event;
         this.pageX = pageX || 0;
         this.pageY = pageY || 0;
         this.clientX = clientX || 0;
         this.clientY = clientY || 0; // translate to local coordinates

         me.input.globalToLocal(this.pageX, this.pageY, this.pos); // true if not originally a pointer event

         this.isNormalized = !me.device.PointerEvent || me.device.PointerEvent && !(event instanceof window.PointerEvent);

         if (event.type === "wheel") {
           this.deltaMode = 1;
           this.deltaX = event.deltaX;
           this.deltaY = -1 / 40 * event.wheelDelta;
           event.wheelDeltaX && (this.deltaX = -1 / 40 * event.wheelDeltaX);
         } // could be 0, so test if defined


         this.pointerId = typeof pointerId !== "undefined" ? pointerId : 1;
         this.isPrimary = typeof event.isPrimary !== "undefined" ? event.isPrimary : true; // in case of touch events, button is not defined

         this.button = event.button || 0;
         this.type = event.type;
         this.gameScreenX = this.pos.x;
         this.gameScreenY = this.pos.y; // get the current screen to world offset

         if (typeof me.game.viewport !== "undefined") {
           me.game.viewport.localToWorld(this.gameScreenX, this.gameScreenY, viewportOffset);
         }
         /* Initialize the two coordinate space properties. */


         this.gameWorldX = viewportOffset.x;
         this.gameWorldY = viewportOffset.y; // get the pointer size

         if (this.isNormalized === false) {
           // native PointerEvent
           width = event.width || 1;
           height = event.height || 1;
         } else if (typeof event.radiusX === "number") {
           // TouchEvent
           width = event.radiusX * 2 || 1;
           height = event.radiusY * 2 || 1;
         } // resize the pointer object accordingly


         this.resize(width, height);
       }
function setEvent ( event , pageX , pageY , clientX , clientY , pointerId ) { var width = 1 ; var height = 1 ; // the original event object this . event = event ; this . pageX = pageX || 0 ; this . pageY = pageY || 0 ; this . clientX = clientX || 0 ; this . clientY = clientY || 0 ; // translate to local coordinates me . input . globalToLocal ( this . pageX , this . pageY , this . pos ) ; // true if not originally a pointer event this . isNormalized = ! me . device . PointerEvent || me . device . PointerEvent && ! ( event instanceof window . PointerEvent ) ; if ( event . type === "wheel" ) { this . deltaMode = 1 ; this . deltaX = event . deltaX ; this . deltaY = - 1 / 40 * event . wheelDelta ; event . wheelDeltaX && ( this . deltaX = - 1 / 40 * event . wheelDeltaX ) ; } // could be 0, so test if defined this . pointerId = typeof pointerId !== "undefined" ? pointerId : 1 ; this . isPrimary = typeof event . isPrimary !== "undefined" ? event . isPrimary : true ; // in case of touch events, button is not defined this . button = event . button || 0 ; this . type = event . type ; this . gameScreenX = this . pos . x ; this . gameScreenY = this . pos . y ; // get the current screen to world offset if ( typeof me . game . viewport !== "undefined" ) { me . game . viewport . localToWorld ( this . gameScreenX , this . gameScreenY , viewportOffset ) ; } /* Initialize the two coordinate space properties. */ this . gameWorldX = viewportOffset . x ; this . gameWorldY = viewportOffset . y ; // get the pointer size if ( this . isNormalized === false ) { // native PointerEvent width = event . width || 1 ; height = event . height || 1 ; } else if ( typeof event . radiusX === "number" ) { // TouchEvent width = event . radiusX * 2 || 1 ; height = event . radiusY * 2 || 1 ; } // resize the pointer object accordingly this . resize ( width , height ) ; }
initialize the Pointer object using the given Event Object
@name me.Pointer#set
@private
@function
@param {Event} event the original Event object
@param {Number} pageX the horizontal coordinate at which the event occurred, relative to the left edge of the entire document
@param {Number} pageY the vertical coordinate at which the event occurred, relative to the left edge of the entire document
@param {Number} clientX the horizontal coordinate within the application's client area at which the event occurred
@param {Number} clientX the vertical coordinate within the application's client area at which the event occurred
@param {Number} pointedId the Pointer, Touch or Mouse event Id
initialize the Pointer object using the given Event Object