Skip to content

Commit

Permalink
Safari workaround for radial gradient issue, see phetsims/sun#526
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanolson committed Sep 23, 2019
1 parent 1dbb7f5 commit 21d09b1
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions js/util/RadialGradient.js
Original file line number Diff line number Diff line change
Expand Up @@ -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' );
Expand All @@ -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;
Expand Down

0 comments on commit 21d09b1

Please sign in to comment.