5180 fichiers 38.5 Mo 0 téléchargements 300 vues mis à jour il y a 6 heures ui
nitro-v36-with-renderer-v36 / src / components / floorplan-editor / views / FloorplanWallHeightSlider.tsx
FloorplanWallHeightSlider.tsx 1.3 Ko Télécharger le fichier
import { CSSProperties, FC } from 'react';
import { Slider } from '../../../common/Slider';
import { MAX_WALL_HEIGHT, MIN_WALL_HEIGHT } from '../state/constants';

type Props = {
    value: number;
    onChange: (next: number) => void;
};

export const FloorplanWallHeightSlider: FC<Props> = ({ value, onChange }) => {
    const count = MAX_WALL_HEIGHT - MIN_WALL_HEIGHT + 1;
    const clamped = Math.max(MIN_WALL_HEIGHT, Math.min(MAX_WALL_HEIGHT, value));

    return (
        // AIR wall_height_controls: a horizontal slider beside the wall height number.
        <Slider
            bare
            className="fp-hslider is-ladder"
            style={{ '--fp-count': count } as CSSProperties}
            min={MIN_WALL_HEIGHT}
            max={MAX_WALL_HEIGHT}
            step={1}
            value={clamped}
            thumbAriaLabel="Wall height"
            title={`Wall height ${clamped}`}
            trackClassName="fp-hslider-track"
            thumbClassName="fp-hslider-thumb"
            trackStyle={{ '--fp-rung': `${(100 / count).toFixed(4)}%` } as CSSProperties}
            trackTestId="wall-height-track"
            renderThumbContent={() => <span data-testid="wall-height-thumb" data-value={clamped} hidden />}
            onChange={(next: number) => onChange(next)}
        />
    );
};
15Sujets
1Dépôts
20Membres
2En ligne
Profile
Inscrit
Dernière visite
Messages
0
Votes positifs
0
Votes négatifs
0

Nous utilisons des cookies pour assurer le bon fonctionnement du site et améliorer votre expérience. en savoir plus

Autoriser