<commit_before>// Copyright 2014-2019, University of Colorado Boulder

/**
 * Zoom button, has an icon with a magnifying glass, with either a plus or minus sign in the center of the glass.
 *
 * @author <NAME> (PixelZoom, Inc.)
 */
define( require => {
  'use strict';

  // modules
  const Circle = require( 'SCENERY/nodes/Circle' );
  const Dimension2 = require( 'DOT/Dimension2' );
  const inherit = require( 'PHET_CORE/inherit' );
  const InstanceRegistry = require( 'PHET_CORE/documentation/InstanceRegistry' );
  const Line = require( 'SCENERY/nodes/Line' );
  const merge = require( 'PHET_CORE/merge' );
  const MinusNode = require( 'SCENERY_PHET/MinusNode' );
  const Node = require( 'SCENERY/nodes/Node' );
  const PhetColorScheme = require( 'SCENERY_PHET/PhetColorScheme' );
  const PlusNode = require( 'SCENERY_PHET/PlusNode' );
  const RectangularPushButton = require( 'SUN/buttons/RectangularPushButton' );
  const sceneryPhet = require( 'SCENERY_PHET/sceneryPhet' );
  const Tandem = require( 'TANDEM/Tandem' );

  /**
   * @param {Object} [options]
   * @constructor
   */
  function ZoomButton( options ) {

    options = merge( {
      in: true, // true: zoom-in button, false: zoom-out button
      radius: 15,
      baseColor: PhetColorScheme.BUTTON_YELLOW,
      magnifyingGlassFill: 'white', // center of the glass
      magnifyingGlassStroke: 'black', // rim and handle
      tandem: Tandem.REQUIRED
    }, options );

    // the magnifying glass
    const glassLineWidth = 0.25 * options.radius;
    const glassNode = new Circle( options.radius, {
      fill: options.magnifyingGlassFill,
      stroke: options.magnifyingGlassStroke,
      lineWidth: glassLineWidth,
      tandem: options.tandem.createTandem( 'glassNode' )
    } );

    // handle at lower-left of glass, at a 45-degree angle
    const outsideRadius = options.radius + ( glassLineWidth / 2 ); // use outside radius so handle line cap doesn't appear inside glassNode
    const handleNode = new Line(
      outsideRadius * Math.cos( Math.PI / 4 ), outsideRadius * Math.sin( Math.PI / 4 ),
      options.radius * Math.cos( Math.PI / 4 ) + ( 0.65 * options.radius ), options.radius * Math.sin( Math.PI / 4 ) + ( 0.65 * options.radius ), {
        stroke: options.magnifyingGlassStroke,
        lineWidth: 0.4 * options.radius,
        lineCap: 'round'
      } );

    // plus or minus sign in middle of magnifying glass
    const signOptions = {
      size: new Dimension2( 1.3 * options.radius, options.radius / 3 ),
      centerX: glassNode.centerX,
      centerY: glassNode.centerY,
      tandem: options.tandem.createTandem( 'signNode' )
    };
    const signNode = options.in ? new PlusNode( signOptions ) : new MinusNode( signOptions );

    options.content = new Node( { children: [ handleNode, glassNode, signNode ] } );

    RectangularPushButton.call( this, 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', 'ZoomButton', this );
  }

  sceneryPhet.register( 'ZoomButton', ZoomButton );

  return inherit( RectangularPushButton, ZoomButton );
} );<commit_msg>modify phet-io instrumentation of ZoomButton, https://github.com/phetsims/scenery-phet/issues/573<commit_after>// Copyright 2014-2020, University of Colorado Boulder

/**
 * Zoom button, has an icon with a magnifying glass, with either a plus or minus sign in the center of the glass.
 *
 * @author <NAME> (PixelZoom, Inc.)
 */
define( require => {
  'use strict';

  // modules
  const Circle = require( 'SCENERY/nodes/Circle' );
  const Dimension2 = require( 'DOT/Dimension2' );
  const inherit = require( 'PHET_CORE/inherit' );
  const InstanceRegistry = require( 'PHET_CORE/documentation/InstanceRegistry' );
  const Line = require( 'SCENERY/nodes/Line' );
  const merge = require( 'PHET_CORE/merge' );
  const MinusNode = require( 'SCENERY_PHET/MinusNode' );
  const Node = require( 'SCENERY/nodes/Node' );
  const PhetColorScheme = require( 'SCENERY_PHET/PhetColorScheme' );
  const PlusNode = require( 'SCENERY_PHET/PlusNode' );
  const RectangularPushButton = require( 'SUN/buttons/RectangularPushButton' );
  const sceneryPhet = require( 'SCENERY_PHET/sceneryPhet' );
  const Tandem = require( 'TANDEM/Tandem' );

  /**
   * @param {Object} [options]
   * @constructor
   */
  function ZoomButton( options ) {

    options = merge( {
      in: true, // true: zoom-in button, false: zoom-out button
      radius: 15,
      baseColor: PhetColorScheme.BUTTON_YELLOW,
      magnifyingGlassFill: 'white', // center of the glass
      magnifyingGlassStroke: 'black', // rim and handle
      tandem: Tandem.REQUIRED
    }, options );

    // the magnifying glass
    const glassLineWidth = 0.25 * options.radius;
    const glassNode = new Circle( options.radius, {
      fill: options.magnifyingGlassFill,
      stroke: options.magnifyingGlassStroke,
      lineWidth: glassLineWidth
    } );

    // handle at lower-left of glass, at a 45-degree angle
    const outsideRadius = options.radius + ( glassLineWidth / 2 ); // use outside radius so handle line cap doesn't appear inside glassNode
    const handleNode = new Line(
      outsideRadius * Math.cos( Math.PI / 4 ), outsideRadius * Math.sin( Math.PI / 4 ),
      options.radius * Math.cos( Math.PI / 4 ) + ( 0.65 * options.radius ), options.radius * Math.sin( Math.PI / 4 ) + ( 0.65 * options.radius ), {
        stroke: options.magnifyingGlassStroke,
        lineWidth: 0.4 * options.radius,
        lineCap: 'round'
      } );

    // plus or minus sign in middle of magnifying glass
    const signOptions = {
      size: new Dimension2( 1.3 * options.radius, options.radius / 3 ),
      centerX: glassNode.centerX,
      centerY: glassNode.centerY
    };
    const signNode = options.in ? new PlusNode( signOptions ) : new MinusNode( signOptions );

    options.content = new Node( { children: [ handleNode, glassNode, signNode ] } );

    RectangularPushButton.call( this, 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', 'ZoomButton', this );
  }

  sceneryPhet.register( 'ZoomButton', ZoomButton );

  return inherit( RectangularPushButton, ZoomButton );
} );
{'fraction_non_alphanumeric': 0.1167212092878292, 'fraction_numerical': 0.011064360292971793, 'mean_word_length': 3.327714093054619, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1426754', 'n_tokens_mistral': 2064, 'n_tokens_neox': 1965, 'n_words': 547}