Skip to content

Commit

Permalink
fix: some changing of directory
Browse files Browse the repository at this point in the history
  • Loading branch information
wangmengCC committed Sep 19, 2023
1 parent 8ab8a45 commit b4b6341
Show file tree
Hide file tree
Showing 11 changed files with 20 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/App.test.ts → __test__/App.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import ReactDOM from "react-dom";
import App from "./components/App";
import App from "../src/components/App/App";

it("renders without crashing", () => {
const div = document.createElement("div");
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions src/components/App.tsx → src/components/App/App.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React, { useCallback, useContext, useState } from "react";
import io from "socket.io-client";
import "./App.css";
import PixelGrid from "./PixelGrid";
import ColorSelect from "./ColorSelect";
import OnlineCount from "./OnlineCount";
import PixelGrid from "../PixelGrid/PixelGrid";
import ColorSelect from "../ColorSelect/ColorSelect";
import OnlineCount from "../OnlineCount/OnlineCount";
// import { produce } from "immer";
// import _ from "lodash";

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
import React, { useRef, useState, useEffect, useReducer } from "react";
import ReactDOM from "react-dom";
import { initialState, reducer } from "../stores/store";
import { createImageFromArrayBuffer, getMousePos, makeCursor } from "../utils";
import { initialState, reducer } from "../../stores/store";
import {
createImageFromArrayBuffer,
getMousePos,
makeCursor,
} from "../../utils";
import {
Offset,
PickColor,
TOP_LAYER,
WrapperMouseDown,
WrapperMouseMove,
WrapperMouseUp,
Zoom,
} from "../utils/const";
} from "../../utils/const";

const canvasStyle = {
display: "block",
Expand Down Expand Up @@ -215,7 +220,7 @@ function PixelGrid({ onPickColor, currentColor, onPixelClick, socket }: Props) {
let pixelColor = Array.from(
ctx.current.getImageData(x, y, 1, 1).data
);
let pixelColorCss = "rgba(" + pixelColor + ")";
let pixelColorCss = `rgba(${pixelColor})`;
// console.log(pixelColor, pixelColorCss)
let cursorUrl = makeCursor(pixelColorCss);
if (canvas) {
Expand Down Expand Up @@ -253,19 +258,19 @@ function PixelGrid({ onPickColor, currentColor, onPixelClick, socket }: Props) {
className="dot-hover-box"
style={{
boxShadow: "0 0 1px black",
width: zoomLevel + "px",
height: zoomLevel + "px",
width: `${zoomLevel}px`,
height: `${zoomLevel}px`,
position: "absolute",
left: dotHoveX * zoomLevel,
top: dotHoveY * zoomLevel,
zIndex: 8,
zIndex: TOP_LAYER,
pointerEvents: "none",
}}
></span>
<canvas
style={{
...canvasStyle,
transform: "scale(" + zoomLevel + ")",
transform: `scale(${TOP_LAYER})`,
transformOrigin: "top left",
}}
// onWheel={handleZoom}
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import ReactDOM from "react-dom";
import React from "react";
import "./index.css";
import App from "./components/App";
import App from "./components/App/App";
// import * as serviceWorker from './serviceWorker';

// class App extends React.Component {
Expand Down
2 changes: 2 additions & 0 deletions src/utils/const.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ export const WrapperMouseMove = "WrapperMouseMove";
export const WrapperMouseDown = "WrapperMouseDown";
export const PickColor = "PickColor";
export const Offset = "Offset";

export const TOP_LAYER = 8;

0 comments on commit b4b6341

Please sign in to comment.