Skip to content

Commit

Permalink
Only set PhetioObject fields for instrumented PhetioObjects in PhET-i…
Browse files Browse the repository at this point in the history
  • Loading branch information
zepumph committed Nov 11, 2020
1 parent f259087 commit 4879f62
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion js/nodes/Node.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ import inherit from '../../../phet-core/js/inherit.js';
import merge from '../../../phet-core/js/merge.js';
import platform from '../../../phet-core/js/platform.js';
import PhetioObject from '../../../tandem/js/PhetioObject.js';
import Tandem from '../../../tandem/js/Tandem.js';
import BooleanIO from '../../../tandem/js/types/BooleanIO.js';
import IOType from '../../../tandem/js/types/IOType.js';
import NullableIO from '../../../tandem/js/types/NullableIO.js';
Expand Down Expand Up @@ -5503,7 +5504,7 @@ inherit( PhetioObject, Node, {

PhetioObject.prototype.initializePhetioObject.call( this, baseOptions, config );

if ( !wasInstrumented && this.isPhetioInstrumented() ) {
if ( Tandem.PHET_IO_ENABLED && !wasInstrumented && this.isPhetioInstrumented() ) {

// For each supported TinyForwardingProperty, if a Property was already specified in the options (in the
// constructor or mutate), then it will be set as this.targetProperty there. Here we only create the default
Expand Down
2 changes: 1 addition & 1 deletion js/nodes/RichText.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ class RichText extends Node {

super.initializePhetioObject( baseOptions, config );

if ( !wasInstrumented && this.isPhetioInstrumented() ) {
if ( Tandem.PHET_IO_ENABLED && !wasInstrumented && this.isPhetioInstrumented() ) {

this._textProperty.initializePhetio( this, TEXT_PROPERTY_TANDEM_NAME, () => new StringProperty( this.text, merge( {

Expand Down
2 changes: 1 addition & 1 deletion js/nodes/Text.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ inherit( Node, Text, {

Node.prototype.initializePhetioObject.call( this, baseOptions, config );

if ( !wasInstrumented && this.isPhetioInstrumented() ) {
if ( Tandem.PHET_IO_ENABLED && !wasInstrumented && this.isPhetioInstrumented() ) {
this._textProperty.initializePhetio( this, TEXT_PROPERTY_TANDEM_NAME, () => new StringProperty( this.text, merge( {

// by default, use the value from the Node
Expand Down

0 comments on commit 4879f62

Please sign in to comment.