From 2493d0c8d94731f6fb21d6578151a5b78e11eec7 Mon Sep 17 00:00:00 2001 From: zepumph Date: Thu, 17 Oct 2019 14:35:20 -0800 Subject: [PATCH] convert _.extend to PHET_CORE/merge, https://github.com/phetsims/phet-core/issues/71 --- js/common/model/Capacitor.js | 5 +++-- js/common/model/CircuitConfig.js | 3 ++- js/common/view/HingePointNode.js | 5 +++-- js/common/view/control/CLBViewControlPanel.js | 3 ++- js/common/view/control/VoltmeterToolboxPanel.js | 3 ++- js/common/view/drag/DragHandleValueNode.js | 3 ++- 6 files changed, 14 insertions(+), 8 deletions(-) diff --git a/js/common/model/Capacitor.js b/js/common/model/Capacitor.js index ee6f2c24..1fc42799 100644 --- a/js/common/model/Capacitor.js +++ b/js/common/model/Capacitor.js @@ -25,14 +25,15 @@ define( require => { const Bounds3 = require( 'DOT/Bounds3' ); const Bounds3IO = require( 'DOT/Bounds3IO' ); const BoxShapeCreator = require( 'SCENERY_PHET/capacitor/BoxShapeCreator' ); - const capacitorLabBasics = require( 'CAPACITOR_LAB_BASICS/capacitorLabBasics' ); const CapacitorConstants = require( 'SCENERY_PHET/capacitor/CapacitorConstants' ); + const capacitorLabBasics = require( 'CAPACITOR_LAB_BASICS/capacitorLabBasics' ); const CircuitLocation = require( 'CAPACITOR_LAB_BASICS/common/model/CircuitLocation' ); const CircuitSwitch = require( 'CAPACITOR_LAB_BASICS/common/model/CircuitSwitch' ); const CLBConstants = require( 'CAPACITOR_LAB_BASICS/common/CLBConstants' ); const DerivedProperty = require( 'AXON/DerivedProperty' ); const DerivedPropertyIO = require( 'AXON/DerivedPropertyIO' ); const inherit = require( 'PHET_CORE/inherit' ); + const merge = require( 'PHET_CORE/merge' ); const NumberIO = require( 'TANDEM/types/NumberIO' ); const NumberProperty = require( 'AXON/NumberProperty' ); const Property = require( 'AXON/Property' ); @@ -50,7 +51,7 @@ define( require => { function Capacitor( config, circuitConnectionProperty, tandem, options ) { // options that populate the capacitor with various geometric properties - options = _.extend( { + options = merge( { plateWidth: CapacitorConstants.PLATE_WIDTH_RANGE.defaultValue, plateSeparation: CapacitorConstants.PLATE_SEPARATION_RANGE.defaultValue }, options ); diff --git a/js/common/model/CircuitConfig.js b/js/common/model/CircuitConfig.js index dfb2c678..082fc88a 100644 --- a/js/common/model/CircuitConfig.js +++ b/js/common/model/CircuitConfig.js @@ -15,6 +15,7 @@ define( require => { const CapacitorConstants = require( 'SCENERY_PHET/capacitor/CapacitorConstants' ); const capacitorLabBasics = require( 'CAPACITOR_LAB_BASICS/capacitorLabBasics' ); const CircuitState = require( 'CAPACITOR_LAB_BASICS/common/model/CircuitState' ); + const merge = require( 'PHET_CORE/merge' ); const YawPitchModelViewTransform3 = require( 'SCENERY_PHET/capacitor/YawPitchModelViewTransform3' ); // Constants with default assignments @@ -35,7 +36,7 @@ define( require => { */ create: function( options ) { - return _.extend( { + return merge( { modelViewTransform: new YawPitchModelViewTransform3(), capacitorXSpacing: CAPACITOR_X_SPACING, capacitorYSpacing: CAPACITOR_Y_SPACING, diff --git a/js/common/view/HingePointNode.js b/js/common/view/HingePointNode.js index 2397421e..67b46532 100644 --- a/js/common/view/HingePointNode.js +++ b/js/common/view/HingePointNode.js @@ -14,6 +14,7 @@ define( require => { const Circle = require( 'SCENERY/nodes/Circle' ); const CLBConstants = require( 'CAPACITOR_LAB_BASICS/common/CLBConstants' ); const inherit = require( 'PHET_CORE/inherit' ); + const merge = require( 'PHET_CORE/merge' ); // constants const HINGE_POINT_RADIUS = 8; @@ -26,13 +27,13 @@ define( require => { */ function HingePointNode( options ) { - options = _.extend( { + options = merge( { fill: CLBConstants.CONNECTION_POINT_COLOR, lineWidth: 3, stroke: CLBConstants.CONNECTION_POINT_COLOR, innerPinRadius: PIN_RADIUS, pinFillColor: CLBConstants.PIN_COLOR - } ); + }, options ); Circle.call( this, HINGE_POINT_RADIUS, options ); // Inner circle of hings diff --git a/js/common/view/control/CLBViewControlPanel.js b/js/common/view/control/CLBViewControlPanel.js index 9e50dbc0..d1643ace 100644 --- a/js/common/view/control/CLBViewControlPanel.js +++ b/js/common/view/control/CLBViewControlPanel.js @@ -16,6 +16,7 @@ define( require => { const capacitorLabBasics = require( 'CAPACITOR_LAB_BASICS/capacitorLabBasics' ); const CLBConstants = require( 'CAPACITOR_LAB_BASICS/common/CLBConstants' ); const inherit = require( 'PHET_CORE/inherit' ); + const merge = require( 'PHET_CORE/merge' ); const Node = require( 'SCENERY/nodes/Node' ); const Panel = require( 'SUN/Panel' ); const PhetFont = require( 'SCENERY_PHET/PhetFont' ); @@ -44,7 +45,7 @@ define( require => { */ function CLBViewControlPanel( model, tandem, options ) { - options = _.extend( { + options = merge( { maxTextWidth: 250, alignGroup:null }, options ); diff --git a/js/common/view/control/VoltmeterToolboxPanel.js b/js/common/view/control/VoltmeterToolboxPanel.js index c4e649d0..b01c5da6 100644 --- a/js/common/view/control/VoltmeterToolboxPanel.js +++ b/js/common/view/control/VoltmeterToolboxPanel.js @@ -17,6 +17,7 @@ define( require => { const EventType = require( 'TANDEM/EventType' ); const HBox = require( 'SCENERY/nodes/HBox' ); const inherit = require( 'PHET_CORE/inherit' ); + const merge = require( 'PHET_CORE/merge' ); const Node = require( 'SCENERY/nodes/Node' ); const NumberProperty = require( 'AXON/NumberProperty' ); const Panel = require( 'SUN/Panel' ); @@ -41,7 +42,7 @@ define( require => { */ function VoltmeterToolboxPanel( dragBounds, timerNode, voltmeterNode, modelViewTransform, isDraggedProperty, timerVisibleProperty, voltmeterVisibleProperty, tandem, options ) { - options = _.extend( { + options = merge( { includeTimer: true, alignGroup: null }, options ); diff --git a/js/common/view/drag/DragHandleValueNode.js b/js/common/view/drag/DragHandleValueNode.js index ebca8b38..b7c10ef1 100644 --- a/js/common/view/drag/DragHandleValueNode.js +++ b/js/common/view/drag/DragHandleValueNode.js @@ -13,6 +13,7 @@ define( require => { // modules const capacitorLabBasics = require( 'CAPACITOR_LAB_BASICS/capacitorLabBasics' ); const inherit = require( 'PHET_CORE/inherit' ); + const merge = require( 'PHET_CORE/merge' ); const Node = require( 'SCENERY/nodes/Node' ); const PhetFont = require( 'SCENERY_PHET/PhetFont' ); const RichText = require( 'SCENERY/nodes/RichText' ); @@ -40,7 +41,7 @@ define( require => { */ function DragHandleValueNode( label, value, unitsPattern, options ) { - options = _.extend( { tandem: Tandem.optional }, options ); + options = merge( { tandem: Tandem.optional }, options ); Node.call( this );