From ebd698d17d44934be82c90bf7d426a75e6133cc3 Mon Sep 17 00:00:00 2001 From: Heiko Joerg Schick Date: Thu, 13 Mar 2025 23:30:58 +0100 Subject: [PATCH] Changed for gride and guidelines --- src/taskpane/components/App.tsx | 2 +- .../components/GridGuidelineManager.tsx | 184 +++++++++++------- 2 files changed, 113 insertions(+), 73 deletions(-) diff --git a/src/taskpane/components/App.tsx b/src/taskpane/components/App.tsx index ecae7403..04b80ff0 100644 --- a/src/taskpane/components/App.tsx +++ b/src/taskpane/components/App.tsx @@ -198,7 +198,7 @@ const App: React.FC = () => {
- Grid & Guidelines + Layout
diff --git a/src/taskpane/components/GridGuidelineManager.tsx b/src/taskpane/components/GridGuidelineManager.tsx index 909bfc21..dfc9535e 100644 --- a/src/taskpane/components/GridGuidelineManager.tsx +++ b/src/taskpane/components/GridGuidelineManager.tsx @@ -49,7 +49,14 @@ const useStyles = makeStyles({ marginBottom: "0" }, controlInput: { - flex: 1 + flex: 1, + "& input[type=number]::-webkit-inner-spin-button, & input[type=number]::-webkit-outer-spin-button": { + "-webkit-appearance": "none", + margin: 0 + }, + "& input[type=number]": { + "-moz-appearance": "textfield" + } }, guidesContainer: { marginTop: "16px" @@ -394,7 +401,79 @@ export const GridGuidelineManager: React.FC = () => { return (
{/* Grid Controls */} -
+ + +
+ +
+ { + const newValue = e.target.value; + const parsed = parseInt(newValue); + if (newValue === '') { + setGridSpacing(0); + } else if (!isNaN(parsed)) { + setGridSpacing(parsed); + } + }} + onClick={(e) => (e.target as HTMLInputElement).select()} + style={{ + width: "100%", + padding: "5px 8px", + border: "1px solid #d1d1d1", + borderRadius: "4px", + fontSize: "14px" + }} + /> +
+
+ +
+ +
+ { + const newValue = e.target.value; + const parsed = parseInt(newValue); + if (newValue === '') { + setGridOpacity(0); + } else if (!isNaN(parsed)) { + setGridOpacity(parsed); + } + }} + onClick={(e) => (e.target as HTMLInputElement).select()} + style={{ + width: "100%", + padding: "5px 8px", + border: "1px solid #d1d1d1", + borderRadius: "4px", + fontSize: "14px" + }} + /> +
+
+ +
+ +
+ + + + +
+
+ +
-
- - { - const value = parseInt(data.value); - if (!isNaN(value) && value >= 10 && value <= 200) { - setGridSpacing(value); - } - }} - /> -
- -
- -
- { - const value = parseInt(data.value); - if (!isNaN(value) && value >= 10 && value <= 100) { - setGridOpacity(value); - } - }} - /> - setGridOpacity(data.value)} - /> -
-
- -
- -
- - - - -
-
- {/* Guidelines Section */}
- +
- { - const value = parseInt(data.value); - const maxVal = guideDirection === "horizontal" ? 540 : 960; - if (!isNaN(value) && value >= 0 && value <= maxVal) { - setGuidePosition(value); - } - }} - /> +
+ { + const newValue = e.target.value; + const parsed = parseInt(newValue); + if (newValue === '') { + setGuidePosition(0); + } else if (!isNaN(parsed)) { + setGuidePosition(parsed); + } + }} + onClick={(e) => (e.target as HTMLInputElement).select()} + style={{ + width: "100%", + padding: "5px 8px", + border: "1px solid #d1d1d1", + borderRadius: "4px", + fontSize: "14px" + }} + /> +