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.
@@ -33,4 +33,7 @@ export declare function useLoadFocusModel({ modelPath, modelLoadTimeoutMs, onMod
33
33
  modelDownloadProgress: number;
34
34
  modelError: Error | null;
35
35
  };
36
+ export declare let lastFocusPredictionAt: number;
37
+ export declare let lastFocusPredictionTime: number;
38
+ export declare function setLastFocusPredictionAt(time: number): void;
36
39
  export declare function makeFocusModelPrediction(model: ImageClassifier, imageData: Frame, cropCanvas: HTMLCanvasElement, rotateCanvas: HTMLCanvasElement, box?: DetectedObjectBox): FocusPrediction;
@@ -234,7 +234,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
234
234
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
235
235
  };
236
236
 
237
- var webSdkVersion = '2.1.77';
237
+ var webSdkVersion = '2.1.78';
238
238
 
239
239
  function getPlatform() {
240
240
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -2872,6 +2872,12 @@ function useLoadFocusModel(_a) {
2872
2872
  modelError: modelError
2873
2873
  };
2874
2874
  }
2875
+ var lastFocusPredictionAt = 0;
2876
+ var lastFocusPredictionTime = 0;
2877
+ function setLastFocusPredictionAt(time) {
2878
+ lastFocusPredictionTime = time - lastFocusPredictionAt;
2879
+ lastFocusPredictionAt = time;
2880
+ }
2875
2881
  function makeFocusModelPrediction(model, imageData, cropCanvas, rotateCanvas, box) {
2876
2882
  var _a, _b, _c, _d, _e;
2877
2883
  var startedAt = new Date();
@@ -5984,22 +5990,19 @@ function FocusModelProvider(_a) {
5984
5990
  var _e = React.useState({}),
5985
5991
  focusThresholds = _e[0],
5986
5992
  setFocusThresholds = _e[1];
5987
- var _f = React.useState(0),
5988
- focusPredictionTime = _f[0],
5989
- setFocusPredictionTime = _f[1];
5990
- var _g = useLoadFocusModel({
5993
+ var _f = useLoadFocusModel({
5991
5994
  modelPath: focusModelPath,
5992
5995
  modelLoadTimeoutMs: focusModelLoadTimeoutMs,
5993
5996
  onModelError: onFocusModelError
5994
5997
  }),
5995
- model = _g.model,
5996
- ready = _g.ready,
5997
- modelDownloadProgress = _g.modelDownloadProgress,
5998
- modelError = _g.modelError;
5998
+ model = _f.model,
5999
+ ready = _f.ready,
6000
+ modelDownloadProgress = _f.modelDownloadProgress,
6001
+ modelError = _f.modelError;
5999
6002
  var makeFocusPrediction = React.useCallback(function (imageData, box) {
6000
6003
  if (!model.current) return null;
6001
6004
  var prediction = makeFocusModelPrediction(model.current, imageData, cropCanvas.current, rotateCanvas.current, box);
6002
- setFocusPredictionTime(prediction.predictionTime);
6005
+ setLastFocusPredictionAt(prediction.predictionTime);
6003
6006
  return prediction;
6004
6007
  }, [model]);
6005
6008
  var value = React.useMemo(function () {
@@ -6008,11 +6011,11 @@ function FocusModelProvider(_a) {
6008
6011
  focusModelDownloadProgress: modelDownloadProgress,
6009
6012
  focusModelError: modelError,
6010
6013
  makeFocusPrediction: makeFocusPrediction,
6011
- focusPredictionTime: focusPredictionTime,
6014
+ focusPredictionTime: lastFocusPredictionTime,
6012
6015
  focusThresholds: focusThresholds,
6013
6016
  setFocusThresholds: setFocusThresholds
6014
6017
  };
6015
- }, [focusPredictionTime, focusThresholds, makeFocusPrediction, modelDownloadProgress, modelError, ready]);
6018
+ }, [focusThresholds, makeFocusPrediction, modelDownloadProgress, modelError, ready]);
6016
6019
  return /*#__PURE__*/React__namespace.default.createElement(FocusModelContext.Provider, {
6017
6020
  value: value
6018
6021
  }, /*#__PURE__*/React__namespace.default.createElement(InvisibleCanvas, {