diff --git a/src/index.tsx b/src/index.tsx
index 7e4f72b7f..449389290 100644
--- a/src/index.tsx
+++ b/src/index.tsx
@@ -2,7 +2,7 @@ import React from "react";
import ReactDOM from "react-dom";
import rough from "roughjs/bin/wrappers/rough";
import { RoughCanvas } from "roughjs/bin/canvas";
-import { SketchPicker } from "react-color";
+import { TwitterPicker } from "react-color";
import { moveOneLeft, moveAllLeft, moveOneRight, moveAllRight } from "./zindex";
import { roundRect } from "./roundRect";
@@ -795,12 +795,7 @@ function generateDraw(element: ExcalidrawElement) {
leftY
] = getDiamondPoints(element);
return generator.polygon(
- [
- [topX, topY],
- [rightX, rightY],
- [bottomX, bottomY],
- [leftX, leftY]
- ],
+ [[topX, topY], [rightX, rightY], [bottomX, bottomY], [leftX, leftY]],
{
stroke: element.strokeColor,
fill: element.backgroundColor,
@@ -981,16 +976,9 @@ function restore(
}
}
-enum ColorPicker {
- CANVAS_BACKGROUND,
- SHAPE_STROKE,
- SHAPE_BACKGROUND
-}
-
type AppState = {
draggingElement: ExcalidrawElement | null;
resizingElement: ExcalidrawElement | null;
- currentColorPicker: ColorPicker | null;
elementType: string;
exportBackground: boolean;
currentItemStrokeColor: string;
@@ -1035,7 +1023,7 @@ const SHAPES = [
icon: (
// custom
),
value: "diamond"
@@ -1232,6 +1220,56 @@ function getElementAtPosition(x: number, y: number) {
return hitElement;
}
+function ColorPicker({
+ color,
+ onChange
+}: {
+ color: string;
+ onChange: (color: string) => void;
+}) {
+ const [isActive, setActive] = React.useState(false);
+ return (
+
+