remote-calibrator 0.3.0-beta.0 → 0.3.0-beta.4
Sign up to get free protection for your applications and to get access to all the features.
- package/.eslintrc.js +1 -1
- package/.husky/pre-commit +1 -1
- package/.prettierignore +4 -0
- package/CHANGELOG.md +38 -1
- package/README.md +33 -13
- package/homepage/example.css +4 -0
- package/homepage/example.js +1 -0
- package/homepage/index.html +26 -0
- package/i18n/.eslintrc.js +12 -0
- package/i18n/fetch-languages-sheets.js +62 -0
- package/lib/RemoteCalibrator.min.js +1 -1
- package/lib/RemoteCalibrator.min.js.LICENSE.txt +1 -1
- package/lib/RemoteCalibrator.min.js.map +1 -1
- package/package.json +12 -8
- package/src/components/buttons.js +4 -3
- package/src/components/language.js +31 -0
- package/src/components/onCanvas.js +4 -8
- package/src/components/swalOptions.js +25 -23
- package/src/{helpers.js → components/utils.js} +8 -2
- package/src/{video.js → components/video.js} +23 -4
- package/src/const.js +23 -3
- package/src/core.js +106 -6
- package/src/css/distance.scss +12 -7
- package/src/css/main.css +65 -10
- package/src/css/panel.scss +1 -1
- package/src/css/screenSize.css +28 -14
- package/src/debug.js +2 -0
- package/src/displaySize.js +1 -1
- package/src/distance/distance.js +20 -13
- package/src/distance/distanceTrack.js +9 -8
- package/src/gaze/gaze.js +22 -20
- package/src/gaze/gazeAccuracy.js +3 -4
- package/src/gaze/gazeCalibration.js +30 -22
- package/src/gaze/gazeTracker.js +4 -2
- package/src/i18n.js +6 -0
- package/src/index.js +1 -1
- package/src/interpupillaryDistance.js +34 -18
- package/src/{panel/panel.js → panel.js} +57 -21
- package/src/screenSize.js +72 -35
- package/src/constants.js +0 -11
- package/src/text.json +0 -34
package/src/css/screenSize.css
CHANGED
@@ -1,41 +1,42 @@
|
|
1
|
-
.slider {
|
1
|
+
.rc-slider {
|
2
2
|
position: absolute;
|
3
3
|
display: block;
|
4
4
|
-webkit-appearance: none;
|
5
5
|
appearance: none;
|
6
6
|
width: calc(100% - 4rem);
|
7
|
-
height:
|
8
|
-
background: #fff;
|
9
|
-
opacity: 0.
|
7
|
+
height: 10px;
|
8
|
+
background: linear-gradient(90deg, #ffc772, #ffc772 60%, #fff 60%);
|
9
|
+
opacity: 0.8;
|
10
10
|
/* top: max(45%, 200px); */
|
11
11
|
left: 2rem;
|
12
|
-
border-radius:
|
12
|
+
border-radius: 5px;
|
13
13
|
z-index: 1;
|
14
14
|
cursor: grab;
|
15
15
|
-webkit-transition: opacity 0.3s;
|
16
16
|
transition: opacity 0.3s;
|
17
17
|
}
|
18
18
|
|
19
|
-
.slider:hover {
|
19
|
+
.rc-slider:hover {
|
20
20
|
opacity: 0.99;
|
21
21
|
}
|
22
22
|
|
23
|
-
.slider::-webkit-slider-thumb {
|
23
|
+
.rc-slider::-webkit-slider-thumb {
|
24
24
|
-webkit-appearance: none;
|
25
25
|
appearance: none;
|
26
26
|
width: 30px;
|
27
27
|
height: 30px;
|
28
28
|
border-radius: 15px;
|
29
|
-
background: #
|
29
|
+
background: #ff9a00;
|
30
|
+
box-shadow: 0 0 12px 0 #88520033;
|
30
31
|
cursor: inherit;
|
31
32
|
}
|
32
33
|
|
33
|
-
.slider::-moz-range-thumb,
|
34
|
-
.slider::-ms-thumb {
|
35
|
-
width:
|
34
|
+
.rc-slider::-moz-range-thumb,
|
35
|
+
.rc-slider::-ms-thumb {
|
36
|
+
width: 30px;
|
36
37
|
height: 30px;
|
37
38
|
border-radius: 15px;
|
38
|
-
background: #
|
39
|
+
background: #ff9a00;
|
39
40
|
cursor: inherit;
|
40
41
|
}
|
41
42
|
|
@@ -55,6 +56,7 @@
|
|
55
56
|
#size-arrow {
|
56
57
|
position: absolute;
|
57
58
|
display: block;
|
59
|
+
/* display: none; */
|
58
60
|
width: 70px;
|
59
61
|
height: auto;
|
60
62
|
z-index: 3;
|
@@ -68,8 +70,8 @@
|
|
68
70
|
transition: opacity 0.1s;
|
69
71
|
}
|
70
72
|
|
71
|
-
.slider:hover ~ .size-obj .minor,
|
72
|
-
.slider:active ~ .size-obj .minor {
|
73
|
+
.rc-slider:hover ~ .size-obj .minor,
|
74
|
+
.rc-slider:active ~ .size-obj .minor {
|
73
75
|
opacity: 0;
|
74
76
|
}
|
75
77
|
|
@@ -85,3 +87,15 @@
|
|
85
87
|
font-size: 1.1rem;
|
86
88
|
vertical-align: middle;
|
87
89
|
}
|
90
|
+
|
91
|
+
@media (min-width: 481px) {
|
92
|
+
.rc-size-obj-selection {
|
93
|
+
display: inline-flex;
|
94
|
+
}
|
95
|
+
}
|
96
|
+
|
97
|
+
@media (max-width: 480px) {
|
98
|
+
.rc-size-obj-selection {
|
99
|
+
display: inline-block;
|
100
|
+
}
|
101
|
+
}
|
package/src/debug.js
ADDED
package/src/displaySize.js
CHANGED
package/src/distance/distance.js
CHANGED
@@ -5,7 +5,7 @@ import {
|
|
5
5
|
toFixedNumber,
|
6
6
|
median,
|
7
7
|
blurAll,
|
8
|
-
} from '../
|
8
|
+
} from '../components/utils'
|
9
9
|
import {
|
10
10
|
_getCrossX,
|
11
11
|
_cross,
|
@@ -16,7 +16,7 @@ import {
|
|
16
16
|
import { bindKeys, unbindKeys } from '../components/keyBinder'
|
17
17
|
import { addButtons } from '../components/buttons'
|
18
18
|
import { soundFeedback } from '../components/sound'
|
19
|
-
import
|
19
|
+
import { phrases } from '../i18n'
|
20
20
|
|
21
21
|
const blindSpotHTML = `<canvas id="blind-spot-canvas"></canvas>`
|
22
22
|
|
@@ -40,16 +40,17 @@ export function blindSpotTest(RC, options, toTrackDistance = false, callback) {
|
|
40
40
|
RC.background.appendChild(blindSpotDiv)
|
41
41
|
RC._constructFloatInstructionElement(
|
42
42
|
'blind-spot-instruction',
|
43
|
-
|
43
|
+
phrases.RC_headTrackingCloseL[RC.L]
|
44
44
|
)
|
45
|
-
RC._addCreditOnBackground(RC.
|
45
|
+
RC._addCreditOnBackground(phrases.RC_viewingBlindSpotCredit[RC.L])
|
46
46
|
|
47
47
|
// Get HTML elements
|
48
48
|
const c = document.querySelector('#blind-spot-canvas')
|
49
49
|
const ctx = c.getContext('2d')
|
50
50
|
|
51
|
-
const eyeSideEle = document.getElementById('
|
52
|
-
let eyeSide = (eyeSideEle.innerText = 'LEFT').toLocaleLowerCase()
|
51
|
+
const eyeSideEle = document.getElementById('blind-spot-instruction')
|
52
|
+
// let eyeSide = (eyeSideEle.innerText = 'LEFT').toLocaleLowerCase()
|
53
|
+
let eyeSide = 'left'
|
53
54
|
RC._setFloatInstructionElementPos(eyeSide, 16)
|
54
55
|
let crossX = _getCrossX(eyeSide, c.width)
|
55
56
|
|
@@ -115,9 +116,14 @@ export function blindSpotTest(RC, options, toTrackDistance = false, callback) {
|
|
115
116
|
}
|
116
117
|
} else if (tested % options.repeatTesting === 0) {
|
117
118
|
// Switch eye side
|
118
|
-
if (eyeSide === 'left')
|
119
|
-
|
120
|
-
|
119
|
+
if (eyeSide === 'left') {
|
120
|
+
// Change to RIGHT
|
121
|
+
eyeSide = 'right'
|
122
|
+
eyeSideEle.innerHTML = phrases.RC_headTrackingCloseR[RC.L]
|
123
|
+
} else {
|
124
|
+
eyeSide = 'left'
|
125
|
+
eyeSideEle.innerHTML = phrases.RC_headTrackingCloseL[RC.L]
|
126
|
+
}
|
121
127
|
RC._setFloatInstructionElementPos(eyeSide, 16)
|
122
128
|
|
123
129
|
circleBounds = _getCircleBounds(eyeSide, crossX, c.width)
|
@@ -134,6 +140,7 @@ export function blindSpotTest(RC, options, toTrackDistance = false, callback) {
|
|
134
140
|
' ': finishFunction,
|
135
141
|
})
|
136
142
|
addButtons(
|
143
|
+
RC.L,
|
137
144
|
RC.background,
|
138
145
|
{
|
139
146
|
go: finishFunction,
|
@@ -152,7 +159,7 @@ export function blindSpotTest(RC, options, toTrackDistance = false, callback) {
|
|
152
159
|
|
153
160
|
_cross(ctx, crossX, c.height / 2)
|
154
161
|
|
155
|
-
_circle(ctx, circleX, c.height / 2, frameCount, options.sparkle)
|
162
|
+
_circle(RC, ctx, circleX, c.height / 2, frameCount, options.sparkle)
|
156
163
|
circleX += v * circleDeltaX
|
157
164
|
tempX = constrain(circleX, ...circleBounds)
|
158
165
|
if (circleX !== tempX) {
|
@@ -197,8 +204,8 @@ RemoteCalibrator.prototype.measureDistance = function (options = {}, callback) {
|
|
197
204
|
repeatTesting: 2,
|
198
205
|
sparkle: true,
|
199
206
|
decimalPlace: 1,
|
200
|
-
headline:
|
201
|
-
description:
|
207
|
+
headline: '📏 ' + phrases.RC_viewingDistanceTitle[this.L],
|
208
|
+
description: phrases.RC_viewingDistanceIntro[this.L],
|
202
209
|
},
|
203
210
|
options
|
204
211
|
)
|
@@ -208,7 +215,7 @@ RemoteCalibrator.prototype.measureDistance = function (options = {}, callback) {
|
|
208
215
|
this._addBackground()
|
209
216
|
|
210
217
|
this._replaceBackground(
|
211
|
-
constructInstructions(options.headline, options.description)
|
218
|
+
constructInstructions(options.headline, options.description, true)
|
212
219
|
)
|
213
220
|
blindSpotTest(this, options, false, callback)
|
214
221
|
}
|
@@ -6,9 +6,9 @@ import {
|
|
6
6
|
constructInstructions,
|
7
7
|
blurAll,
|
8
8
|
sleep,
|
9
|
-
} from '../
|
9
|
+
} from '../components/utils'
|
10
10
|
import { iRepeat } from '../components/iRepeat'
|
11
|
-
import
|
11
|
+
import { phrases } from '../i18n'
|
12
12
|
|
13
13
|
const originalStyles = {
|
14
14
|
video: false,
|
@@ -42,15 +42,16 @@ RemoteCalibrator.prototype.trackDistance = function (
|
|
42
42
|
fullscreen: false,
|
43
43
|
repeatTesting: 2,
|
44
44
|
sparkle: true,
|
45
|
-
pipWidthPx:
|
45
|
+
pipWidthPx:
|
46
|
+
this._CONST.N.VIDEO_W[this.isMobile.value ? 'MOBILE' : 'DESKTOP'],
|
46
47
|
showVideo: true,
|
47
48
|
showFaceOverlay: false,
|
48
49
|
decimalPlace: 1,
|
49
50
|
framerate: 3, // track rate
|
50
51
|
nearPoint: true, // New 0.0.6
|
51
52
|
showNearPoint: false, // New 0.0.6
|
52
|
-
headline:
|
53
|
-
description:
|
53
|
+
headline: '🙂 ' + phrases.RC_headTrackingTitle[this.L],
|
54
|
+
description: phrases.RC_headTrackingIntro[this.L],
|
54
55
|
},
|
55
56
|
options
|
56
57
|
)
|
@@ -73,7 +74,7 @@ RemoteCalibrator.prototype.trackDistance = function (
|
|
73
74
|
this._addBackground()
|
74
75
|
this._constructFloatInstructionElement(
|
75
76
|
'gaze-system-instruction',
|
76
|
-
|
77
|
+
phrases.RC_starting[this.L]
|
77
78
|
)
|
78
79
|
|
79
80
|
// STEP 2 - Live estimate
|
@@ -161,7 +162,7 @@ const cyclopean = (video, a, b) => {
|
|
161
162
|
|
162
163
|
/* -------------------------------------------------------------------------- */
|
163
164
|
const trackingOptions = {
|
164
|
-
pipWidthPx:
|
165
|
+
pipWidthPx: 0,
|
165
166
|
decimalPlace: 2,
|
166
167
|
framerate: 3,
|
167
168
|
nearPoint: true,
|
@@ -372,7 +373,7 @@ RemoteCalibrator.prototype.endDistance = function (endAll = false, _r = true) {
|
|
372
373
|
iRepeatOptions.break = true
|
373
374
|
iRepeatOptions.framerate = 20
|
374
375
|
|
375
|
-
trackingOptions.pipWidthPx =
|
376
|
+
trackingOptions.pipWidthPx = 0
|
376
377
|
trackingOptions.decimalPlace = 2
|
377
378
|
trackingOptions.framerate = 3
|
378
379
|
trackingOptions.nearPoint = true
|
package/src/gaze/gaze.js
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
import RemoteCalibrator from '../core'
|
2
2
|
|
3
|
-
import { blurAll } from '../
|
3
|
+
import { blurAll } from '../components/utils'
|
4
4
|
import { gazeCalibrationPrepare } from './gazeCalibration'
|
5
|
-
import
|
5
|
+
import { phrases } from '../i18n'
|
6
6
|
|
7
7
|
RemoteCalibrator.prototype.trackGaze = function (
|
8
8
|
options = {},
|
9
|
-
|
9
|
+
callbackOnCalibrationEnd = null,
|
10
|
+
callbackTrack = null
|
10
11
|
) {
|
11
12
|
/**
|
12
13
|
* options -
|
@@ -37,13 +38,14 @@ RemoteCalibrator.prototype.trackGaze = function (
|
|
37
38
|
framerate: 30, // ! New 0.0.5
|
38
39
|
showGazer: true,
|
39
40
|
showVideo: true,
|
40
|
-
pipWidthPx:
|
41
|
+
pipWidthPx:
|
42
|
+
this._CONST.N.VIDEO_W[this.isMobile.value ? 'MOBILE' : 'DESKTOP'],
|
41
43
|
showFaceOverlay: false,
|
42
44
|
calibrationCount: 5,
|
43
45
|
thresholdDeg: 10, // minAccuracy
|
44
46
|
decimalPlace: 0, // As the system itself has a high prediction error, it's not necessary to be too precise here
|
45
|
-
headline:
|
46
|
-
description:
|
47
|
+
headline: '👀 ' + phrases.RC_gazeTrackingTitle[this.L],
|
48
|
+
description: phrases.RC_gazeTrackingIntro[this.L],
|
47
49
|
},
|
48
50
|
options
|
49
51
|
)
|
@@ -60,8 +62,8 @@ RemoteCalibrator.prototype.trackGaze = function (
|
|
60
62
|
this.showVideo(options.showVideo)
|
61
63
|
this.showFaceOverlay(options.showFaceOverlay)
|
62
64
|
|
63
|
-
this.gazeTracker.attachNewCallback(
|
64
|
-
this.gazeTracker.defaultGazeCallback =
|
65
|
+
this.gazeTracker.attachNewCallback(callbackTrack)
|
66
|
+
this.gazeTracker.defaultGazeCallback = callbackTrack
|
65
67
|
return
|
66
68
|
}
|
67
69
|
|
@@ -101,6 +103,12 @@ RemoteCalibrator.prototype.trackGaze = function (
|
|
101
103
|
// Calibration
|
102
104
|
|
103
105
|
const onCalibrationEnded = () => {
|
106
|
+
if (
|
107
|
+
callbackOnCalibrationEnd &&
|
108
|
+
typeof callbackOnCalibrationEnd === 'function'
|
109
|
+
)
|
110
|
+
callbackOnCalibrationEnd()
|
111
|
+
|
104
112
|
// ! greedyLearner
|
105
113
|
if (!this.gazeTracker.webgazer.params.greedyLearner) {
|
106
114
|
this.gazeTracker.stopLearning()
|
@@ -109,8 +117,8 @@ RemoteCalibrator.prototype.trackGaze = function (
|
|
109
117
|
// TODO Test accuracy
|
110
118
|
const testAccuracy = false
|
111
119
|
if (options.thresholdDeg === 'none' || !testAccuracy) {
|
112
|
-
this.gazeTracker.attachNewCallback(
|
113
|
-
this.gazeTracker.defaultGazeCallback =
|
120
|
+
this.gazeTracker.attachNewCallback(callbackTrack)
|
121
|
+
this.gazeTracker.defaultGazeCallback = callbackTrack
|
114
122
|
return
|
115
123
|
} else {
|
116
124
|
if (
|
@@ -121,8 +129,8 @@ RemoteCalibrator.prototype.trackGaze = function (
|
|
121
129
|
() => {
|
122
130
|
// Success
|
123
131
|
// Start running
|
124
|
-
this.gazeTracker.attachNewCallback(
|
125
|
-
this.gazeTracker.defaultGazeCallback =
|
132
|
+
this.gazeTracker.attachNewCallback(callbackTrack)
|
133
|
+
this.gazeTracker.defaultGazeCallback = callbackTrack
|
126
134
|
},
|
127
135
|
() => {
|
128
136
|
// Fail to meet the min accuracy
|
@@ -133,17 +141,11 @@ RemoteCalibrator.prototype.trackGaze = function (
|
|
133
141
|
console.error(
|
134
142
|
'Failed to finish gaze accuracy measurement due to error.'
|
135
143
|
)
|
136
|
-
this.gazeTracker.attachNewCallback(
|
137
|
-
this.gazeTracker.defaultGazeCallback =
|
144
|
+
this.gazeTracker.attachNewCallback(callbackTrack)
|
145
|
+
this.gazeTracker.defaultGazeCallback = callbackTrack
|
138
146
|
}
|
139
147
|
}
|
140
148
|
}
|
141
|
-
// Swal.fire({
|
142
|
-
// ...swalInfoOptions,
|
143
|
-
// html: options.description,
|
144
|
-
// }).then(() => {
|
145
|
-
|
146
|
-
// })
|
147
149
|
}
|
148
150
|
|
149
151
|
RemoteCalibrator.prototype.getGazeNow = async function (callback = null) {
|
package/src/gaze/gazeAccuracy.js
CHANGED
@@ -3,8 +3,7 @@ import Swal from 'sweetalert2/dist/sweetalert2.js'
|
|
3
3
|
import RemoteCalibrator from '../core'
|
4
4
|
|
5
5
|
import { _cross } from '../components/onCanvas'
|
6
|
-
import { blurAll, sleep, toFixedNumber } from '../
|
7
|
-
import text from '../text.json'
|
6
|
+
import { blurAll, sleep, toFixedNumber } from '../components/utils'
|
8
7
|
import { swalInfoOptions } from '../components/swalOptions'
|
9
8
|
|
10
9
|
let inGetAccuracy = false
|
@@ -58,9 +57,9 @@ RemoteCalibrator.prototype.getGazeAccuracy = function (
|
|
58
57
|
_resizeCanvas()
|
59
58
|
|
60
59
|
Swal.fire({
|
61
|
-
...swalInfoOptions,
|
60
|
+
...swalInfoOptions(this),
|
62
61
|
// title: text.getGazeAccuracy.headline,
|
63
|
-
html:
|
62
|
+
html: `We will measure your gaze accuracy. Please do not move the mouse and look at the fixation at the middle of the screen for the next 5 seconds.`,
|
64
63
|
}).then(() => {
|
65
64
|
// ! After confirming alert
|
66
65
|
inGetAccuracy = true
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import RemoteCalibrator from '../core'
|
2
2
|
|
3
|
-
import { constructInstructions, shuffle, blurAll } from '../
|
4
|
-
import {
|
3
|
+
import { constructInstructions, shuffle, blurAll } from '../components/utils'
|
4
|
+
import { debug } from '../debug'
|
5
5
|
import { bindKeys, unbindKeys } from '../components/keyBinder'
|
6
|
-
import
|
6
|
+
import { phrases } from '../i18n'
|
7
7
|
|
8
8
|
// [Wait!], etc.
|
9
9
|
// const instPOutsideWarning = 'Keep your face centered in the video feed.'
|
@@ -24,7 +24,7 @@ export function gazeCalibrationPrepare(RC, options) {
|
|
24
24
|
)
|
25
25
|
RC._constructFloatInstructionElement(
|
26
26
|
'gaze-system-instruction',
|
27
|
-
|
27
|
+
phrases.RC_starting[RC.L]
|
28
28
|
)
|
29
29
|
}
|
30
30
|
|
@@ -41,8 +41,8 @@ RemoteCalibrator.prototype.calibrateGaze = function (options = {}, callback) {
|
|
41
41
|
{
|
42
42
|
greedyLearner: false,
|
43
43
|
calibrationCount: 5,
|
44
|
-
headline:
|
45
|
-
description:
|
44
|
+
headline: '👀 ' + phrases.RC_gazeTrackingTitle[this.L],
|
45
|
+
description: phrases.RC_gazeTrackingIntro[this.L],
|
46
46
|
},
|
47
47
|
options
|
48
48
|
)
|
@@ -97,7 +97,7 @@ class GazeCalibrationDot {
|
|
97
97
|
this.clicks = 0
|
98
98
|
|
99
99
|
this.position = this.order.shift()
|
100
|
-
this.r =
|
100
|
+
this.r = this.RC._CONST.N.GAZE_CALIBRATION.R
|
101
101
|
|
102
102
|
// HTML div
|
103
103
|
this.div = document.createElement('div')
|
@@ -116,12 +116,14 @@ class GazeCalibrationDot {
|
|
116
116
|
height: this.r + 'px',
|
117
117
|
borderRadius: this.r / 2 + 'px',
|
118
118
|
})
|
119
|
+
|
120
|
+
const _b = this.RC._CONST.N.GAZE_CALIBRATION.BORDER
|
119
121
|
Object.assign(this.clickDiv.style, {
|
120
|
-
width: this.r -
|
121
|
-
height: this.r -
|
122
|
-
borderRadius: (this.r -
|
123
|
-
top: `${
|
124
|
-
left: `${
|
122
|
+
width: this.r - _b + 'px',
|
123
|
+
height: this.r - _b + 'px',
|
124
|
+
borderRadius: (this.r - _b) / 2 + 'px',
|
125
|
+
top: `${_b / 2}px`,
|
126
|
+
left: `${_b / 2}px`,
|
125
127
|
})
|
126
128
|
|
127
129
|
this.parent = parent
|
@@ -137,33 +139,39 @@ class GazeCalibrationDot {
|
|
137
139
|
Object.assign(
|
138
140
|
this.div.style,
|
139
141
|
[
|
140
|
-
{ left: gazeCalibrationDotDefault.margin + 'px', right: 'unset' }, // 0
|
141
142
|
{
|
142
|
-
left:
|
143
|
+
left: this.RC._CONST.N.GAZE_CALIBRATION.MARGIN + 'px',
|
144
|
+
right: 'unset',
|
145
|
+
}, // 0
|
146
|
+
{
|
147
|
+
left: `calc(50% - ${this.RC._CONST.N.GAZE_CALIBRATION.R / 2}px)`,
|
143
148
|
right: 'unset',
|
144
149
|
}, // 1
|
145
|
-
// { right:
|
150
|
+
// { right: this.RC._CONST.N.GAZE_CALIBRATION.MARGIN + 'px', left: 'unset' }, // 2
|
146
151
|
{
|
147
152
|
left:
|
148
153
|
window.innerWidth -
|
149
|
-
|
150
|
-
|
154
|
+
this.RC._CONST.N.GAZE_CALIBRATION.R -
|
155
|
+
this.RC._CONST.N.GAZE_CALIBRATION.MARGIN +
|
151
156
|
'px',
|
152
157
|
right: 'unset',
|
153
158
|
}, // 2
|
154
159
|
][this.position[0]],
|
155
160
|
[
|
156
|
-
{ top: gazeCalibrationDotDefault.margin + 'px', bottom: 'unset' }, // 0
|
157
161
|
{
|
158
|
-
top:
|
162
|
+
top: this.RC._CONST.N.GAZE_CALIBRATION.MARGIN + 'px',
|
163
|
+
bottom: 'unset',
|
164
|
+
}, // 0
|
165
|
+
{
|
166
|
+
top: `calc(50% - ${this.RC._CONST.N.GAZE_CALIBRATION.R / 2}px)`,
|
159
167
|
bottom: 'unset',
|
160
168
|
}, // 1
|
161
|
-
// { bottom:
|
169
|
+
// { bottom: this.RC._CONST.N.GAZE_CALIBRATION.MARGIN + 'px', top: 'unset' }, // 2
|
162
170
|
{
|
163
171
|
top:
|
164
172
|
window.innerHeight -
|
165
|
-
|
166
|
-
|
173
|
+
this.RC._CONST.N.GAZE_CALIBRATION.R -
|
174
|
+
this.RC._CONST.N.GAZE_CALIBRATION.MARGIN +
|
167
175
|
'px',
|
168
176
|
bottom: 'unset',
|
169
177
|
}, // 2
|
package/src/gaze/gazeTracker.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import webgazer from '../WebGazer4RC/src/index.mjs'
|
2
2
|
|
3
|
-
import { toFixedNumber } from '../
|
4
|
-
import { checkWebgazerReady } from '../video'
|
3
|
+
import { toFixedNumber } from '../components/utils'
|
4
|
+
import { checkWebgazerReady } from '../components/video'
|
5
5
|
|
6
6
|
/**
|
7
7
|
* The gaze tracker object to wrap all gaze-related functions
|
@@ -38,6 +38,7 @@ export default class GazeTracker {
|
|
38
38
|
}
|
39
39
|
|
40
40
|
checkWebgazerReady(
|
41
|
+
this.calibrator,
|
41
42
|
pipWidthPx,
|
42
43
|
this.calibrator.params.videoOpacity,
|
43
44
|
this.webgazer,
|
@@ -55,6 +56,7 @@ export default class GazeTracker {
|
|
55
56
|
}
|
56
57
|
|
57
58
|
checkWebgazerReady(
|
59
|
+
this.calibrator,
|
58
60
|
pipWidthPx,
|
59
61
|
this.calibrator.params.videoOpacity,
|
60
62
|
this.webgazer,
|