-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
aa146ad
commit 1e4f9f9
Showing
4 changed files
with
32 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
export const AppStatusBar = () => { | ||
//image size | ||
//selection size | ||
//zoom level | ||
//cursor position | ||
return <div className="px-2 border-t bg-secondary">Status bar</div>; | ||
}; | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { Size } from "@/utils/common"; | ||
import { RefObject, useEffect } from "react"; | ||
|
||
export const useResizeObserver = ( | ||
ref: RefObject<HTMLElement>, | ||
onResize: (size: Size) => void | ||
) => { | ||
useEffect(() => { | ||
if (!ref.current) return; | ||
|
||
const element = ref.current; | ||
const observer = new ResizeObserver((entries) => { | ||
for (let entry of entries) { | ||
const { width, height } = entry.contentRect; | ||
onResize({ width, height }); | ||
} | ||
}); | ||
|
||
observer.observe(element); | ||
|
||
return () => { | ||
observer.unobserve(element); | ||
observer.disconnect(); | ||
}; | ||
}, [ref, onResize]); | ||
}; | ||
|