Skip to content

Commit

Permalink
allow more user viewport root customization
Browse files Browse the repository at this point in the history
  • Loading branch information
a-type committed Oct 2, 2024
1 parent b905c0f commit 633913e
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/components/viewport/ViewportRoot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,19 @@ const baseStyle: CSSProperties = {
width: '100%',
height: '100%',
flex: 1,
overflow: 'hidden',
userSelect: 'none',
cursor: 'move',
};

const requiredStyle: CSSProperties = {
position: 'relative',
cursor: 'move',
touchAction: 'none',
contain: 'strict',
userSelect: 'none',
overflow: 'hidden',
};

const defaultStyles = { ...baseStyle, ...requiredStyle };

export const ViewportRoot = ({
children,
className,
Expand All @@ -66,7 +71,10 @@ export const ViewportRoot = ({
viewport.bindElement,
);

const style = userStyle ? { ...userStyle, ...baseStyle } : baseStyle;
const style =
userStyle ?
{ ...baseStyle, ...userStyle, ...requiredStyle }
: defaultStyles;

return (
<ViewportContext.Provider value={viewport}>
Expand Down

0 comments on commit 633913e

Please sign in to comment.