tracky-mouse 2.1.0 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/stats.js CHANGED
@@ -1,179 +1,179 @@
1
- (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
3
- typeof define === 'function' && define.amd ? define(factory) :
4
- (global.Stats = factory());
5
- }(this, (function () { 'use strict';
6
-
7
- /**
8
- * @author mrdoob / http://mrdoob.com/
9
- */
10
-
11
- var Stats = function () {
12
-
13
- var mode = 0;
14
-
15
- var container = document.createElement( 'div' );
16
- container.style.cssText = 'position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000';
17
- container.addEventListener( 'click', function ( event ) {
18
-
19
- event.preventDefault();
20
- showPanel( ++ mode % container.children.length );
21
-
22
- }, false );
23
-
24
- //
25
-
26
- function addPanel( panel ) {
27
-
28
- container.appendChild( panel.dom );
29
- return panel;
30
-
31
- }
32
-
33
- function showPanel( id ) {
34
-
35
- for ( var i = 0; i < container.children.length; i ++ ) {
36
-
37
- container.children[ i ].style.display = i === id ? 'block' : 'none';
38
-
39
- }
40
-
41
- mode = id;
42
-
43
- }
44
-
45
- //
46
-
47
- var beginTime = ( performance || Date ).now(), prevTime = beginTime, frames = 0;
48
-
49
- var fpsPanel = addPanel( new Stats.Panel( 'FPS', '#0ff', '#002' ) );
50
- var msPanel = addPanel( new Stats.Panel( 'MS', '#0f0', '#020' ) );
51
-
52
- if ( self.performance && self.performance.memory ) {
53
-
54
- var memPanel = addPanel( new Stats.Panel( 'MB', '#f08', '#201' ) );
55
-
56
- }
57
-
58
- showPanel( 0 );
59
-
60
- return {
61
-
62
- REVISION: 16,
63
-
64
- dom: container,
65
-
66
- addPanel: addPanel,
67
- showPanel: showPanel,
68
-
69
- begin: function () {
70
-
71
- beginTime = ( performance || Date ).now();
72
-
73
- },
74
-
75
- end: function () {
76
-
77
- frames ++;
78
-
79
- var time = ( performance || Date ).now();
80
-
81
- msPanel.update( time - beginTime, 200 );
82
-
83
- if ( time >= prevTime + 1000 ) {
84
-
85
- fpsPanel.update( ( frames * 1000 ) / ( time - prevTime ), 100 );
86
-
87
- prevTime = time;
88
- frames = 0;
89
-
90
- if ( memPanel ) {
91
-
92
- var memory = performance.memory;
93
- memPanel.update( memory.usedJSHeapSize / 1048576, memory.jsHeapSizeLimit / 1048576 );
94
-
95
- }
96
-
97
- }
98
-
99
- return time;
100
-
101
- },
102
-
103
- update: function () {
104
-
105
- beginTime = this.end();
106
-
107
- },
108
-
109
- // Backwards Compatibility
110
-
111
- domElement: container,
112
- setMode: showPanel
113
-
114
- };
115
-
116
- };
117
-
118
- Stats.Panel = function ( name, fg, bg ) {
119
-
120
- var min = Infinity, max = 0, round = Math.round;
121
- var PR = round( window.devicePixelRatio || 1 );
122
-
123
- var WIDTH = 80 * PR, HEIGHT = 48 * PR,
124
- TEXT_X = 3 * PR, TEXT_Y = 2 * PR,
125
- GRAPH_X = 3 * PR, GRAPH_Y = 15 * PR,
126
- GRAPH_WIDTH = 74 * PR, GRAPH_HEIGHT = 30 * PR;
127
-
128
- var canvas = document.createElement( 'canvas' );
129
- canvas.width = WIDTH;
130
- canvas.height = HEIGHT;
131
- canvas.style.cssText = 'width:80px;height:48px';
132
-
133
- var context = canvas.getContext( '2d' );
134
- context.font = 'bold ' + ( 9 * PR ) + 'px Helvetica,Arial,sans-serif';
135
- context.textBaseline = 'top';
136
-
137
- context.fillStyle = bg;
138
- context.fillRect( 0, 0, WIDTH, HEIGHT );
139
-
140
- context.fillStyle = fg;
141
- context.fillText( name, TEXT_X, TEXT_Y );
142
- context.fillRect( GRAPH_X, GRAPH_Y, GRAPH_WIDTH, GRAPH_HEIGHT );
143
-
144
- context.fillStyle = bg;
145
- context.globalAlpha = 0.9;
146
- context.fillRect( GRAPH_X, GRAPH_Y, GRAPH_WIDTH, GRAPH_HEIGHT );
147
-
148
- return {
149
-
150
- dom: canvas,
151
-
152
- update: function ( value, maxValue ) {
153
-
154
- min = Math.min( min, value );
155
- max = Math.max( max, value );
156
-
157
- context.fillStyle = bg;
158
- context.globalAlpha = 1;
159
- context.fillRect( 0, 0, WIDTH, GRAPH_Y );
160
- context.fillStyle = fg;
161
- context.fillText( round( value ) + ' ' + name + ' (' + round( min ) + '-' + round( max ) + ')', TEXT_X, TEXT_Y );
162
-
163
- context.drawImage( canvas, GRAPH_X + PR, GRAPH_Y, GRAPH_WIDTH - PR, GRAPH_HEIGHT, GRAPH_X, GRAPH_Y, GRAPH_WIDTH - PR, GRAPH_HEIGHT );
164
-
165
- context.fillRect( GRAPH_X + GRAPH_WIDTH - PR, GRAPH_Y, PR, GRAPH_HEIGHT );
166
-
167
- context.fillStyle = bg;
168
- context.globalAlpha = 0.9;
169
- context.fillRect( GRAPH_X + GRAPH_WIDTH - PR, GRAPH_Y, PR, round( ( 1 - ( value / maxValue ) ) * GRAPH_HEIGHT ) );
170
-
171
- }
172
-
173
- };
174
-
175
- };
176
-
177
- return Stats;
178
-
179
- })));
1
+ (function (global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
3
+ typeof define === 'function' && define.amd ? define(factory) :
4
+ (global.Stats = factory());
5
+ }(this, (function () { 'use strict';
6
+
7
+ /**
8
+ * @author mrdoob / http://mrdoob.com/
9
+ */
10
+
11
+ var Stats = function () {
12
+
13
+ var mode = 0;
14
+
15
+ var container = document.createElement( 'div' );
16
+ container.style.cssText = 'position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000';
17
+ container.addEventListener( 'click', function ( event ) {
18
+
19
+ event.preventDefault();
20
+ showPanel( ++ mode % container.children.length );
21
+
22
+ }, false );
23
+
24
+ //
25
+
26
+ function addPanel( panel ) {
27
+
28
+ container.appendChild( panel.dom );
29
+ return panel;
30
+
31
+ }
32
+
33
+ function showPanel( id ) {
34
+
35
+ for ( var i = 0; i < container.children.length; i ++ ) {
36
+
37
+ container.children[ i ].style.display = i === id ? 'block' : 'none';
38
+
39
+ }
40
+
41
+ mode = id;
42
+
43
+ }
44
+
45
+ //
46
+
47
+ var beginTime = ( performance || Date ).now(), prevTime = beginTime, frames = 0;
48
+
49
+ var fpsPanel = addPanel( new Stats.Panel( 'FPS', '#0ff', '#002' ) );
50
+ var msPanel = addPanel( new Stats.Panel( 'MS', '#0f0', '#020' ) );
51
+
52
+ if ( self.performance && self.performance.memory ) {
53
+
54
+ var memPanel = addPanel( new Stats.Panel( 'MB', '#f08', '#201' ) );
55
+
56
+ }
57
+
58
+ showPanel( 0 );
59
+
60
+ return {
61
+
62
+ REVISION: 16,
63
+
64
+ dom: container,
65
+
66
+ addPanel: addPanel,
67
+ showPanel: showPanel,
68
+
69
+ begin: function () {
70
+
71
+ beginTime = ( performance || Date ).now();
72
+
73
+ },
74
+
75
+ end: function () {
76
+
77
+ frames ++;
78
+
79
+ var time = ( performance || Date ).now();
80
+
81
+ msPanel.update( time - beginTime, 200 );
82
+
83
+ if ( time >= prevTime + 1000 ) {
84
+
85
+ fpsPanel.update( ( frames * 1000 ) / ( time - prevTime ), 100 );
86
+
87
+ prevTime = time;
88
+ frames = 0;
89
+
90
+ if ( memPanel ) {
91
+
92
+ var memory = performance.memory;
93
+ memPanel.update( memory.usedJSHeapSize / 1048576, memory.jsHeapSizeLimit / 1048576 );
94
+
95
+ }
96
+
97
+ }
98
+
99
+ return time;
100
+
101
+ },
102
+
103
+ update: function () {
104
+
105
+ beginTime = this.end();
106
+
107
+ },
108
+
109
+ // Backwards Compatibility
110
+
111
+ domElement: container,
112
+ setMode: showPanel
113
+
114
+ };
115
+
116
+ };
117
+
118
+ Stats.Panel = function ( name, fg, bg ) {
119
+
120
+ var min = Infinity, max = 0, round = Math.round;
121
+ var PR = round( window.devicePixelRatio || 1 );
122
+
123
+ var WIDTH = 80 * PR, HEIGHT = 48 * PR,
124
+ TEXT_X = 3 * PR, TEXT_Y = 2 * PR,
125
+ GRAPH_X = 3 * PR, GRAPH_Y = 15 * PR,
126
+ GRAPH_WIDTH = 74 * PR, GRAPH_HEIGHT = 30 * PR;
127
+
128
+ var canvas = document.createElement( 'canvas' );
129
+ canvas.width = WIDTH;
130
+ canvas.height = HEIGHT;
131
+ canvas.style.cssText = 'width:80px;height:48px';
132
+
133
+ var context = canvas.getContext( '2d' );
134
+ context.font = 'bold ' + ( 9 * PR ) + 'px Helvetica,Arial,sans-serif';
135
+ context.textBaseline = 'top';
136
+
137
+ context.fillStyle = bg;
138
+ context.fillRect( 0, 0, WIDTH, HEIGHT );
139
+
140
+ context.fillStyle = fg;
141
+ context.fillText( name, TEXT_X, TEXT_Y );
142
+ context.fillRect( GRAPH_X, GRAPH_Y, GRAPH_WIDTH, GRAPH_HEIGHT );
143
+
144
+ context.fillStyle = bg;
145
+ context.globalAlpha = 0.9;
146
+ context.fillRect( GRAPH_X, GRAPH_Y, GRAPH_WIDTH, GRAPH_HEIGHT );
147
+
148
+ return {
149
+
150
+ dom: canvas,
151
+
152
+ update: function ( value, maxValue ) {
153
+
154
+ min = Math.min( min, value );
155
+ max = Math.max( max, value );
156
+
157
+ context.fillStyle = bg;
158
+ context.globalAlpha = 1;
159
+ context.fillRect( 0, 0, WIDTH, GRAPH_Y );
160
+ context.fillStyle = fg;
161
+ context.fillText( round( value ) + ' ' + name + ' (' + round( min ) + '-' + round( max ) + ')', TEXT_X, TEXT_Y );
162
+
163
+ context.drawImage( canvas, GRAPH_X + PR, GRAPH_Y, GRAPH_WIDTH - PR, GRAPH_HEIGHT, GRAPH_X, GRAPH_Y, GRAPH_WIDTH - PR, GRAPH_HEIGHT );
164
+
165
+ context.fillRect( GRAPH_X + GRAPH_WIDTH - PR, GRAPH_Y, PR, GRAPH_HEIGHT );
166
+
167
+ context.fillStyle = bg;
168
+ context.globalAlpha = 0.9;
169
+ context.fillRect( GRAPH_X + GRAPH_WIDTH - PR, GRAPH_Y, PR, round( ( 1 - ( value / maxValue ) ) * GRAPH_HEIGHT ) );
170
+
171
+ }
172
+
173
+ };
174
+
175
+ };
176
+
177
+ return Stats;
178
+
179
+ })));
package/package.json CHANGED
@@ -1,57 +1,61 @@
1
- {
2
- "name": "tracky-mouse",
3
- "version": "2.1.0",
4
- "description": "Add facial mouse accessibility to JavaScript applications",
5
- "license": "MIT",
6
- "author": {
7
- "name": "Isaiah Odhner",
8
- "email": "isaiahodhner@gmail.com",
9
- "url": "https://isaiahodhner.io"
10
- },
11
- "keywords": [
12
- "camera-mouse",
13
- "mouse",
14
- "camera",
15
- "webcam",
16
- "head-tracker",
17
- "head-tracking",
18
- "face-tracker",
19
- "face-tracking",
20
- "headmouse",
21
- "facial-mouse",
22
- "facemesh",
23
- "eye-tracker",
24
- "eye-tracking",
25
- "eye-gaze",
26
- "accessibility",
27
- "cursor",
28
- "pointer",
29
- "pointing",
30
- "input-method",
31
- "hands-free",
32
- "handsfree",
33
- "desktop-automation"
34
- ],
35
- "repository": {
36
- "type": "git",
37
- "url": "git+https://github.com/1j01/tracky-mouse.git"
38
- },
39
- "bugs": {
40
- "url": "https://github.com/1j01/tracky-mouse/issues"
41
- },
42
- "homepage": "https://trackymouse.js.org/",
43
- "main": "tracky-mouse.js",
44
- "browser": "tracky-mouse.js",
45
- "files": [
46
- "tracky-mouse.js",
47
- "tracky-mouse.css",
48
- "lib/"
49
- ],
50
- "devDependencies": {
51
- "@mediapipe/face_mesh": "^0.4.1633559619",
52
- "@tensorflow-models/face-landmarks-detection": "^1.0.6"
53
- },
54
- "scripts": {
55
- "copy-deps": "node copy-deps.js"
56
- }
57
- }
1
+ {
2
+ "name": "tracky-mouse",
3
+ "version": "2.3.0",
4
+ "description": "Add facial mouse accessibility to JavaScript applications",
5
+ "license": "MIT",
6
+ "author": {
7
+ "name": "Isaiah Odhner",
8
+ "email": "isaiahodhner@gmail.com",
9
+ "url": "https://isaiahodhner.io"
10
+ },
11
+ "keywords": [
12
+ "camera-mouse",
13
+ "mouse",
14
+ "camera",
15
+ "webcam",
16
+ "head-tracker",
17
+ "head-tracking",
18
+ "facial-recognition",
19
+ "face-tracker",
20
+ "face-tracking",
21
+ "headmouse",
22
+ "facial-mouse",
23
+ "facemesh",
24
+ "eye-tracker",
25
+ "eye-tracking",
26
+ "eye-gaze",
27
+ "accessibility",
28
+ "assistive-technology",
29
+ "cursor",
30
+ "pointer",
31
+ "pointing",
32
+ "input-method",
33
+ "hands-free",
34
+ "handsfree",
35
+ "desktop-automation",
36
+ "telekinesis"
37
+ ],
38
+ "repository": {
39
+ "type": "git",
40
+ "url": "git+https://github.com/1j01/tracky-mouse.git"
41
+ },
42
+ "bugs": {
43
+ "url": "https://github.com/1j01/tracky-mouse/issues"
44
+ },
45
+ "homepage": "https://trackymouse.js.org/",
46
+ "main": "tracky-mouse.js",
47
+ "browser": "tracky-mouse.js",
48
+ "files": [
49
+ "tracky-mouse.js",
50
+ "tracky-mouse.css",
51
+ "lib/"
52
+ ],
53
+ "devDependencies": {
54
+ "@david18284/one-euro-filter": "^1.0.3",
55
+ "@mediapipe/face_mesh": "^0.4.1633559619",
56
+ "@tensorflow-models/face-landmarks-detection": "^1.0.6"
57
+ },
58
+ "scripts": {
59
+ "copy-deps": "node copy-deps.js"
60
+ }
61
+ }