@tbib-image-viewer/react 0.1.5 → 0.1.6

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.mjs CHANGED
@@ -265,50 +265,48 @@ var ImageToolbar = ({
265
265
  totalImages
266
266
  }) => {
267
267
  const showSubtoolbar = activeTool === "pen" || activeTool === "highlighter" || activeTool === "laser";
268
- const toolbarRef = React2.useRef(null);
269
- const subtoolbarRef = React2.useRef(null);
268
+ const toolbarScrollRef = React2.useRef(null);
269
+ const subtoolbarScrollRef = React2.useRef(null);
270
270
  const toolbarTouchState = React2.useRef({ isDown: false, startX: 0, scrollLeft: 0 });
271
271
  const subtoolbarTouchState = React2.useRef({ isDown: false, startX: 0, scrollLeft: 0 });
272
272
  const handleToolbarTouchStart = (e) => {
273
- if (!toolbarRef.current) return;
273
+ if (!toolbarScrollRef.current) return;
274
274
  toolbarTouchState.current = {
275
275
  isDown: true,
276
276
  startX: e.touches[0].clientX,
277
- scrollLeft: toolbarRef.current.scrollLeft
277
+ scrollLeft: toolbarScrollRef.current.scrollLeft
278
278
  };
279
279
  };
280
280
  const handleToolbarTouchMove = (e) => {
281
- if (!toolbarTouchState.current.isDown || !toolbarRef.current) return;
281
+ if (!toolbarTouchState.current.isDown || !toolbarScrollRef.current) return;
282
282
  const dx = e.touches[0].clientX - toolbarTouchState.current.startX;
283
- toolbarRef.current.scrollLeft = toolbarTouchState.current.scrollLeft - dx;
283
+ toolbarScrollRef.current.scrollLeft = toolbarTouchState.current.scrollLeft - dx;
284
284
  };
285
285
  const handleToolbarTouchEnd = () => {
286
286
  toolbarTouchState.current.isDown = false;
287
287
  };
288
288
  const handleSubtoolbarTouchStart = (e) => {
289
- if (!subtoolbarRef.current) return;
289
+ if (!subtoolbarScrollRef.current) return;
290
290
  subtoolbarTouchState.current = {
291
291
  isDown: true,
292
292
  startX: e.touches[0].clientX,
293
- scrollLeft: subtoolbarRef.current.scrollLeft
293
+ scrollLeft: subtoolbarScrollRef.current.scrollLeft
294
294
  };
295
295
  };
296
296
  const handleSubtoolbarTouchMove = (e) => {
297
- if (!subtoolbarTouchState.current.isDown || !subtoolbarRef.current) return;
297
+ if (!subtoolbarTouchState.current.isDown || !subtoolbarScrollRef.current) return;
298
298
  const dx = e.touches[0].clientX - subtoolbarTouchState.current.startX;
299
- subtoolbarRef.current.scrollLeft = subtoolbarTouchState.current.scrollLeft - dx;
299
+ subtoolbarScrollRef.current.scrollLeft = subtoolbarTouchState.current.scrollLeft - dx;
300
300
  };
301
301
  const handleSubtoolbarTouchEnd = () => {
302
302
  subtoolbarTouchState.current.isDown = false;
303
303
  };
304
304
  return /* @__PURE__ */ jsxs2("div", { className: "tbib-iv-toolbar-wrapper", children: [
305
- /* @__PURE__ */ jsxs2(
306
- "header",
305
+ /* @__PURE__ */ jsx2("header", { className: "tbib-iv-toolbar", role: "toolbar", "aria-label": "Image tools", children: /* @__PURE__ */ jsxs2(
306
+ "div",
307
307
  {
308
- ref: toolbarRef,
309
- className: "tbib-iv-toolbar",
310
- role: "toolbar",
311
- "aria-label": "Image tools",
308
+ ref: toolbarScrollRef,
309
+ className: "tbib-iv-toolbar-scroll",
312
310
  onTouchStart: handleToolbarTouchStart,
313
311
  onTouchMove: handleToolbarTouchMove,
314
312
  onTouchEnd: handleToolbarTouchEnd,
@@ -498,14 +496,12 @@ var ImageToolbar = ({
498
496
  ] })
499
497
  ]
500
498
  }
501
- ),
502
- showSubtoolbar && /* @__PURE__ */ jsxs2(
499
+ ) }),
500
+ showSubtoolbar && /* @__PURE__ */ jsx2("div", { className: "tbib-iv-subtoolbar", role: "region", "aria-label": "Tool customization", children: /* @__PURE__ */ jsxs2(
503
501
  "div",
504
502
  {
505
- ref: subtoolbarRef,
506
- className: "tbib-iv-subtoolbar",
507
- role: "region",
508
- "aria-label": "Tool customization",
503
+ ref: subtoolbarScrollRef,
504
+ className: "tbib-iv-subtoolbar-scroll",
509
505
  onTouchStart: handleSubtoolbarTouchStart,
510
506
  onTouchMove: handleSubtoolbarTouchMove,
511
507
  onTouchEnd: handleSubtoolbarTouchEnd,
@@ -569,7 +565,7 @@ var ImageToolbar = ({
569
565
  ] })
570
566
  ]
571
567
  }
572
- )
568
+ ) })
573
569
  ] });
574
570
  };
575
571