{"size": 1727, "ext": "js", "max_stars_repo_path": "js/buttons/RecordStopButton.js", "max_stars_repo_name": "phetsims/scenery-phet", "max_stars_repo_stars_event_min_datetime": "2015-06-11T22:59:15.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-07T09:21:26.000Z", "max_issues_repo_path": "js/buttons/RecordStopButton.js", "max_issues_repo_name": "phetsims/scenery-phet", "max_issues_repo_issues_event_min_datetime": "2015-01-02T21:05:59.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-29T23:42:30.000Z", "max_forks_repo_path": "js/buttons/RecordStopButton.js", "max_forks_repo_name": "phetsims/scenery-phet", "max_forks_repo_forks_event_min_datetime": "2016-05-20T18:24:03.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-18T09:16:16.000Z"}
{"max_stars_count": 7, "max_issues_count": 630, "max_forks_count": 5, "avg_line_length": 34.54, "max_line_length": 130, "alphanum_fraction": 0.6925303995}
// Copyright 2016-2021, University of Colorado Boulder

/**
 * Button for toggling 'recording' state on/off.
 *
 * @author Chris Malley (PixelZoom, Inc.)
 */

import InstanceRegistry from '../../../phet-core/js/documentation/InstanceRegistry.js';
import merge from '../../../phet-core/js/merge.js';
import { Circle } from '../../../scenery/js/imports.js';
import { Rectangle } from '../../../scenery/js/imports.js';
import BooleanRoundToggleButton from '../../../sun/js/buttons/BooleanRoundToggleButton.js';
import PhetColorScheme from '../PhetColorScheme.js';
import sceneryPhet from '../sceneryPhet.js';

class RecordStopButton extends BooleanRoundToggleButton {

  /**
   * @param {Property.<boolean>} recordingProperty - true: recording, false: not recording
   * @param {Object} [options] node options
   */
  constructor( recordingProperty, options ) {

    options = merge( {
      radius: 30,
      xMargin: 16.5,
      yMargin: 16.5
    }, options );

    const squareLength = 0.75 * options.radius;

    // stop icon, a black square
    const stopIcon = new Rectangle( 0, 0, 0.75 * options.radius, 0.75 * options.radius, { fill: 'black' } );

    // record icon, a red circle
    const recordIcon = new Circle( 0.6 * squareLength, {
      fill: PhetColorScheme.RED_COLORBLIND,
      center: stopIcon.center
    } );

    super( stopIcon, recordIcon, recordingProperty, options );

    // support for binder documentation, stripped out in builds and only runs when ?binder is specified
    assert && phet.chipper.queryParameters.binder && InstanceRegistry.registerDataURL( 'scenery-phet', 'RecordStopButton', this );
  }
}

sceneryPhet.register( 'RecordStopButton', RecordStopButton );
export default RecordStopButton;