Skip to content

Commit 01a9c56

Browse files
committed
fix: add event listener for path creation, and reorganize file structure
1 parent c35a520 commit 01a9c56

File tree

16 files changed

+27
-19
lines changed

16 files changed

+27
-19
lines changed

app/page.tsx

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@ import {
1313
handleCanvasObjectScaling,
1414
handleCanvasSelectionCreated,
1515
handleCanvaseMouseMove,
16+
handlePathCreated,
1617
handleResize,
1718
initializeFabric,
1819
renderCanvas,
1920
} from "@/lib/canvas";
20-
import { ActiveElement, Attributes } from "@/types/type";
21+
import { ActiveElement, Attributes } from "@/types";
2122
import { useMutation, useRedo, useStorage, useUndo } from "@/liveblocks.config";
2223
import { LiveMap } from "@liveblocks/client";
2324
import { defaultNavElement } from "@/constants";
@@ -151,24 +152,31 @@ export default function Home() {
151152
});
152153
});
153154

155+
canvas.on("path:created", (options: any) => {
156+
handlePathCreated({
157+
options,
158+
syncShapeInStorage,
159+
});
160+
});
161+
154162
canvas.on("object:modified", (options: any) => {
155163
handleCanvasObjectModified({
156164
options,
157165
syncShapeInStorage,
158166
});
159167
});
160168

161-
canvas.on("selection:created", (options: any) => {
162-
handleCanvasSelectionCreated({
169+
canvas.on("object:scaling", (options: any) => {
170+
handleCanvasObjectScaling({
163171
options,
164-
isEditingRef,
165172
setElementAttributes,
166173
});
167174
});
168175

169-
canvas.on("object:scaling", (options: any) => {
170-
handleCanvasObjectScaling({
176+
canvas.on("selection:created", (options: any) => {
177+
handleCanvasSelectionCreated({
171178
options,
179+
isEditingRef,
172180
setElementAttributes,
173181
});
174182
});

components/comments/comments-overlay.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
useThreads,
1010
// useUser,
1111
} from "@/liveblocks.config";
12-
import { useMaxZIndex } from "@/lib/use-max-z-index";
12+
import { useMaxZIndex } from "@/hooks/use-max-z-index";
1313

1414
import { PinnedThread } from "./pinned-thread";
1515

components/comments/new-thread.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import * as Portal from "@radix-ui/react-portal";
1313
import { ComposerSubmitComment } from "@liveblocks/react-comments/primitives";
1414

1515
import { useCreateThread } from "@/liveblocks.config";
16-
import { useMaxZIndex } from "@/lib/use-max-z-index";
16+
import { useMaxZIndex } from "@/hooks/use-max-z-index";
1717

1818
import PinnedComposer from "./pinned-composer";
1919
import NewThreadCursor from "./new-thread-cursor";

components/cursor/cursor-chat.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import CursorSVG from "@/public/assets/CursorSVG";
2-
import { CursorChatProps, CursorMode } from "@/types/type";
2+
import { CursorChatProps, CursorMode } from "@/types";
33
import clsx from "clsx";
44
import React from "react";
55

components/cursor/cursor.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import CursorSVG from "@/public/assets/CursorSVG";
2-
import { CursorProps } from "@/types/type";
2+
import { CursorProps } from "@/types";
33
import clsx from "clsx";
44
import React from "react";
55

components/cursor/live-cursors.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { LiveCursorProps } from "@/types/type";
1+
import { LiveCursorProps } from "@/types";
22
import React from "react";
33
import Cursor from "./cursor";
44
import { COLORS } from "@/constants";

components/layout/navbar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import Image from "next/image";
44
import { memo } from "react";
55

66
import { navElements } from "@/constants";
7-
import { ActiveElement, NavbarProps } from "@/types/type";
7+
import { ActiveElement, NavbarProps } from "@/types";
88

99
import { Button } from "../ui/button";
1010
// import ShapesMenu from "./ShapesMenu";

components/layout/right-sidebar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import Dimensions from "../settings/dimension";
44
import Text from "../settings/text";
55
import Color from "../settings/color";
66
import Export from "../settings/export";
7-
import { RightSidebarProps } from "@/types/type";
7+
import { RightSidebarProps } from "@/types";
88
import { modifyShape } from "@/lib/shapes";
99
import { fabric } from "fabric";
1010

components/live.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
import LiveCursors from "./cursor/live-cursors";
1111
import clsx from "clsx";
1212
import CursorChat from "./cursor/cursor-chat";
13-
import { CursorMode, CursorState, Reaction, ReactionEvent } from "@/types/type";
13+
import { CursorMode, CursorState, Reaction, ReactionEvent } from "@/types";
1414
import ReactionSelector from "./reaction/reaction-selector";
1515
import FlyingReaction from "./reaction/flying-reaction";
1616
import useInterval from "@/hooks/use-interval";

components/shapes-menu.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import Image from "next/image";
44

5-
import { ShapesMenuProps } from "@/types/type";
5+
import { ShapesMenuProps } from "@/types";
66

77
import {
88
DropdownMenu,

0 commit comments

Comments
 (0)