-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mixin => mixInto() and trait (with added assertions). See #700
- Loading branch information
1 parent
3c1d5db
commit cd4a415
Showing
57 changed files
with
200 additions
and
157 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
// Copyright 2013-2016, University of Colorado Boulder | ||
|
||
/** | ||
* Handles SVG <defs> and fill/stroke style for SVG elements (by composition, not a mix-in or for inheritance). | ||
* Handles SVG <defs> and fill/stroke style for SVG elements (by composition, not a trait or for inheritance). | ||
* | ||
* @author Jonathan Olson <[email protected]> | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,23 @@ | ||
// Copyright 2016, University of Colorado Boulder | ||
|
||
/** | ||
* A mixin to drawables for Circle that need to store state about what the current display is currently showing, | ||
* A trait for drawables for Circle that need to store state about what the current display is currently showing, | ||
* so that updates to the Circle will only be made on attributes that specifically changed (and no change will be | ||
* necessary for an attribute that changed back to its original/currently-displayed value). Generally, this is used | ||
* for DOM and SVG drawables. | ||
* | ||
* This mixin assumes the PaintableStateful mixin is also mixed (always the case for Circle stateful drawables). | ||
* This trait assumes the PaintableStateful trait is also mixed (always the case for Circle stateful drawables). | ||
* | ||
* @author Jonathan Olson <[email protected]> | ||
*/ | ||
|
||
define( function( require ) { | ||
'use strict'; | ||
|
||
var inheritance = require( 'PHET_CORE/inheritance' ); | ||
var PaintableStatefulDrawable = require( 'SCENERY/display/drawables/PaintableStatefulDrawable' ); | ||
var scenery = require( 'SCENERY/scenery' ); | ||
var SelfDrawable = require( 'SCENERY/display/SelfDrawable' ); | ||
|
||
var CircleStatefulDrawable = { | ||
/** | ||
|
@@ -32,11 +34,13 @@ define( function( require ) { | |
* | ||
* @param {function} drawableType - The constructor for the drawable type | ||
*/ | ||
mixin: function( drawableType ) { | ||
mixInto: function( drawableType ) { | ||
assert && assert( _.includes( inheritance( drawableType ), SelfDrawable ) ); | ||
|
||
var proto = drawableType.prototype; | ||
|
||
/** | ||
* Initializes the stateful mixin state, starting its "lifetime" until it is disposed with disposeState(). | ||
* Initializes the stateful trait state, starting its "lifetime" until it is disposed with disposeState(). | ||
* @protected | ||
* | ||
* @param {number} renderer - Renderer bitmask, see Renderer's documentation for more details. | ||
|
@@ -58,7 +62,7 @@ define( function( require ) { | |
}; | ||
|
||
/** | ||
* Disposes the stateful mixin state, so it can be put into the pool to be initialized again. | ||
* Disposes the stateful trait state, so it can be put into the pool to be initialized again. | ||
* @protected | ||
*/ | ||
proto.disposeState = function() { | ||
|
@@ -96,7 +100,7 @@ define( function( require ) { | |
this.dirtyRadius = false; | ||
}; | ||
|
||
PaintableStatefulDrawable.mixin( drawableType ); | ||
PaintableStatefulDrawable.mixInto( drawableType ); | ||
} | ||
}; | ||
|
||
|
Oops, something went wrong.