From 349dae868693ecda80272bd091e1a61d76536d46 Mon Sep 17 00:00:00 2001 From: samreid Date: Tue, 13 Jun 2017 09:58:12 -0600 Subject: [PATCH] Use cornerRadius, see https://github.com/phetsims/circuit-construction-kit-common/issues/317 --- js/view/AmmeterNode.js | 3 ++- js/view/ProbeTextNode.js | 7 +++++-- js/view/SeriesAmmeterNode.js | 11 +++++++---- js/view/SwitchNode.js | 5 ++--- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/js/view/AmmeterNode.js b/js/view/AmmeterNode.js index b455d202..6adf30e2 100644 --- a/js/view/AmmeterNode.js +++ b/js/view/AmmeterNode.js @@ -102,7 +102,8 @@ define( function( require ) { // Add a decoration on the handle to match the color scheme children: [ - new Rectangle( 0, 52, HANDLE_WIDTH * 0.72, 19, 6, 6, { + new Rectangle( 0, 52, HANDLE_WIDTH * 0.72, 19, { + cornerRadius: 6, centerX: 0, fill: '#e79547' // Match the orange of the ammeter image } ) diff --git a/js/view/ProbeTextNode.js b/js/view/ProbeTextNode.js index b110fc4c..30bd5071 100644 --- a/js/view/ProbeTextNode.js +++ b/js/view/ProbeTextNode.js @@ -43,8 +43,11 @@ define( function( require ) { tandem: tandem.createTandem( 'readoutText' ) } ); - var textBox = new Rectangle( 0, 0, TEXT_BOX_WIDTH, 52, 10, 10, { - lineWidth: 2, stroke: 'black', fill: 'white' + var textBox = new Rectangle( 0, 0, TEXT_BOX_WIDTH, 52, { + cornerRadius: 10, + lineWidth: 2, + stroke: 'black', + fill: 'white' } ); textProperty.link( function( text ) { diff --git a/js/view/SeriesAmmeterNode.js b/js/view/SeriesAmmeterNode.js index 1f9d9034..a831eef8 100644 --- a/js/view/SeriesAmmeterNode.js +++ b/js/view/SeriesAmmeterNode.js @@ -20,7 +20,7 @@ define( function( require ) { var Panel = require( 'SUN/Panel' ); var CircuitConstructionKitConstants = require( 'CIRCUIT_CONSTRUCTION_KIT_COMMON/CircuitConstructionKitConstants' ); var CircuitConstructionKitCommonUtil = require( 'CIRCUIT_CONSTRUCTION_KIT_COMMON/CircuitConstructionKitCommonUtil' ); - + // strings var currentString = require( 'string!CIRCUIT_CONSTRUCTION_KIT_COMMON/current' ); var ampereUnitsString = require( 'string!CIRCUIT_CONSTRUCTION_KIT_COMMON/ampereUnits' ); @@ -30,6 +30,7 @@ define( function( require ) { var PANEL_WIDTH = CircuitConstructionKitConstants.SERIES_AMMETER_LENGTH; var ORANGE = '#f39033'; var WIDEST_LABEL = '99.99 A'; + var CORNER_RADIUS = 4; /** * @param {CircuitConstructionKitScreenView} circuitConstructionKitScreenView @@ -79,7 +80,8 @@ define( function( require ) { var readoutPanel = new Panel( new VBox( { children: [ new Text( currentString, { fontSize: 12, maxWidth: 54 } ), - new Rectangle( 0, 0, maxWidth + textPanelMarginX * 2, maxHeight + textPanelMarginY * 2, 4, 4, { + new Rectangle( 0, 0, maxWidth + textPanelMarginX * 2, maxHeight + textPanelMarginY * 2, { + cornerRadius: 4, stroke: 'black', fill: 'white', lineWidth: 0.75, @@ -103,7 +105,7 @@ define( function( require ) { * @returns {Rectangle} */ var createPanel = function( options ) { - return new Rectangle( 0, 0, PANEL_WIDTH, PANEL_HEIGHT, 4, 4, options ); + return new Rectangle( 0, 0, PANEL_WIDTH, PANEL_HEIGHT, options ); }; // This node only has a lifelike representation because it is a sensor @@ -111,7 +113,7 @@ define( function( require ) { children: [ // orange background panel - createPanel( { fill: ORANGE } ), + createPanel( { cornerRadius: CORNER_RADIUS, fill: ORANGE } ), // gray track new Rectangle( 0, 0, PANEL_WIDTH, 20, { @@ -121,6 +123,7 @@ define( function( require ) { // black border createPanel( { + cornerRadius: CORNER_RADIUS, stroke: '#231f20', lineWidth: 2.4 } ) diff --git a/js/view/SwitchNode.js b/js/view/SwitchNode.js index 991417ca..85f8b22a 100644 --- a/js/view/SwitchNode.js +++ b/js/view/SwitchNode.js @@ -54,9 +54,8 @@ define( function( require ) { var leftSegmentNode = new Rectangle( 0, -thickness / 2, CircuitConstructionKitConstants.SWITCH_LENGTH * SWITCH_START, - thickness, - edgeRadius, - edgeRadius, { + thickness, { + cornerRadius: edgeRadius, fill: fill, stroke: 'black', lineWidth: 1