Comparing version 1.8.6 to 1.9.0
@@ -96,5 +96,2 @@ 'use strict'; | ||
this.scroll_delta = 0; | ||
this.elapsed_time_since_pressed = 0; | ||
this.click_triggered = false; | ||
} | ||
@@ -116,7 +113,2 @@ | ||
get clicked() | ||
{ | ||
return this.click_triggered; | ||
} | ||
get is_touchscreen() | ||
@@ -140,3 +132,2 @@ { | ||
this.left_mouse_button_down = true; | ||
this.elapsed_time_since_pressed = new Date(); | ||
break; | ||
@@ -161,3 +152,2 @@ case 1: | ||
this.left_mouse_button_down = false; | ||
this.click_triggered = (new Date() - this.elapsed_time_since_pressed) < 200; | ||
break; | ||
@@ -268,8 +258,2 @@ case 1: | ||
this.update_previous_pointer_pos(); | ||
if (this.clicked) | ||
{ | ||
this.elapsed_time_since_pressed = 0; | ||
this.click_triggered = false; | ||
} | ||
} | ||
@@ -576,11 +560,4 @@ | ||
// this.pointers[0].distance_to(this.pointers[1]) | ||
this.elapsed_time_since_pressed = 0; | ||
this.click_triggered = false; | ||
} | ||
get clicked() | ||
{ | ||
return this.click_triggered; | ||
} | ||
get is_touchscreen() | ||
@@ -763,3 +740,2 @@ { | ||
this.left_mouse_button_down = true; | ||
this.elapsed_time_since_pressed = new Date(); | ||
} | ||
@@ -782,3 +758,2 @@ } | ||
this.left_mouse_button_down = false; | ||
this.click_triggered = (new Date() - this.elapsed_time_since_pressed) < 200; | ||
} | ||
@@ -834,7 +809,2 @@ this.remove_pointer(p.id); | ||
} | ||
if (this.clicked) | ||
{ | ||
this.elapsed_time_since_pressed = 0; | ||
this.click_triggered = false; | ||
} | ||
} | ||
@@ -1050,7 +1020,2 @@ } | ||
get clicked() | ||
{ | ||
return this.active_input_module.clicked; | ||
} | ||
get is_touchscreen() | ||
@@ -1057,0 +1022,0 @@ { |
@@ -92,5 +92,2 @@ class MathUtilities | ||
this.scroll_delta = 0; | ||
this.elapsed_time_since_pressed = 0; | ||
this.click_triggered = false; | ||
} | ||
@@ -112,7 +109,2 @@ | ||
get clicked() | ||
{ | ||
return this.click_triggered; | ||
} | ||
get is_touchscreen() | ||
@@ -136,3 +128,2 @@ { | ||
this.left_mouse_button_down = true; | ||
this.elapsed_time_since_pressed = new Date(); | ||
break; | ||
@@ -157,3 +148,2 @@ case 1: | ||
this.left_mouse_button_down = false; | ||
this.click_triggered = (new Date() - this.elapsed_time_since_pressed) < 200; | ||
break; | ||
@@ -264,8 +254,2 @@ case 1: | ||
this.update_previous_pointer_pos(); | ||
if (this.clicked) | ||
{ | ||
this.elapsed_time_since_pressed = 0; | ||
this.click_triggered = false; | ||
} | ||
} | ||
@@ -572,11 +556,4 @@ | ||
// this.pointers[0].distance_to(this.pointers[1]) | ||
this.elapsed_time_since_pressed = 0; | ||
this.click_triggered = false; | ||
} | ||
get clicked() | ||
{ | ||
return this.click_triggered; | ||
} | ||
get is_touchscreen() | ||
@@ -759,3 +736,2 @@ { | ||
this.left_mouse_button_down = true; | ||
this.elapsed_time_since_pressed = new Date(); | ||
} | ||
@@ -778,3 +754,2 @@ } | ||
this.left_mouse_button_down = false; | ||
this.click_triggered = (new Date() - this.elapsed_time_since_pressed) < 200; | ||
} | ||
@@ -830,7 +805,2 @@ this.remove_pointer(p.id); | ||
} | ||
if (this.clicked) | ||
{ | ||
this.elapsed_time_since_pressed = 0; | ||
this.click_triggered = false; | ||
} | ||
} | ||
@@ -1046,7 +1016,2 @@ } | ||
get clicked() | ||
{ | ||
return this.active_input_module.clicked; | ||
} | ||
get is_touchscreen() | ||
@@ -1053,0 +1018,0 @@ { |
{ | ||
"name": "pit-js", | ||
"version": "1.8.6", | ||
"version": "1.9.0", | ||
"description": "Pollable Input", | ||
@@ -5,0 +5,0 @@ "module": "examples/build/PIT.module.js", |
@@ -5,5 +5,5 @@ # Pollable InpuT | ||
PIT is a tiny javascript library (made mainly to be used with WebGL applications) that allows you to check for input in a pollable manner. | ||
PIT is a tiny javascript library (made mainly to be used with WebGL applications) that allows you to check for input in a pollable manner. | ||
It is common in websites to handle input in an event-based way, but sometimes for highly interactive applications that have an update loop running every frame it is a lot easier to check for input instead of juggling around with the events. | ||
It is common in websites to handle input in an event-based way, but sometimes for highly interactive applications that have an update loop running every frame it is a lot easier to check for input instead of juggling around with the events. | ||
@@ -38,3 +38,3 @@ Currently PIT supports the following: | ||
let input = new InputController(); | ||
let input = new InputController(); | ||
input.init(document.body); //element to listen events on | ||
@@ -70,5 +70,5 @@ | ||
```sh | ||
let input = new InputController(dom_element, subregion_dom_element) | ||
let input = new InputController(dom_element, subregion_dom_element) | ||
// dom_element will be the main element onto which the events will be hooked into. | ||
// If a subregion_dom_element is provided, then the coordinates will be reported into its | ||
// If a subregion_dom_element is provided, then the coordinates will be reported into its | ||
// relative space. This will allow you to keep moving the mouse outside the area of interest | ||
@@ -91,4 +91,2 @@ // while still receiving elements of the parent element. Notice that if the mouse goes outside | ||
input.clicked //boolean, mouse and primary touch | ||
input.pointer_pos //{x,y} screen coordinates of the mouse (or primary touch) position | ||
@@ -109,3 +107,3 @@ input.html_pointer_pos //{x,y} screen coordinates of the mouse (or primary touch) position, where the origin is in the upper left corner (browser coordinates) | ||
input.zoom_delta // float - this is equivalent to the mouse wheel (-1, 0, 1) or pinching with two fingers [-x..x] measured in pixels | ||
input.pointer_count //int - returns 1 if any mouse button is down, or return the amount of active touches | ||
input.pointer_count //int - returns 1 if any mouse button is down, or return the amount of active touches | ||
@@ -145,6 +143,6 @@ input.pointer_is_within_bounds //boolean, true if the mouse or primary touch is contained within the bounds of the subregion | ||
cd examples | ||
http-server -p 80 | ||
http-server -p 80 | ||
``` | ||
This will mount an http server on the examples folder on port 80 | ||
License | ||
@@ -151,0 +149,0 @@ ---- |
@@ -210,7 +210,2 @@ import MouseInputModule from './MouseInputModule'; | ||
get clicked() | ||
{ | ||
return this.active_input_module.clicked; | ||
} | ||
get is_touchscreen() | ||
@@ -217,0 +212,0 @@ { |
@@ -23,5 +23,2 @@ import MathUtilities from './utilities/MathUtilities'; | ||
this.scroll_delta = 0; | ||
this.elapsed_time_since_pressed = 0; | ||
this.click_triggered = false; | ||
} | ||
@@ -43,7 +40,2 @@ | ||
get clicked() | ||
{ | ||
return this.click_triggered; | ||
} | ||
get is_touchscreen() | ||
@@ -67,3 +59,2 @@ { | ||
this.left_mouse_button_down = true; | ||
this.elapsed_time_since_pressed = new Date(); | ||
break; | ||
@@ -88,3 +79,2 @@ case 1: | ||
this.left_mouse_button_down = false; | ||
this.click_triggered = (new Date() - this.elapsed_time_since_pressed) < 200; | ||
break; | ||
@@ -200,8 +190,2 @@ case 1: | ||
this.update_previous_pointer_pos(); | ||
if (this.clicked) | ||
{ | ||
this.elapsed_time_since_pressed = 0; | ||
this.click_triggered = false; | ||
} | ||
} | ||
@@ -208,0 +192,0 @@ |
@@ -32,11 +32,4 @@ import { Vector2 } from './Vector2'; | ||
// this.pointers[0].distance_to(this.pointers[1]) | ||
this.elapsed_time_since_pressed = 0; | ||
this.click_triggered = false; | ||
} | ||
get clicked() | ||
{ | ||
return this.click_triggered; | ||
} | ||
get is_touchscreen() | ||
@@ -219,3 +212,2 @@ { | ||
this.left_mouse_button_down = true; | ||
this.elapsed_time_since_pressed = new Date(); | ||
} | ||
@@ -238,3 +230,2 @@ } | ||
this.left_mouse_button_down = false; | ||
this.click_triggered = (new Date() - this.elapsed_time_since_pressed) < 200; | ||
} | ||
@@ -290,8 +281,3 @@ this.remove_pointer(p.id); | ||
} | ||
if (this.clicked) | ||
{ | ||
this.elapsed_time_since_pressed = 0; | ||
this.click_triggered = false; | ||
} | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
204520
2912
146