diff --git a/site/src/components/ShapeBuilder/index.js b/site/src/components/ShapeBuilder/index.js
index 4bd3832..9facf10 100644
--- a/site/src/components/ShapeBuilder/index.js
+++ b/site/src/components/ShapeBuilder/index.js
@@ -4,6 +4,7 @@ import { Wrapper, CanvasContainer, OutputBox, StyledSVG } from "./shapeBuilder.s
import { Button, Typography, Box } from "@layer5/sistent";
import { SVG, extend as SVGextend } from "@svgdotjs/svg.js";
import draw from "@svgdotjs/svg.draw.js";
+import { ContentCopy } from "@mui/icons-material";
SVGextend(SVG.Polygon, draw);
@@ -66,6 +67,13 @@ const ShapeBuilder = () => {
poly.draw("param", "snapToGrid", 0.001);
}
+ if (e.key === "Escape" || (e.detail === 2)) {
+ poly.draw("done");
+ poly.fill("#00B39F");
+ showCytoArray();
+ }
+
+
if (e.key === "Enter") {
poly.draw("done");
poly.fill("#00B39F");
@@ -116,6 +124,13 @@ const ShapeBuilder = () => {
draw.on("drawstart", attachKeyListeners);
draw.on("drawdone", detachKeyListeners);
+ draw.on("dblclick", () => {
+ draw.draw("done");
+ draw.fill("#00B39F");
+ showCytoArray();
+ });
+
+
polyRef.current = draw;
setError(null);
} catch (err) {
@@ -123,7 +138,7 @@ const ShapeBuilder = () => {
}
};
- const clearShape = () => {
+ const resetShape = () => {
const poly = polyRef.current;
if (!poly) return;
@@ -184,16 +199,35 @@ const ShapeBuilder = () => {
-
+
-
- Polygon Coordinates (SVG format):
-
-
+
+
);
diff --git a/site/src/components/ShapeBuilder/shapeBuilder.styles.js b/site/src/components/ShapeBuilder/shapeBuilder.styles.js
index 273c081..cb1a1ec 100644
--- a/site/src/components/ShapeBuilder/shapeBuilder.styles.js
+++ b/site/src/components/ShapeBuilder/shapeBuilder.styles.js
@@ -93,7 +93,9 @@ export const OutputBox = styled.div`
max-width: 600px;
margin: 0 auto;
text-align: left;
-
+ display: flex;
+ flex-direction: column;
+
h6 {
margin-bottom: 0.75rem;
font-weight: 600;
@@ -112,6 +114,29 @@ export const OutputBox = styled.div`
font-family: monospace;
font-size: 0.95rem;
}
+
+ .copy-btn {
+ border-radius: 0.5rem;
+ align-self: center;
+ background-color: ${({ theme }) => theme.primary || "#00B39F"};
+ color: ${({ theme }) => theme.text || "#fff"};
+ padding: 0.5rem 1.5rem;
+ border: none;
+ cursor: pointer;
+ font-family: monospace;
+ font-size: 0.95rem;
+ transition: background-color 0.3s ease;
+ margin-top: 1rem;
+
+ &:hover {
+ background-color: ${({ theme }) => theme.primaryDark || "#009684"};
+ }
+ }
+
+ &:disabled {
+ opacity: 0.5;
+ cursor: not-allowed;
+ }
.error {
color: red;