aboutsummaryrefslogtreecommitdiff
path: root/src/components/taggs/TaggDraggable.tsx
diff options
context:
space:
mode:
authorGeorge Rusu <george@tagg.id>2021-05-25 16:29:54 -0700
committerGeorge Rusu <george@tagg.id>2021-05-25 16:29:54 -0700
commit10d3ed80b3b84956cf7364140313ea465a95ba8b (patch)
treeab01a2fdccaad4c22dc5d7a16e44b59547e60406 /src/components/taggs/TaggDraggable.tsx
parent6fd5a5516595d1731af35e1cef9607ce7b32e8f6 (diff)
Currently pushes tags offscreen
Diffstat (limited to 'src/components/taggs/TaggDraggable.tsx')
-rw-r--r--src/components/taggs/TaggDraggable.tsx19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/components/taggs/TaggDraggable.tsx b/src/components/taggs/TaggDraggable.tsx
index 1c7b2524..7be4a88f 100644
--- a/src/components/taggs/TaggDraggable.tsx
+++ b/src/components/taggs/TaggDraggable.tsx
@@ -47,11 +47,11 @@ const TaggDraggable: React.FC<TaggDraggableProps> = (
useEffect(() => {
draggableRef.current.measure(
(
- fx: number,
+ fx: number, // location of ref relative to parent element
fy: number,
width: number,
height: number,
- px: number,
+ px: number, // location of ref relative to entire screen
py: number,
) => {
console.log(px);
@@ -60,6 +60,21 @@ const TaggDraggable: React.FC<TaggDraggableProps> = (
);
});
+ const getCoords = () => {
+ draggableRef.current.measure(
+ (
+ fx: number, // location of ref relative to parent element
+ fy: number,
+ width: number,
+ height: number,
+ px: number, // location of ref relative to entire screen
+ py: number,
+ ) => {
+ return [px, py];
+ },
+ );
+ };
+
const user: UserType = {
userId: taggedUser.id,
username: taggedUser.username,