From b2d7327067d69b2120bc71f73543faa81bdf1a33 Mon Sep 17 00:00:00 2001 From: Stephen Fraser Date: Mon, 26 Aug 2024 19:39:59 +0100 Subject: [PATCH] Merge PR #55 into 2.0.x --- src/modules/react-reconciler/Atlas.tsx | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/modules/react-reconciler/Atlas.tsx b/src/modules/react-reconciler/Atlas.tsx index 418b1b5..7f8e4fa 100644 --- a/src/modules/react-reconciler/Atlas.tsx +++ b/src/modules/react-reconciler/Atlas.tsx @@ -447,6 +447,11 @@ export const Atlas: React.FC< const { height: _, width: __, ...canvasProps } = restProps; const widthClassName = useClassname([restProps.width, restProps.height]); + let isInteractive = true; + // if we have a render preset and that render preset sets interactive to false, then... disable it + if (renderPreset && Array.isArray(renderPreset) && renderPreset.length > 1 && (renderPreset[1] as any).interactive === false) { + isInteractive = false; + } return ( )} - + + {unstable_noReconciler ? ( @@ -528,8 +536,10 @@ export const Atlas: React.FC< .atlas-canvas:focus-visible, .atlas-canvas-container:focus-visible { outline: var(--atlas-focus, 2px solid darkorange) } .atlas-static-preset { touch-action: inherit; } .atlas-static-container { position: relative; overflow: hidden; flex: 1 1 0px; } - .atlas-overlay { position: absolute; top: 0; left: 0; pointer-events: none; overflow: hidden; } - .atlas-static-image { position: absolute; pointer-events: none; user-select: none; transform-origin: 0px 0px; } + .atlas-overlay { position: absolute; top: 0; left: 0; none; overflow: hidden; } + /** setting the pointer events to none means that Atlas will own the touch and mousewheel events **/ + .atlas-overlay--interactive { pointer-events: none; } + .atlas-static-image { position: absolute; user-select: none; transform-origin: 0px 0px; } .atlas-navigator { position: absolute; top: var(--atlas-navigator-top, 10px); right: var(--atlas-navigator-bottom, 10px); left: var(--atlas-navigator-left); bottom: var(--atlas-navigator-bottom); opacity: .8 } .atlas-navigator-canvas { width: 100%; } `}