remote-calibrator 0.3.0-rc.3 → 0.5.0-beta.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. package/CHANGELOG.md +35 -3
  2. package/README.md +34 -49
  3. package/homepage/example.css +4 -3
  4. package/homepage/example.js +42 -22
  5. package/homepage/index.html +19 -4
  6. package/i18n/fetch-languages-sheets.js +11 -1
  7. package/lib/RemoteCalibrator.min.js +1 -1
  8. package/lib/RemoteCalibrator.min.js.LICENSE.txt +19 -2
  9. package/lib/RemoteCalibrator.min.js.map +1 -1
  10. package/netlify.toml +1 -1
  11. package/package.json +25 -24
  12. package/src/WebGazer4RC/package-lock.json +198 -143
  13. package/src/WebGazer4RC/package.json +2 -2
  14. package/src/WebGazer4RC/src/index.mjs +161 -52
  15. package/src/WebGazer4RC/test/webgazer_test.js +1 -1
  16. package/src/check/checkScreenSize.js +84 -0
  17. package/src/components/buttons.js +21 -4
  18. package/src/components/input.js +82 -0
  19. package/src/components/keyBinder.js +5 -6
  20. package/src/components/language.js +5 -0
  21. package/src/components/mediaPermission.js +21 -0
  22. package/src/components/onCanvas.js +2 -2
  23. package/src/components/sound.js +30 -2
  24. package/src/components/swalOptions.js +6 -3
  25. package/src/components/utils.js +27 -1
  26. package/src/components/video.js +9 -6
  27. package/src/const.js +15 -0
  28. package/src/core.js +103 -48
  29. package/src/css/buttons.scss +34 -7
  30. package/src/css/components.scss +57 -0
  31. package/src/css/distance.scss +71 -1
  32. package/src/css/gaze.css +9 -5
  33. package/src/css/main.css +22 -6
  34. package/src/css/panel.scss +33 -3
  35. package/src/css/screenSize.css +6 -5
  36. package/src/css/swal.css +1 -1
  37. package/src/css/video.scss +19 -0
  38. package/src/distance/distance.js +194 -41
  39. package/src/distance/distanceCheck.js +241 -0
  40. package/src/distance/distanceTrack.js +165 -68
  41. package/src/{interpupillaryDistance.js → distance/interPupillaryDistance.js} +27 -19
  42. package/src/gaze/gaze.js +4 -7
  43. package/src/gaze/gazeAccuracy.js +9 -4
  44. package/src/gaze/gazeCalibration.js +14 -4
  45. package/src/gaze/gazeTracker.js +40 -9
  46. package/src/i18n.js +1 -1
  47. package/src/index.js +7 -2
  48. package/src/media/two-side-arrow.svg +1 -0
  49. package/src/media/two-sided-horizontal.svg +1 -0
  50. package/src/media/two-sided-vertical.svg +3 -0
  51. package/src/panel.js +130 -65
  52. package/src/screenSize.js +38 -5
  53. package/webpack.config.js +7 -4
  54. package/media/measureDistance.png +0 -0
  55. package/media/panel.png +0 -0
  56. package/media/screenSize.png +0 -0
  57. package/media/trackGaze.png +0 -0
  58. package/src/displaySize.js +0 -28
package/src/index.js CHANGED
@@ -3,16 +3,19 @@ import RemoteCalibrator from './core'
3
3
  import './const'
4
4
 
5
5
  import './screenSize'
6
- import './displaySize'
6
+
7
7
  import './distance/distance'
8
8
  import './distance/distanceTrack'
9
- import './interpupillaryDistance'
9
+ import './distance/distanceCheck'
10
+ import './distance/interPupillaryDistance'
10
11
 
11
12
  import './gaze/gaze'
12
13
  import './gaze/gazeCalibration'
13
14
  import './gaze/gazeAccuracy'
14
15
  import GazeTracker from './gaze/gazeTracker'
15
16
 
17
+ import './check/checkScreenSize'
18
+
16
19
  import './panel'
17
20
  import './customization'
18
21
 
@@ -20,10 +23,12 @@ import './css/main.css'
20
23
  import './css/screenSize.css'
21
24
  import './css/distance.scss'
