// Copyright 2019-2024, University of Colorado Boulder
/**
 * NumberControl that shows a spectrum of colors for selecting a wavelength.
 *
 * @author Sam Reid (PhET Interactive Simulations)
 */
import { string_scenery_phet_wavelength_StringProperty } from './strings/wavelength.js';
import { string_scenery_phet_wavelengthNMValuePattern_StringProperty } from './strings/wavelengthNMValuePattern.js';
import '../../globals.js';
import Dimension2 from '../../dot/js/Dimension2.js';
import Range from '../../dot/js/Range.js';
import optionize, { combineOptions } from '../../phet-core/js/optionize.js';
import Slider from '../../sun/js/Slider.js';
import Tandem from '../../tandem/js/Tandem.js';
import NumberControl from './NumberControl.js';
import PhetFont from './PhetFont.js';
import SpectrumSliderThumb from './SpectrumSliderThumb.js';
import SpectrumSliderTrack from './SpectrumSliderTrack.js';
import VisibleColor from './VisibleColor.js';
// constants
const DEFAULT_RANGE = new Range(VisibleColor.MIN_WAVELENGTH, VisibleColor.MAX_WAVELENGTH);
const DEFAULT_TRACK_SIZE = new Dimension2(160, 20);
const DEFAULT_THUMB_WIDTH = 25;
const DEFAULT_THUMB_HEIGHT = 25;
const DEFAULT_VALUE_TO_COLOR = VisibleColor.wavelengthToColor;
/**
 * @param wavelengthProperty - wavelength, in nm
 * @param [options]
 * @constructor
 */
export default class WavelengthNumberControl extends NumberControl {
    /**
     * @param wavelengthProperty - in nm
     * @param providedOptions
     */
    constructor(wavelengthProperty, providedOptions) {
        const options = optionize()({
            title: string_scenery_phet_wavelength_StringProperty,
            range: DEFAULT_RANGE,
            spectrumSliderTrackOptions: {
                valueToColor: DEFAULT_VALUE_TO_COLOR,
                size: DEFAULT_TRACK_SIZE
            },
            spectrumSliderThumbOptions: {
                valueToColor: DEFAULT_VALUE_TO_COLOR,
                width: DEFAULT_THUMB_WIDTH,
                height: DEFAULT_THUMB_HEIGHT,
                cursorHeight: DEFAULT_TRACK_SIZE.height
            },
            tandem: Tandem.REQUIRED,
            tandemNameSuffix: 'Control'
        }, providedOptions);
        const trackNode = new SpectrumSliderTrack(wavelengthProperty, options.range, combineOptions({
            tandem: options.tandem.createTandem(NumberControl.SLIDER_TANDEM_NAME).createTandem(Slider.TRACK_NODE_TANDEM_NAME)
        }, options.spectrumSliderTrackOptions));
        const thumbNode = new SpectrumSliderThumb(wavelengthProperty, combineOptions({
            tandem: options.tandem.createTandem(NumberControl.SLIDER_TANDEM_NAME).createTandem(Slider.THUMB_NODE_TANDEM_NAME)
        }, options.spectrumSliderThumbOptions));
        super(options.title, wavelengthProperty, options.range, combineOptions({
            titleNodeOptions: {
                font: new PhetFont(15),
                maxWidth: 175
            },
            numberDisplayOptions: {
                textOptions: {
                    font: new PhetFont(14)
                },
                valuePattern: string_scenery_phet_wavelengthNMValuePattern_StringProperty,
                maxWidth: 120
            },
            sliderOptions: {
                trackNode: trackNode,
                thumbNode: thumbNode
            },
            layoutFunction: NumberControl.createLayoutFunction3()
        }, options));
    }
}
//# sourceMappingURL=WavelengthNumberControl.js.map