diff --git a/app/src/components/SimulationDashboard/components/block/BlockEditor.tsx b/app/src/components/SimulationDashboard/components/block/BlockEditor.tsx index 2c48082..0582fca 100644 --- a/app/src/components/SimulationDashboard/components/block/BlockEditor.tsx +++ b/app/src/components/SimulationDashboard/components/block/BlockEditor.tsx @@ -46,6 +46,7 @@ const BlockEditor: React.FC = ({ const { editorPosition, setEditorPosition } = useVisualizationStore(); const panelRef = useRef(null); const initialPositionRef = useRef<{ xPercent: number; yPercent: number } | null>(null); + const [panelWidth, setPanelWidth] = useState(300); const draggingRef = useRef(false); const startXRef = useRef(0); const startYRef = useRef(0); @@ -107,7 +108,8 @@ const BlockEditor: React.FC = ({ useEffect(() => { if (!editorPosition) { const { width } = getPanelDimensions(); - const defaultX = Math.max(0, window.innerWidth - width - 40); + setPanelWidth(width || 300); + const defaultX = Math.max(0, window.innerWidth - (width || 300) - 40); const defaultY = 80; setPositionFromPixels(defaultX, defaultY); @@ -115,6 +117,9 @@ const BlockEditor: React.FC = ({ xPercent: (defaultX / window.innerWidth) * 100, yPercent: (defaultY / window.innerHeight) * 100, }; + } else { + const { width } = getPanelDimensions(); + setPanelWidth(width || 300); } // eslint-disable-next-line react-hooks/exhaustive-deps }, []); @@ -218,7 +223,7 @@ const BlockEditor: React.FC = ({ } }} className="panel block-editor-panel" - style={{ position: "fixed", left: position.x, top: position.y, zIndex: 999 }} + style={{ position: "fixed", left: position.x, top: position.y, zIndex: 999, width: panelWidth }} >
diff --git a/app/src/components/SimulationDashboard/components/element/ElementEditor.tsx b/app/src/components/SimulationDashboard/components/element/ElementEditor.tsx index 655b369..a7bd46e 100644 --- a/app/src/components/SimulationDashboard/components/element/ElementEditor.tsx +++ b/app/src/components/SimulationDashboard/components/element/ElementEditor.tsx @@ -66,6 +66,7 @@ const ElementEditor: React.FC = ({ const { editorPosition, setEditorPosition } = useVisualizationStore(); const panelRef = useRef(null); const initialPositionRef = useRef<{ xPercent: number; yPercent: number } | null>(null); + const [panelWidth, setPanelWidth] = useState(300); const draggingRef = useRef(false); const startXRef = useRef(0); @@ -126,7 +127,8 @@ const ElementEditor: React.FC = ({ useEffect(() => { if (!editorPosition) { const { width } = getPanelDimensions(); - const defaultX = Math.max(0, window.innerWidth - width - 40); + setPanelWidth(width || 300); + const defaultX = Math.max(0, window.innerWidth - (width || 300) - 40); const defaultY = 80; setPositionFromPixels(defaultX, defaultY); @@ -134,6 +136,10 @@ const ElementEditor: React.FC = ({ xPercent: (defaultX / window.innerWidth) * 100, yPercent: (defaultY / window.innerHeight) * 100, }; + } else { + // ensure we capture current width when editorPosition exists + const { width } = getPanelDimensions(); + setPanelWidth(width || 300); } // eslint-disable-next-line react-hooks/exhaustive-deps }, []); @@ -520,7 +526,7 @@ const ElementEditor: React.FC = ({ } }} className="panel element-editor-panel" - style={{ position: "fixed", left: position.x, top: position.y, zIndex: 1000 }} + style={{ position: "fixed", left: position.x, top: position.y, zIndex: 1000, width: panelWidth }} >
diff --git a/app/src/styles/components/_input.scss b/app/src/styles/components/_input.scss index 7152089..918a6aa 100644 --- a/app/src/styles/components/_input.scss +++ b/app/src/styles/components/_input.scss @@ -226,9 +226,7 @@ input[type="number"] { position: relative; cursor: pointer; - .key { - text-overflow: none; - } + /* key default styles removed to allow dropdown header to control ellipsis */ .dropdown-header { height: 100%; @@ -241,6 +239,7 @@ input[type="number"] { width: calc(100% - 18px); overflow: hidden; text-overflow: ellipsis; + white-space: nowrap; } } @@ -268,20 +267,21 @@ input[type="number"] { margin-bottom: 4px; } - .option { - padding: 6px 6px; - cursor: pointer; - flex-direction: row !important; - border-radius: #{$border-radius-medium}; - width: 100%; - overflow: hidden; - text-overflow: ellipsis; + .option { + padding: 6px 6px; + cursor: pointer; + flex-direction: row !important; + border-radius: #{$border-radius-medium}; + width: 100%; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; - &:hover { - color: var(--highlight-text-color); - background: var(--highlight-accent-color); + &:hover { + color: var(--highlight-text-color); + background: var(--highlight-accent-color); + } } - } } .input.default {