hazo_pdf 1.6.4 → 1.6.5

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.
@@ -4612,6 +4612,7 @@ var PdfViewer = forwardRef(({
4612
4612
  const content_container_ref = useRef11(null);
4613
4613
  const [first_page_width, setFirstPageWidth] = useState13(null);
4614
4614
  const [fit_to_width_active, setFitToWidthActive] = useState13(fit_to_width);
4615
+ const fit_to_width_active_ref = useRef11(fit_to_width);
4615
4616
  useEffect10(() => {
4616
4617
  if (files && files.length > 0) {
4617
4618
  if (!current_file || !files.find((f) => f.id === current_file.id)) {
@@ -4995,6 +4996,7 @@ ${suffix_line}`;
4995
4996
  });
4996
4997
  }, [pdf_document]);
4997
4998
  useEffect10(() => {
4999
+ fit_to_width_active_ref.current = fit_to_width;
4998
5000
  setFitToWidthActive(fit_to_width);
4999
5001
  }, [fit_to_width]);
5000
5002
  useEffect10(() => {
@@ -5002,6 +5004,7 @@ ${suffix_line}`;
5002
5004
  return;
5003
5005
  }
5004
5006
  const calculate_fit_scale = () => {
5007
+ if (!fit_to_width_active_ref.current) return;
5005
5008
  if (!content_container_ref.current || !first_page_width) return;
5006
5009
  const container_width = content_container_ref.current.clientWidth;
5007
5010
  const padding = 40;
@@ -5163,15 +5166,18 @@ ${suffix_line}`;
5163
5166
  };
5164
5167
  }, [handle_undo, handle_redo]);
5165
5168
  const handle_zoom_in = () => {
5169
+ fit_to_width_active_ref.current = false;
5166
5170
  setFitToWidthActive(false);
5167
5171
  setScale((prev) => Math.min(prev + 0.25, 3));
5168
5172
  };
5169
5173
  const handle_zoom_out = () => {
5174
+ fit_to_width_active_ref.current = false;
5170
5175
  setFitToWidthActive(false);
5171
5176
  setScale((prev) => Math.max(prev - 0.25, 0.5));
5172
5177
  };
5173
5178
  const handle_zoom_reset = () => {
5174
5179
  if (fit_to_width) {
5180
+ fit_to_width_active_ref.current = true;
5175
5181
  setFitToWidthActive(true);
5176
5182
  } else {
5177
5183
  setScale(1);
@@ -6315,4 +6321,4 @@ export {
6315
6321
  PdfViewer,
6316
6322
  pdf_viewer_default
6317
6323
  };
6318
- //# sourceMappingURL=chunk-EPV2C5AQ.js.map
6324
+ //# sourceMappingURL=chunk-TTJ5QFUA.js.map