From 21d09b12ab4b5a9aa60c9f6f171bc28cc6482c41 Mon Sep 17 00:00:00 2001 From: Jonathan Olson Date: Fri, 20 Sep 2019 08:39:30 -0600 Subject: [PATCH] Safari workaround for radial gradient issue, see https://github.com/phetsims/sun/issues/526 --- js/util/RadialGradient.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/js/util/RadialGradient.js b/js/util/RadialGradient.js index 7e2177e2e..2b7952ff2 100644 --- a/js/util/RadialGradient.js +++ b/js/util/RadialGradient.js @@ -13,6 +13,7 @@ define( function( require ) { var Gradient = require( 'SCENERY/util/Gradient' ); var inherit = require( 'PHET_CORE/inherit' ); + var platform = require( 'PHET_CORE/platform' ); var scenery = require( 'SCENERY/scenery' ); var SVGRadialGradient = require( 'SCENERY/display/SVGRadialGradient' ); var Vector2 = require( 'DOT/Vector2' ); @@ -37,6 +38,17 @@ define( function( require ) { this.start = new Vector2( x0, y0 ); this.end = new Vector2( x1, y1 ); + // If we are using Safari, we need to work around incorrect gradient handling for now, + // see https://github.com/phetsims/sun/issues/526 + if ( platform.safari ) { + var x = ( x0 + x1 ) / 2; + var y = ( y0 + y1 ) / 2; + this.start.x = x; + this.start.y = y; + this.end.x = x; + this.end.y = y; + } + // @public {number} this.startRadius = r0; this.endRadius = r1;