Refine window panel by family
This commit is contained in:
@@ -328,17 +328,38 @@ export default function WindowPanel() {
|
|||||||
const maxRoundedRadius = Math.max(0.01, getMaxSharedWindowRadius(node.width, node.height))
|
const maxRoundedRadius = Math.max(0.01, getMaxSharedWindowRadius(node.width, node.height))
|
||||||
const displayedWindowType = node.windowType === 'hopper' ? 'awning' : (node.windowType ?? 'fixed')
|
const displayedWindowType = node.windowType === 'hopper' ? 'awning' : (node.windowType ?? 'fixed')
|
||||||
const awningDirection = node.windowType === 'hopper' ? 'down' : (node.awningDirection ?? 'up')
|
const awningDirection = node.windowType === 'hopper' ? 'down' : (node.awningDirection ?? 'up')
|
||||||
const isOperableWindow =
|
const windowType = node.windowType ?? 'fixed'
|
||||||
node.windowType === 'sliding' ||
|
const isFixedWindow = windowType === 'fixed'
|
||||||
node.windowType === 'casement' ||
|
const isTrackSashWindow =
|
||||||
node.windowType === 'awning' ||
|
windowType === 'sliding' || windowType === 'single-hung' || windowType === 'double-hung'
|
||||||
node.windowType === 'hopper' ||
|
const isOperableSashWindow =
|
||||||
node.windowType === 'single-hung' ||
|
windowType === 'casement' ||
|
||||||
node.windowType === 'double-hung' ||
|
windowType === 'awning' ||
|
||||||
node.windowType === 'louvered'
|
windowType === 'hopper' ||
|
||||||
|
windowType === 'louvered'
|
||||||
|
const isOperableWindow = isTrackSashWindow || isOperableSashWindow
|
||||||
const supportsWindowShape = shapedWindowTypes.has(node.windowType ?? 'fixed')
|
const supportsWindowShape = shapedWindowTypes.has(node.windowType ?? 'fixed')
|
||||||
const supportsGrid = node.windowType === 'fixed'
|
const supportsGrid = isFixedWindow
|
||||||
const supportsSill = !silllessWindowTypes.has(node.windowType)
|
const supportsSill = !silllessWindowTypes.has(node.windowType)
|
||||||
|
const showWindowTypeSection = !isOpening
|
||||||
|
const showWindowShapeSection = !isOpening && supportsWindowShape
|
||||||
|
const showOpeningShapeSection = isOpening
|
||||||
|
const showFrameSection = !isOpening
|
||||||
|
const showGridSection = !isOpening && supportsGrid
|
||||||
|
const showSillSection = !isOpening && supportsSill
|
||||||
|
const showOperationSection = !isOpening && isOperableWindow
|
||||||
|
const showAwningDirectionSection = !isOpening && displayedWindowType === 'awning'
|
||||||
|
const showCasementSection = !isOpening && windowType === 'casement'
|
||||||
|
const showFlipSide = !isOpening
|
||||||
|
const operationLabel = isTrackSashWindow
|
||||||
|
? windowType === 'sliding'
|
||||||
|
? 'Slide'
|
||||||
|
: 'Raise'
|
||||||
|
: windowType === 'casement'
|
||||||
|
? 'Swing'
|
||||||
|
: windowType === 'louvered'
|
||||||
|
? 'Slats'
|
||||||
|
: 'Tilt'
|
||||||
|
|
||||||
const setOperationState = (value: number) => {
|
const setOperationState = (value: number) => {
|
||||||
useInteractive.getState().cancelWindowAnimation(node.id)
|
useInteractive.getState().cancelWindowAnimation(node.id)
|
||||||
@@ -472,7 +493,7 @@ export default function WindowPanel() {
|
|||||||
/>
|
/>
|
||||||
</PanelSection>
|
</PanelSection>
|
||||||
|
|
||||||
{!isOpening && (
|
{showWindowTypeSection && (
|
||||||
<PanelSection title="Window Type">
|
<PanelSection title="Window Type">
|
||||||
<div className="grid grid-cols-2 gap-1.5 px-1 pt-1">
|
<div className="grid grid-cols-2 gap-1.5 px-1 pt-1">
|
||||||
{windowTypeOptions.map((option) => {
|
{windowTypeOptions.map((option) => {
|
||||||
@@ -503,7 +524,7 @@ export default function WindowPanel() {
|
|||||||
)
|
)
|
||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
{displayedWindowType === 'awning' && (
|
{showAwningDirectionSection && (
|
||||||
<div className="mt-2">
|
<div className="mt-2">
|
||||||
<SegmentedControl
|
<SegmentedControl
|
||||||
onChange={(value) =>
|
onChange={(value) =>
|
||||||
@@ -520,7 +541,7 @@ export default function WindowPanel() {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{node.windowType === 'casement' && (
|
{showCasementSection && (
|
||||||
<div className="mt-2 space-y-2">
|
<div className="mt-2 space-y-2">
|
||||||
<SegmentedControl
|
<SegmentedControl
|
||||||
onChange={(value) =>
|
onChange={(value) =>
|
||||||
@@ -546,10 +567,10 @@ export default function WindowPanel() {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{isOperableWindow && (
|
{showOperationSection && (
|
||||||
<div className="mt-2">
|
<div className="mt-2">
|
||||||
<SliderControl
|
<SliderControl
|
||||||
label="Open"
|
label={operationLabel}
|
||||||
max={1}
|
max={1}
|
||||||
min={0}
|
min={0}
|
||||||
onChange={setOperationState}
|
onChange={setOperationState}
|
||||||
@@ -588,7 +609,7 @@ export default function WindowPanel() {
|
|||||||
unit="m"
|
unit="m"
|
||||||
value={Math.round(node.position[1] * 100) / 100}
|
value={Math.round(node.position[1] * 100) / 100}
|
||||||
/>
|
/>
|
||||||
{!isOpening && (
|
{showFlipSide && (
|
||||||
<div className="px-1 pt-2 pb-1">
|
<div className="px-1 pt-2 pb-1">
|
||||||
<ActionButton
|
<ActionButton
|
||||||
className="w-full"
|
className="w-full"
|
||||||
@@ -623,8 +644,8 @@ export default function WindowPanel() {
|
|||||||
/>
|
/>
|
||||||
</PanelSection>
|
</PanelSection>
|
||||||
|
|
||||||
{!isOpening && supportsWindowShape && (
|
{showWindowShapeSection && (
|
||||||
<PanelSection title="Corner Shape">
|
<PanelSection title="Top Shape">
|
||||||
<SegmentedControl
|
<SegmentedControl
|
||||||
onChange={(value) =>
|
onChange={(value) =>
|
||||||
handleUpdate({
|
handleUpdate({
|
||||||
@@ -726,7 +747,7 @@ export default function WindowPanel() {
|
|||||||
</PanelSection>
|
</PanelSection>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{isOpening && (
|
{showOpeningShapeSection && (
|
||||||
<PanelSection title="Opening Shape">
|
<PanelSection title="Opening Shape">
|
||||||
<SegmentedControl
|
<SegmentedControl
|
||||||
onChange={(value) =>
|
onChange={(value) =>
|
||||||
@@ -819,7 +840,8 @@ export default function WindowPanel() {
|
|||||||
|
|
||||||
{!isOpening && (
|
{!isOpening && (
|
||||||
<>
|
<>
|
||||||
<PanelSection title="Frame">
|
{showFrameSection && (
|
||||||
|
<PanelSection title="Frame">
|
||||||
<SliderControl
|
<SliderControl
|
||||||
label="Thickness"
|
label="Thickness"
|
||||||
min={0}
|
min={0}
|
||||||
@@ -838,9 +860,10 @@ export default function WindowPanel() {
|
|||||||
unit="m"
|
unit="m"
|
||||||
value={Math.round(node.frameDepth * 1000) / 1000}
|
value={Math.round(node.frameDepth * 1000) / 1000}
|
||||||
/>
|
/>
|
||||||
</PanelSection>
|
</PanelSection>
|
||||||
|
)}
|
||||||
|
|
||||||
{supportsGrid && (
|
{showGridSection && (
|
||||||
<PanelSection title="Grid">
|
<PanelSection title="Grid">
|
||||||
<SliderControl
|
<SliderControl
|
||||||
label="Columns"
|
label="Columns"
|
||||||
@@ -935,7 +958,7 @@ export default function WindowPanel() {
|
|||||||
</PanelSection>
|
</PanelSection>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{supportsSill && (
|
{showSillSection && (
|
||||||
<PanelSection title="Sill">
|
<PanelSection title="Sill">
|
||||||
<ToggleControl
|
<ToggleControl
|
||||||
checked={node.sill}
|
checked={node.sill}
|
||||||
|
|||||||
Reference in New Issue
Block a user