scorer-ui-kit 1.2.7-liveboard-patch.9 → 1.2.7-liveboard-patch.10

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/dist/index.js CHANGED
@@ -4779,6 +4779,7 @@ var LineUIRTCWithFallback = function LineUIRTCWithFallback(_ref) {
4779
4779
  showHandle = _ref$options$showHand === void 0 ? true : _ref$options$showHand,
4780
4780
  showGrabHandle = _ref$options.showGrabHandle;
4781
4781
  var frame = React.useRef();
4782
+ var containerRef = React.useRef(null);
4782
4783
  var imageRef = React.useRef(null);
4783
4784
  var pollIntervalRef = React.useRef(null);
4784
4785
 
@@ -4894,8 +4895,23 @@ var LineUIRTCWithFallback = function LineUIRTCWithFallback(_ref) {
4894
4895
  setBoundaries(getCanvasBounds());
4895
4896
  }
4896
4897
  }, [videoSize, loaded]);
4897
- var onLoadedMetadata = React.useCallback(function (_ref2) {
4898
- var target = _ref2.target;
4898
+ React.useEffect(function () {
4899
+ if (!loaded || !containerRef.current) return;
4900
+ var observer = new IntersectionObserver(function (_ref2) {
4901
+ var entry = _ref2[0];
4902
+
4903
+ if (entry.isIntersecting && frame.current) {
4904
+ setScreenCTM(frame.current.getScreenCTM());
4905
+ setBoundaries(getCanvasBounds());
4906
+ }
4907
+ });
4908
+ observer.observe(containerRef.current);
4909
+ return function () {
4910
+ return observer.disconnect();
4911
+ };
4912
+ }, [loaded]);
4913
+ var onLoadedMetadata = React.useCallback(function (_ref3) {
4914
+ var target = _ref3.target;
4899
4915
 
4900
4916
  if (target && target.videoWidth > 50 && target.videoHeight > 50) {
4901
4917
  setLoaded(true);
@@ -4966,7 +4982,9 @@ var LineUIRTCWithFallback = function LineUIRTCWithFallback(_ref) {
4966
4982
  showHandle: showHandle,
4967
4983
  showGrabHandle: showGrabHandle
4968
4984
  };
4969
- return React__default.createElement(Container$6, null, React__default.createElement(Video$2, {
4985
+ return React__default.createElement(Container$6, {
4986
+ ref: containerRef
4987
+ }, React__default.createElement(Video$2, {
4970
4988
  style: {
4971
4989
  display: useFallback ? 'none' : 'block'
4972
4990
  },