idmission-web-sdk 2.1.77 → 2.1.78

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.
@@ -215,7 +215,7 @@
215
215
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
216
216
  };
217
217
 
218
- var webSdkVersion = '2.1.77';
218
+ var webSdkVersion = '2.1.78';
219
219
 
220
220
  function getPlatform() {
221
221
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -8835,6 +8835,12 @@
8835
8835
  modelError: modelError
8836
8836
  };
8837
8837
  }
8838
+ var lastFocusPredictionAt = 0;
8839
+ var lastFocusPredictionTime = 0;
8840
+ function setLastFocusPredictionAt(time) {
8841
+ lastFocusPredictionTime = time - lastFocusPredictionAt;
8842
+ lastFocusPredictionAt = time;
8843
+ }
8838
8844
  function makeFocusModelPrediction(model, imageData, cropCanvas, rotateCanvas, box) {
8839
8845
  var _a, _b, _c, _d, _e;
8840
8846
  var startedAt = new Date();
@@ -11945,22 +11951,19 @@
11945
11951
  var _e = React.useState({}),
11946
11952
  focusThresholds = _e[0],
11947
11953
  setFocusThresholds = _e[1];
11948
- var _f = React.useState(0),
11949
- focusPredictionTime = _f[0],
11950
- setFocusPredictionTime = _f[1];
11951
- var _g = useLoadFocusModel({
11954
+ var _f = useLoadFocusModel({
11952
11955
  modelPath: focusModelPath,
11953
11956
  modelLoadTimeoutMs: focusModelLoadTimeoutMs,
11954
11957
  onModelError: onFocusModelError
11955
11958
  }),
11956
- model = _g.model,
11957
- ready = _g.ready,
11958
- modelDownloadProgress = _g.modelDownloadProgress,
11959
- modelError = _g.modelError;
11959
+ model = _f.model,
11960
+ ready = _f.ready,
11961
+ modelDownloadProgress = _f.modelDownloadProgress,
11962
+ modelError = _f.modelError;
11960
11963
  var makeFocusPrediction = React.useCallback(function (imageData, box) {
11961
11964
  if (!model.current) return null;
11962
11965
  var prediction = makeFocusModelPrediction(model.current, imageData, cropCanvas.current, rotateCanvas.current, box);
11963
- setFocusPredictionTime(prediction.predictionTime);
11966
+ setLastFocusPredictionAt(prediction.predictionTime);
11964
11967
  return prediction;
11965
11968
  }, [model]);
11966
11969
  var value = React.useMemo(function () {
@@ -11969,11 +11972,11 @@
11969
11972
  focusModelDownloadProgress: modelDownloadProgress,
11970
11973
  focusModelError: modelError,
11971
11974
  makeFocusPrediction: makeFocusPrediction,
11972
- focusPredictionTime: focusPredictionTime,
11975
+ focusPredictionTime: lastFocusPredictionTime,
11973
11976
  focusThresholds: focusThresholds,
11974
11977
  setFocusThresholds: setFocusThresholds
11975
11978
  };
11976
- }, [focusPredictionTime, focusThresholds, makeFocusPrediction, modelDownloadProgress, modelError, ready]);
11979
+ }, [focusThresholds, makeFocusPrediction, modelDownloadProgress, modelError, ready]);
11977
11980
  return /*#__PURE__*/React.createElement(FocusModelContext.Provider, {
11978
11981
  value: value
11979
11982
  }, /*#__PURE__*/React.createElement(InvisibleCanvas, {