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 ( +
+
{someElementIsSelectedIsRectangleOrEllipseOrDiamond() && (
Shape Background Color
-
-
)} @@ -1798,7 +1722,7 @@ class App extends React.Component<{}, AppState> { onChange={this.changeStrokeWidth} value={getSelectedStrokeWidth()} > - + @@ -1812,7 +1736,7 @@ class App extends React.Component<{}, AppState> { onChange={this.changeRoughness} value={getSelectedRoughness()} > - + diff --git a/src/styles.scss b/src/styles.scss index a8f7f9972..09d3d2d8e 100644 --- a/src/styles.scss +++ b/src/styles.scss @@ -24,6 +24,7 @@ body { background-color: #eee; padding: 10px; overflow-y: auto; + position: relative; h4 { margin: 10px 0 10px 0;