22
25
  import './css/gaze.css'
26
+ import './css/video.scss'
23
27
 
24
28
  import 'animate.css'
25
29
  import 'sweetalert2/src/sweetalert2.scss'
26
30
  import './css/swal.css'
31
+ import './css/components.scss'
27
32
 
28
33
  const r = new RemoteCalibrator()
29
34
  r.gazeTracker = new GazeTracker(r)
@@ -0,0 +1 @@
1
+ <svg fill="none" height="163" viewBox="0 0 222 163" width="222" xmlns="http://www.w3.org/2000/svg"><path clip-rule="evenodd" d="m3.22183 88.7817c-4.29577-4.2957-4.29577-11.2605 0-15.5563l70.00357-70.00357c4.2958-4.29577 11.2606-4.29577 15.5563 0 4.2958 4.29577 4.2958 11.26057 0 15.55637l-51.2253 51.2254h146.8876l-51.226-51.2254c-4.296-4.2958-4.296-11.2606 0-15.55637s11.261-4.29577 15.557 0l70.003 70.00357c4.296 4.2958 4.296 11.2606 0 15.5563l-70.003 70.0033c-4.296 4.296-11.261 4.296-15.557 0-4.296-4.295-4.296-11.26 0-15.556l51.226-51.2254h-146.8876l51.2253 51.2254c4.2958 4.296 4.2958 11.261 0 15.556-4.2957 4.296-11.2605 4.296-15.5563 0z" fill="#000" fill-rule="evenodd"/></svg>
@@ -0,0 +1 @@
1
+ <svg class="arrow-two-sided-svg" width="1440" height="163" viewBox="0 0 1440 163" fill="none" xmlns="http://www.w3.org/2000/svg"><path class="arrow-two-sided" fill-rule="evenodd" clip-rule="evenodd" d="M3.49996 88.7818C-0.795805 84.486 -0.795805 77.5212 3.49996 73.2254L73.5035 3.22183C77.7993 -1.07393 84.7641 -1.07393 89.0599 3.22183C93.3557 7.5176 93.3557 14.4824 89.0599 18.7782L37.8345 70.0036L1402.17 70.0036L1350.94 18.7782C1346.64 14.4824 1346.64 7.5176 1350.94 3.22183C1355.24 -1.07394 1362.2 -1.07394 1366.5 3.22183L1436.5 73.2254C1440.8 77.5212 1440.8 84.486 1436.5 88.7817L1366.5 158.785C1362.2 163.081 1355.24 163.081 1350.94 158.785C1346.64 154.49 1346.64 147.525 1350.94 143.229L1402.17 92.0036L37.8345 92.0036L89.0599 143.229C93.3557 147.525 93.3557 154.49 89.0599 158.785C84.7641 163.081 77.7993 163.081 73.5035 158.785L3.49996 88.7818Z" /></svg>
@@ -0,0 +1,3 @@
1
+ <svg width="164" height="900" viewBox="0 0 164 900" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M74.2218 4C78.5175 -0.295771 85.4824 -0.295771 89.7781 4L159.782 74.0036C164.077 78.2993 164.077 85.2641 159.782 89.5599C155.486 93.8557 148.521 93.8557 144.225 89.5599L93 38.3345L93 861.665L144.225 810.44C148.521 806.144 155.486 806.144 159.782 810.44C164.078 814.736 164.078 821.701 159.782 825.996L89.7782 896C85.4824 900.296 78.5176 900.296 74.2218 896L4.21825 825.996C-0.0775169 821.701 -0.0775172 814.736 4.21825 810.44C8.51402 806.144 15.4788 806.144 19.7746 810.44L71 861.665L71 38.3345L19.7746 89.5599C15.4788 93.8557 8.51397 93.8557 4.2182 89.5599C-0.0775644 85.2642 -0.0775647 78.2993 4.2182 74.0036L74.2218 4Z" fill="black"/>
3
+ </svg>
package/src/panel.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import tinycolor from 'tinycolor2'
2
2
 
3
+ import { safeExecuteFunc } from './components/utils'
3
4
  import RemoteCalibrator from './core'
4
5
  import { phrases } from './i18n'
5
6
 
