From 1796cb3f9422adb9f24f5cbdca0cd338cccc052f Mon Sep 17 00:00:00 2001 From: Jonathan <69540930+mirdukkkkk@users.noreply.github.com> Date: Tue, 20 Aug 2024 02:20:21 +1200 Subject: [PATCH] remove cursor --- src/components/Cursor/Cursor.module.css | 8 ---- src/components/Cursor/Cursor.tsx | 31 ------------ .../Windows/Palette/Palette/Palette.tsx | 3 -- src/pages/Home/index.tsx | 47 +++++++++---------- 4 files changed, 21 insertions(+), 68 deletions(-) delete mode 100644 src/components/Cursor/Cursor.module.css delete mode 100644 src/components/Cursor/Cursor.tsx diff --git a/src/components/Cursor/Cursor.module.css b/src/components/Cursor/Cursor.module.css deleted file mode 100644 index 7f9e7e5..0000000 --- a/src/components/Cursor/Cursor.module.css +++ /dev/null @@ -1,8 +0,0 @@ -.cursor { - position: fixed; - width: 10px; - height: 10px; - pointer-events: none; - transform: translate(-50%, -50%); - z-index: 9999; -} \ No newline at end of file diff --git a/src/components/Cursor/Cursor.tsx b/src/components/Cursor/Cursor.tsx deleted file mode 100644 index ed01ad8..0000000 --- a/src/components/Cursor/Cursor.tsx +++ /dev/null @@ -1,31 +0,0 @@ -import { useEffect, useState, useContext } from 'preact/hooks'; -import styles from './Cursor.module.css'; -import { CursorContext } from "../../managers/cursor"; - -export function Cursor() { - const cursor = useContext(CursorContext); - const [visible, setVisible] = useState(false); - const [position, setPosition] = useState({ x: 0, y: 0 }); - const updateCursor = function(e: MouseEvent) { - setPosition({ x: e.clientX, y: e.clientY }); - } - - useEffect(() => { - document.addEventListener('mouseover', (e) => { - updateCursor(e); - setVisible(true); - }); - document.addEventListener('mouseout', () => setVisible(false)); - document.addEventListener('mousemove', updateCursor); - }, []); - - return
; -} \ No newline at end of file diff --git a/src/components/Windows/Palette/Palette/Palette.tsx b/src/components/Windows/Palette/Palette/Palette.tsx index aad99b6..e696414 100644 --- a/src/components/Windows/Palette/Palette/Palette.tsx +++ b/src/components/Windows/Palette/Palette/Palette.tsx @@ -1,7 +1,6 @@ import { useContext } from "preact/hooks"; import { PaletteGroup } from "../PaletteGroup/PaletteGroup"; import { PaletteContext } from "../../../../managers/palette"; -import { CursorContext } from "../../../../managers/cursor"; import { ColorSelect } from "../ColorSelect/ColorSelect"; import { ColorCreate } from "../ColorCreate/ColorCreate"; import { ColorDelete } from "../ColorDelete/ColorDelete"; @@ -11,10 +10,8 @@ import styles from "./Palette.module.css"; export function Palette() { const palette = useContext(PaletteContext) - const cursor = useContext(CursorContext); palette.load() - cursor.setColor(palette.palette.value.selected) return (
diff --git a/src/pages/Home/index.tsx b/src/pages/Home/index.tsx index 40cbd55..b4b9952 100644 --- a/src/pages/Home/index.tsx +++ b/src/pages/Home/index.tsx @@ -1,6 +1,5 @@ import { PlaceContext, PlaceManager } from '../../managers/place'; import { PaletteContext, PaletteManager } from '../../managers/palette'; -import { CursorContext, CursorManager } from "../../managers/cursor"; import { InfoContext, InfoManager } from '../../managers/info'; import { ProfileContext, ProfileManager } from '../../managers/profile'; import { CooldownContext, CooldownManager } from '../../managers/cooldown'; @@ -14,7 +13,6 @@ import { ModalContext, ModalManager } from '../../managers/modal'; import { lazy } from 'preact/compat'; import { Modal } from '../../components/Modal/Modal'; -import { Cursor } from '../../components/Cursor/Cursor'; const Snow = lazy(() => import("../../components/Snow/Snow").then(r => r.Snow)) const Place = lazy(() => import("../../components/Place/Place").then(r => r.Place)) @@ -30,30 +28,27 @@ export function Home() { - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + +