Skip to content

Commit

Permalink
fix: some change
Browse files Browse the repository at this point in the history
  • Loading branch information
wangmengCC committed Dec 28, 2023
1 parent edb0d81 commit 17b767a
Show file tree
Hide file tree
Showing 12 changed files with 52 additions and 152 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

# production
/build
/dist

# misc
.DS_Store
Expand Down
Binary file removed dist/2022-place.png
Binary file not shown.
68 changes: 0 additions & 68 deletions dist/assets/index-4dcfe413.js

This file was deleted.

1 change: 0 additions & 1 deletion dist/assets/index-6d687a8a.css

This file was deleted.

Binary file removed dist/favicon.ico
Binary file not shown.
15 changes: 0 additions & 15 deletions dist/index.html

This file was deleted.

15 changes: 0 additions & 15 deletions dist/manifest.json

This file was deleted.

1 change: 0 additions & 1 deletion dist/react.svg

This file was deleted.

Binary file removed dist/summber-drawing-board.png
Binary file not shown.
1 change: 0 additions & 1 deletion dist/vite.svg

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"socket.io-client": "^4.4.1"
},
"scripts": {
"dev": "vite",
"dev": "vite --host",
"build": "tsc && vite build",
"test": "node scripts/test.js",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
Expand Down
100 changes: 50 additions & 50 deletions src/components/PixelGrid/PixelGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -252,63 +252,63 @@ function PixelGrid({ onPickColor, currentColor, socket }: Props) {
}, []);

return (
<div
style={{
width: canvasWidth,
height: canvasHeight,
overflow: "hidden",
display: "inline-block",
border: "1px solid",
position: "relative",
left: "50%",
transform: "translate(-50%, 0)",
}}
>
{el &&
ReactDOM.createPortal(
<button
style={{ marginLeft: "20px" }}
onClick={setPickColor}
>
{isPickingColor ? "正在取色" : "取色"}
</button>,
el
)}
<div style={{ display: "flex", justifyContent: "center" }}>
<div
ref={canvasWrapper}
className="canvas-wrapper"
style={{
position: "absolute",
left: wrapperLeft,
top: wrapperTop,
width: canvasWidth,
height: canvasHeight,
overflow: "hidden",
display: "inline-block",
border: "1px solid",
position: "relative",
}}
onMouseDown={handleWrapperMousedown}
onMouseMove={handleWrapperMouseMove}
onMouseUp={handleWrapperMouseup}
>
<span
className="dot-hover-box"
{el &&
ReactDOM.createPortal(
<button
style={{ marginLeft: "20px" }}
onClick={setPickColor}
>
{isPickingColor ? "正在取色" : "取色"}
</button>,
el
)}
<div
ref={canvasWrapper}
className="canvas-wrapper"
style={{
boxShadow: "0 0 1px black",
width: `${zoomLevel}px`,
height: `${zoomLevel}px`,
position: "absolute",
left: dotHoveX * zoomLevel,
top: dotHoveY * zoomLevel,
zIndex: TOP_LAYER,
pointerEvents: "none",
left: wrapperLeft,
top: wrapperTop,
}}
></span>
<canvas
style={{
...canvasStyle,
transform: `scale(${zoomLevel})`,
transformOrigin: "top left",
}}
// onWheel={handleZoom}
ref={canvas}
onMouseMove={handleCanvasMouseMove}
></canvas>
onMouseDown={handleWrapperMousedown}
onMouseMove={handleWrapperMouseMove}
onMouseUp={handleWrapperMouseup}
>
<span
className="dot-hover-box"
style={{
boxShadow: "0 0 1px black",
width: `${zoomLevel}px`,
height: `${zoomLevel}px`,
position: "absolute",
left: dotHoveX * zoomLevel,
top: dotHoveY * zoomLevel,
zIndex: TOP_LAYER,
pointerEvents: "none",
}}
></span>
<canvas
style={{
...canvasStyle,
transform: `scale(${zoomLevel})`,
transformOrigin: "top left",
}}
// onWheel={handleZoom}
ref={canvas}
onMouseMove={handleCanvasMouseMove}
></canvas>
</div>
</div>
</div>
);
Expand Down

0 comments on commit 17b767a

Please sign in to comment.