@@ -10,7 +11,7 @@ import Phone from './media/smartphone.svg'
10
11
  import './css/panel.scss'
11
12
 
12
13
  RemoteCalibrator.prototype.removePanel = function () {
13
- if (!this._hasPanel) return false
14
+ if (!this._panelStatus.hasPanel) return false
14
15
  this._panel.panelObserver.unobserve(this._panel.panel)
15
16
  this._panel.panel.remove()
16
17
 
@@ -22,8 +23,9 @@ RemoteCalibrator.prototype.removePanel = function () {
22
23
  this._panel.panelCallback = null
23
24
  this._panel.panelResolve = null
24
25
 
25
- this._hasPanel = false
26
- this._panelFinished = false
26
+ this._panelStatus.hasPanel = false
27
+ this._panelStatus.panelFinished = false
28
+ _clearPanelIntervals(this)
27
29
 
28
30
  return true
29
31
  }
@@ -35,7 +37,7 @@ RemoteCalibrator.prototype.resetPanel = function (
35
37
  callback = null,
36
38
  resolveOnFinish = null
37
39
  ) {
38
- if (!this._hasPanel) return false
40
+ if (!this._panelStatus.hasPanel) return false
39
41
 
40
42
  const t = tasks || [...this._panel.panelTasks]
41
43
  const o = options || { ...this._panel.panelOptions }
@@ -50,7 +52,9 @@ RemoteCalibrator.prototype.resetPanel = function (
50
52
  this.removePanel()
51
53
  return this.panel(t, parent, o, c, r)
52
54
  }
55
+
53
56
  // Current parent, just reset
57
+ _clearPanelIntervals(this)
54
58
  return this.panel(t, this._panel.panelParent, o, c, r, true)
55
59
  }
56
60
 
@@ -60,9 +64,9 @@ RemoteCalibrator.prototype.panel = async function (
60
64
  options = {},
61
65
  callback = null,
62
66
  resolveOnFinish = null,
63
- _reset = false // ! Not open for users
67
+ _reset = false // ! Not available to users
64
68
  ) {
65
- if (this._hasPanel ^ _reset) return false
69
+ if (this._panelStatus.hasPanel ^ _reset) return false
66
70
  /**
67
71
  * has rest
68
72
  * t f no
@@ -93,6 +97,8 @@ RemoteCalibrator.prototype.panel = async function (
93
97
  nextDescription: phrases.RC_panelIntroNext[this.L],
94
98
  nextButton: phrases.RC_panelButton[this.L],
95
99
  color: '#3490de',
100
+ debug: false,
101
+ i18n: true,
96
102
  _demoActivateAll: false, // ! Private
97
103
  },
98
104
  options
@@ -119,7 +125,13 @@ RemoteCalibrator.prototype.panel = async function (
119
125
 
120
126
  const panel = document.createElement('div')
121
127
  panel.className = panel.id = 'rc-panel'
122
- panel.innerHTML = `<h1 class="rc-panel-title" id="rc-panel-title">${options.headline}</h1>`
128
+ if (this.LD === this._CONST.RTL) panel.className += ' rc-lang-rtl'
129
+ else panel.className += ' rc-lang-ltr'
130
+
131
+ if (options.i18n) {
132
+ panel.innerHTML += `<div class="rc-panel-language-parent" id="rc-panel-language-parent"></div>`
133
+ }
134
+ panel.innerHTML += `<h1 class="rc-panel-title" id="rc-panel-title">${options.headline}</h1>`
123
135
  panel.innerHTML += `<p class="rc-panel-description" id="rc-panel-description">${options.description}</p>`
124
136
  panel.innerHTML += '<div class="rc-panel-steps" id="rc-panel-steps"></div>'
125
137
 
@@ -129,11 +141,12 @@ RemoteCalibrator.prototype.panel = async function (
129
141
  const steps = panel.querySelector('#rc-panel-steps')
130
142
 
131
143
  // Observe panel size for adjusting steps
144
+ const RC = this
132
145
  const panelObserver = new ResizeObserver(() => {
133
- _setStepsClassesSL(steps, panel.offsetWidth)
146
+ _setStepsClassesSL(steps, panel.offsetWidth, RC.LD)
134
147
  })
135
148
  panelObserver.observe(panel)
136
- _setStepsClassesSL(steps, panel.offsetWidth)
149
+ _setStepsClassesSL(steps, panel.offsetWidth, this.LD)
137
150
 
138
151
  if (tasks.length === 0) {
139
152
  steps.className += ' rc-panel-no-steps'
@@ -173,18 +186,26 @@ RemoteCalibrator.prototype.panel = async function (
173
186
  this._panel.panelCallback = callback
174
187
  this._panel.panelResolve = resolveOnFinish
175
188
 
176
- this._hasPanel = true
177
- this._panelFinished = false
189
+ this._panelStatus.hasPanel = true
190
+ this._panelStatus.panelFinished = false
191
+
192
+ if (options.i18n)
193
+ _setLanguagePicker(
194
+ this,
195
+ document.querySelector('#rc-panel-language-parent'),
196
+ darkerColor
197
+ )
178
198
 
179
199
  if (resolveOnFinish === null) resolveOnFinish = true
180
200
 
181
201
  return new Promise(resolve => {
182
202
  const _ = setInterval(() => {
183
- if (this._panelFinished) {
203
+ if (this._panelStatus.panelFinished) {
184
204
  clearInterval(_)
185
205
  resolve(resolveOnFinish)
186
206
  }
187
- }, 200)
207
+ }, 100)
208
+ this._panelStatus.panelResolveIntervals.push(_)
188
209
  })
189
210
  }
190
211
 
@@ -201,31 +222,21 @@ const _validTaskList = {
201
222
  name: phrases.RC_screenSize['en-US'],
202
223
  phraseHandle: 'RC_screenSize',
203
224
  },
204
- displaySize: {
205
- use: 0,
206
- name: phrases.RC_displaySize['en-US'],
207
- phraseHandle: 'RC_displaySize',
208
- },
209
225
  measureDistance: {
210
- use: 2,
226
+ use: 1,
211
227
  name: phrases.RC_viewingDistance['en-US'],
212
228
  phraseHandle: 'RC_viewingDistance',
213
229
  },
214
230
  trackDistance: {
215
231
  use: 2,
216
- name: phrases.RC_headTracking['en-US'],
217
- phraseHandle: 'RC_headTracking',
232
+ name: phrases.RC_distanceTracking['en-US'],
233
+ phraseHandle: 'RC_distanceTracking',
218
234
  },
219
235
  trackGaze: {
220
236
  use: 2,
221
237
  name: phrases.RC_gazeTracking['en-US'],
222
238
  phraseHandle: 'RC_gazeTracking',
223
239
  },
224
- environment: {
225
- use: 0,
226
- name: phrases.RC_environment['en-US'],
227
- phraseHandle: 'RC_environment',
228
- },
229
240
  }
230
241
  const _validTaskListNames = Object.keys(_validTaskList)
231
242
 
@@ -296,13 +307,22 @@ const _nextStepBlock = (index, options) => {
296
307
  return b
297
308
  }
298
309
 
299
- const _setStepsClassesSL = (steps, panelWidth) => {
310
+ const _setStepsClassesSL = (steps, panelWidth, LD) => {
300
311
  if (panelWidth < 640) {
301
312
  steps.classList.add('rc-panel-steps-s')
302
313
  steps.classList.remove('rc-panel-steps-l')
314
+
315
+ steps.childNodes.forEach(e => {
316
+ e.classList.add(`rc-lang-${LD.toLowerCase()}`)
317
+ })
303
318
  } else {
304
319
  steps.classList.add('rc-panel-steps-l')
305
320
  steps.classList.remove('rc-panel-steps-s')
321
+
322
+ steps.childNodes.forEach(e => {
323
+ e.classList.remove(`rc-lang-ltr`)
324
+ e.classList.remove(`rc-lang-rtl`)
325
+ })
306
326
  }
307
327
  }
308
328
 
@@ -314,25 +334,44 @@ const _activateStepAt = (RC, current, tasks, options, finalCallback) => {
314
334
  // Default situation
315
335
  if (eIndex === current.index) {
316
336
  e.classList.replace('rc-panel-step-inactive', 'rc-panel-step-active')
337
+ e.focus()
317
338
  if (eIndex !== tasks.length) {
318
339
  if (eIndex === tasks.length - 1 && !options.showNextButton) {
340
+ // Last task without next button
319
341
  e.onclick = () => {
320
342
  RC[_getTaskName(tasks[current.index])](
321
- ..._getTaskOptionsCallbacks(tasks[current.index], finalCallback)
343
+ ..._getTaskOptionsCallbacks(
344
+ tasks[current.index],
345
+ // Fixed task callback
346
+ () => {
347
+ _finishStepAt(current.index)
348
+ },
349
+ finalCallback,
350
+ // Fixed final callback
351
+ () => {
352
+ RC._panelStatus.panelFinished = true
353
+ }
354
+ )
322
355
  )
323
- _finishStepAt(current.index)
324
356
  }
325
357
  } else {
358
+ // Interim tasks
326
359
  e.onclick = () => {
327
360
  RC[_getTaskName(tasks[current.index])](
328
- ..._getTaskOptionsCallbacks(tasks[current.index])
361
+ ..._getTaskOptionsCallbacks(
362
+ tasks[current.index],
363
+ // Fixed task callback
364
+ () => {
365
+ _finishStepAt(current.index)
366
+ current.index++
367
+ _activateStepAt(RC, current, tasks, options, finalCallback)
368
+ }
369
+ )
329
370
  )
330
- _finishStepAt(current.index)
331
- current.index++
332
- _activateStepAt(RC, current, tasks, options, finalCallback)
333
371
  }
334
372
  }
335
373
  } else if (eIndex === tasks.length && options.showNextButton) {
374
+ // All tasks finished with next button
336
375
  // Change headline and description
337
376
  const { headline, nextHeadline, description, nextDescription } =
338
377
  options
@@ -343,9 +382,8 @@ const _activateStepAt = (RC, current, tasks, options, finalCallback) => {
343
382
  nextDescription
344
383
 
345
384
  e.onclick = () => {
346
- RC._panelFinished = true
347
- if (finalCallback && typeof finalCallback === 'function')
348
- finalCallback()
385
+ RC._panelStatus.panelFinished = true
386
+ safeExecuteFunc(finalCallback, { timestamp: new Date() })
349
387
  }
350
388
  }
351
389
  }
@@ -366,9 +404,8 @@ const _activateStepAt = (RC, current, tasks, options, finalCallback) => {
366
404
  'rc-panel-step-active'
367
405
  )
368
406
  finalButton.onclick = () => {
369
- RC._panelFinished = true
370
- if (finalCallback && typeof finalCallback === 'function')
371
- finalCallback()
407
+ RC._panelStatus.panelFinished = true
408
+ safeExecuteFunc(finalCallback, { timestamp: new Date() })
372
409
  }
373
410
  }
374
411
  }
@@ -389,44 +426,72 @@ const _getTaskName = task => {
389
426
  return task.name
390
427
  }
391
428
 
392
- const _getTaskOptionsCallbacks = (task, finalCallback = null) => {
393
- if (typeof task === 'string') return []
429
+ const _getTaskOptionsCallbacks = (
430
+ task,
431
+ fixedTaskCallback,
432
+ finalCallback = null,
433
+ fixedFinalCallback = null
434
+ ) => {
435
+ if (typeof task === 'string')
436
+ task = {
437
+ name: task,
438
+ }
394
439
 
395
- const _ = () => {
396
- if (task.callback && typeof task.callback === 'function') task.callback()
397
- if (finalCallback && typeof finalCallback === 'function') finalCallback()
440
+ const getFinalCallbacks = () => {
441
+ // Task
442
+ safeExecuteFunc(fixedTaskCallback)
443
+ // Panel
444
+ safeExecuteFunc(finalCallback, { timestamp: new Date() })
445
+ safeExecuteFunc(fixedFinalCallback)
398
446
  }
399
447
 
400
- // TODO Refine this process
401
- // Replace hardcoded strings with RC CONST
402
- if (['displaySize', 'environment'].includes(task.name)) {
403
- return [_]
404
- } else if (['screenSize', 'measureDistance'].includes(task.name)) {
405
- return [task.options || {}, _]
406
- } else if (['trackGaze'].includes(task.name)) {
448
+ if (['screenSize', 'measureDistance'].includes(task.name)) {
407
449
  return [
408
450
  task.options || {},
409
- () => {
410
- if (
411
- task.callbackOnCalibrationEnd &&
412
- typeof task.callbackOnCalibrationEnd === 'function'
413
- )
414
- task.callbackOnCalibrationEnd()
415
- if (finalCallback && typeof finalCallback === 'function')
416
- finalCallback()
451
+ data => {
452
+ safeExecuteFunc(task.callback, data)
453
+ getFinalCallbacks()
454
+ },
455
+ ]
456
+ } else if ('trackGaze' === task.name) {
457
+ return [
458
+ task.options || {},
459
+ data => {
460
+ safeExecuteFunc(task.callbackOnCalibrationEnd, data)
461
+ getFinalCallbacks()
417
462
  },
418
463
  task.callbackTrack || null,
419
464
  ]
420
- } else if (['trackDistance'].includes(task.name)) {
465
+ } else if ('trackDistance' === task.name) {
421
466
  return [
422
467
  task.options || {},
423
- () => {
424
- if (task.callbackStatic && typeof task.callbackStatic === 'function')
425
- task.callbackStatic()
426
- if (finalCallback && typeof finalCallback === 'function')
427
- finalCallback()
468
+ data => {
469
+ safeExecuteFunc(task.callbackStatic, data)
470
+ getFinalCallbacks()
428
471
  },
429
472
  task.callbackTrack || null,
430
473
  ]
431
474
  }
432
475
  }
476
+
477
+ const _clearPanelIntervals = RC => {
478
+ RC._panelStatus.panelResolveIntervals.forEach(i => clearInterval(i))
479
+ RC._panelStatus.panelResolveIntervals = []
480
+ }
481
+
482
+ const _setLanguagePicker = (RC, parent, darkerColor) => {
483
+ let langInner = `<select name="rc-lang" id="rc-panel-lang-picker" style="color: ${darkerColor} !important">`
484
+ for (let lang of RC.supportedLanguages)
485
+ if (RC.L === lang.language)
486
+ langInner += `<option value="${lang.language}" selected>${lang.languageNameNative}</option>`
487
+ for (let lang of RC.supportedLanguages)
488
+ if (RC.L !== lang.language)
489
+ langInner += `<option value="${lang.language}">${lang.languageNameNative}</option>`
490
+ langInner += '</select>'
491
+ parent.innerHTML = langInner
492
+
493
+ document.querySelector('#rc-panel-lang-picker').onchange = () => {
494
+ RC.newLanguage(document.querySelector('#rc-panel-lang-picker').value)
495
+ RC.resetPanel()
496
+ }
497
+ }
package/src/screenSize.js CHANGED
@@ -1,5 +1,12 @@
1
+ import isEqual from 'react-fast-compare'
2
+
1
3
  import RemoteCalibrator from './core'
2
- import { toFixedNumber, blurAll, remap } from './components/utils'
4
+ import {
5
+ toFixedNumber,
6
+ blurAll,
7
+ remap,
8
+ safeExecuteFunc,
9
+ } from './components/utils'
3
10
 
4
11
  import Card from './media/card.svg'
5
12
  import Arrow from './media/arrow.svg'
@@ -9,6 +16,31 @@ import { bindKeys, unbindKeys } from './components/keyBinder'
9
16
  import { addButtons } from './components/buttons'
10
17
  import { phrases } from './i18n'
11
18
 
19
+ RemoteCalibrator.prototype._displaySize = function () {
20
+ ////
21
+ if (!this.checkInitialized()) return
22
+ ////
23
+
24
+ const thisData = {
25
+ value: {
26
+ displayWidthPx: screen.width,
27
+ displayHeightPx: screen.height,
28
+ windowWidthPx: window.innerWidth,
29
+ windowHeightPx: window.innerHeight,
30
+ },
31
+ timestamp: new Date(),
32
+ }
33
+
34
+ if (
35
+ !this.displayData.length ||
36
+ !isEqual(
37
+ thisData.value,
38
+ this.displayData[this.displayData.length - 1].value
39
+ )
40
+ )
41
+ this.newDisplayData = thisData
42
+ }
43
+
12
44
  // TODO Make it customizable
13
45
  const defaultObj = 'usba'
14
46
 
@@ -31,7 +63,6 @@ RemoteCalibrator.prototype.screenSize = function (options = {}, callback) {
31
63
  * options -
32
64
  *
33
65
  * fullscreen: [Boolean]
34
- * quitFullscreenOnFinished: [Boolean] // TODO
35
66
  * repeatTesting: 1 // TODO
36
67
  * decimalPlace: [Number] Default 1
37
68
  * headline: [String]
@@ -46,11 +77,11 @@ RemoteCalibrator.prototype.screenSize = function (options = {}, callback) {
46
77
  options = Object.assign(
47
78
  {
48
79
  fullscreen: false,
49
- quitFullscreenOnFinished: false,
50
80
  repeatTesting: 1,
51
81
  decimalPlace: 1,
52
82
  headline: '🖥️ ' + phrases.RC_screenSizeTitle[this.L],
53
83
  description: phrases.RC_screenSizeIntro[this.L],
84
+ check: false,
54
85
  },
55
86
  options
56
87
  )
@@ -196,7 +227,9 @@ function getSize(RC, parent, options, callback) {
196
227
  breakFunction()
197
228
 
198
229
  // ! Call the callback function
199
- if (callback) callback(screenData)
230
+ if (options.check) RC._checkScreenSize(callback, screenData)
231
+ else safeExecuteFunc(callback, screenData)
232
+
200
233
  return
201
234
  }
202
235
 
@@ -278,7 +311,7 @@ const switchMatchingObj = (name, elements, setSizes) => {
278
311
  // if (name === 'card') elements.arrow.style.visibility = 'visible'
279
312
  // else elements.arrow.style.visibility = 'hidden'
280
313
  elements.arrow.style.visibility = 'hidden'
281
- if (setSizes) setSizes()
314
+ safeExecuteFunc(setSizes)
282
315
  }
283
316
 
284
317
  /**
package/webpack.config.js CHANGED
@@ -3,7 +3,9 @@ const webpack = require('webpack')
3
3
  const ESLintPlugin = require('eslint-webpack-plugin')
4
4
  const WebpackModules = require('webpack-modules')
5
5
  const { CleanWebpackPlugin } = require('clean-webpack-plugin')
6
+
6
7
  const TerserPlugin = require('terser-webpack-plugin')
8
+ const CssMinimizerPlugin = require('css-minimizer-webpack-plugin')
7
9
 
8
10
  const packageJSON = require('./package.json')
9
11
 
@@ -98,6 +100,7 @@ const libConfig = Object.assign({}, config, {
98
100
  },
99
101
  },
100
102
  }),
103
+ new CssMinimizerPlugin(),
101
104
  ],
102
105
  },
103
106
  })
@@ -136,10 +139,10 @@ module.exports = env => {
136
139
  new webpack.BannerPlugin(licenseText)
137
140
  )
138
141
 
139
- const libConfigExample = Object.assign({}, libConfig, {
140
- output: exampleConfig.output,
141
- })
142
+ // const libConfigExample = Object.assign({}, libConfig, {
143
+ // output: exampleConfig.output,
144
+ // })
142
145
 
143
- return [libConfig, libConfigExample]
146
+ return libConfig
144
147
  }
145
148
  }
Binary file
package/media/panel.png DELETED
Binary file
Binary file
Binary file
@@ -1,28 +0,0 @@
1
- import RemoteCalibrator from './core'
2
- import { blurAll } from './components/utils'
3
-
4
- /**
5
- *
6
- * Get the display (and window) size
7
- *
8
- */
9
- RemoteCalibrator.prototype.displaySize = function (callback) {
10
- ////
11
- if (!this.checkInitialized()) return
12
- blurAll()
13
- ////
14
-
15
- const thisData = {
16
- value: {
17
- displayWidthPx: screen.width,
18
- displayHeightPx: screen.height,
19
- windowWidthPx: window.innerWidth,
20
- windowHeightPx: window.innerHeight,
21
- },
22
- timestamp: new Date(),
23
- // id: this.id.value
24
- }
25
- this.newDisplayData = thisData
26
-
27
- if (callback) callback(thisData)
28
- }