Skip to content

Commit

Permalink
Merge pull request #165 from sasza2/feat/z-index-property-on-element
Browse files Browse the repository at this point in the history
feat: z-index property on element
  • Loading branch information
sasza2 authored Feb 26, 2025
2 parents e7e6050 + 2a95398 commit e9a98a8
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/healthy-comics-begin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@sasza/react-panzoom": minor
---

feat: z-index property option on element
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ import PanZoom, { Element } from '@sasza/react-panzoom'
| resizerWidth | number | 15 | Width of resizer element |
| x | number | 0 | x position of element |
| y | number | 0 | y position of element |
| zIndex | number | undefined | z-index of element |

# Selecting

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,6 @@
"react": ">=16.14.0"
},
"dependencies": {
"panzoom-core": "1.8.2"
"panzoom-core": "1.9.0"
}
}
8 changes: 4 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions src/Element.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const Element: React.FC<ElementProps> = ({
width,
x,
y,
zIndex,
}) => {
const nodeRef = useRef<HTMLDivElement>();
const elementRef = useRef<ElementApi>();
Expand All @@ -52,6 +53,7 @@ const Element: React.FC<ElementProps> = ({
width,
x,
y,
zIndex,
};

useLayoutEffect(() => {
Expand Down Expand Up @@ -85,6 +87,7 @@ const Element: React.FC<ElementProps> = ({
width,
x,
y,
zIndex,
]);

return (
Expand Down
2 changes: 1 addition & 1 deletion src/PanZoom.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const PanZoom: React.FC<PanZoomProps & { apiRef?: Ref<PanZoomApi> }> = ({
...props,
className: props.className || 'react-panzoom',
});
panZoomRef.current.setOptions(props)
panZoomRef.current.setOptions(props);
setInitialized(true);
return panZoomRef.current.destroy;
}, []);
Expand Down
1 change: 1 addition & 0 deletions types/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ export type ElementOptions = {
width?: number;
x?: number;
y?: number;
zIndex?: number;
};

export type ElementProps = React.PropsWithChildren<ElementOptions>
Expand Down

0 comments on commit e9a98a8

Please sign in to comment.