From cad1d0331c1062d6f84a0d74fe63f04ed1d6d634 Mon Sep 17 00:00:00 2001 From: pixelzoom Date: Wed, 5 Jul 2023 13:32:33 -0600 Subject: [PATCH] use isDisposable:false where appropriate, https://github.com/phetsims/axon/issues/436 --- js/common/model/BaseVector.ts | 9 ++------- js/common/model/SumVector.ts | 9 ++------- js/common/view/ComponentStyleControl.ts | 9 ++------- js/common/view/ComponentStyleRadioButtonGroup.ts | 9 ++------- js/common/view/CoordinateSnapRadioButtonGroup.ts | 14 +++++--------- js/common/view/GraphControlPanel.ts | 14 +++++--------- js/common/view/GraphNode.ts | 9 ++------- js/common/view/OriginManipulator.ts | 9 ++------- js/common/view/RootVectorNode.ts | 11 +++++------ js/common/view/SceneNode.ts | 11 ++++------- js/common/view/SumComponentVectorNode.ts | 6 ------ js/common/view/SumVectorNode.ts | 6 ------ js/common/view/ToggleBox.ts | 2 +- js/common/view/VectorAdditionScreenView.ts | 7 +------ js/common/view/VectorCreatorPanel.ts | 9 ++------- js/common/view/VectorCreatorPanelSlot.ts | 11 ++++------- js/common/view/VectorSetNode.ts | 9 ++------- js/common/view/VectorValuesNumberDisplay.ts | 9 ++------- js/common/view/VectorValuesToggleBox.ts | 9 ++------- js/equations/model/EquationsVector.ts | 6 ------ js/equations/view/BaseVectorsAccordionBox.ts | 9 ++------- js/equations/view/EquationToggleBox.ts | 9 ++------- js/equations/view/EquationTypesRadioButtonGroup.ts | 9 ++------- .../view/GraphOrientationRadioButtonGroup.ts | 14 +++++--------- 24 files changed, 56 insertions(+), 163 deletions(-) diff --git a/js/common/model/BaseVector.ts b/js/common/model/BaseVector.ts index 141657ea..e8697378 100644 --- a/js/common/model/BaseVector.ts +++ b/js/common/model/BaseVector.ts @@ -14,13 +14,13 @@ import Vector from './Vector.js'; import Graph from './Graph.js'; import VectorSet from './VectorSet.js'; import Vector2 from '../../../../dot/js/Vector2.js'; -import Disposable from '../../../../axon/js/Disposable.js'; // constants const OPTIONS = { isRemovable: false, // BaseVectors are not removable isTipDraggable: false, // BaseVectors are not draggable by the tip - isOnGraphInitially: true // BaseVectors are always on the graph + isOnGraphInitially: true, // BaseVectors are always on the graph + isDisposable: false }; export default abstract class BaseVector extends Vector { @@ -37,11 +37,6 @@ export default abstract class BaseVector extends Vector { super( initialTailPosition, initialComponents, graph, vectorSet, symbol, OPTIONS ); } - - public override dispose(): void { - Disposable.assertNotDisposable(); - super.dispose(); - } } vectorAddition.register( 'BaseVector', BaseVector ); \ No newline at end of file diff --git a/js/common/model/SumVector.ts b/js/common/model/SumVector.ts index 66aa0ae7..bdb8924a 100644 --- a/js/common/model/SumVector.ts +++ b/js/common/model/SumVector.ts @@ -24,13 +24,13 @@ import VectorSet from './VectorSet.js'; import Property from '../../../../axon/js/Property.js'; import { ObservableArray } from '../../../../axon/js/createObservableArray.js'; import { LabelDisplayData } from './RootVector.js'; -import Disposable from '../../../../axon/js/Disposable.js'; // constants const SUM_VECTOR_OPTIONS = { isTipDraggable: false, // Sum vectors are not draggable by the tip. isRemovable: false, // Sum vectors are not removable which means they are also not disposable - isOnGraphInitially: true // Sum vectors are always on the graph + isOnGraphInitially: true, // Sum vectors are always on the graph + isDisposable: false }; export default class SumVector extends Vector { @@ -78,11 +78,6 @@ export default class SumVector extends Vector { } ); } - public override dispose(): void { - Disposable.assertNotDisposable(); - super.dispose(); - } - /** * Update the sum vector components. Calculated from all the vectors that are on the graph. */ diff --git a/js/common/view/ComponentStyleControl.ts b/js/common/view/ComponentStyleControl.ts index 891f2c3c..534f3899 100644 --- a/js/common/view/ComponentStyleControl.ts +++ b/js/common/view/ComponentStyleControl.ts @@ -16,7 +16,6 @@ import VectorAdditionStrings from '../../VectorAdditionStrings.js'; import ComponentVectorStyles from '../model/ComponentVectorStyles.js'; import VectorAdditionConstants from '../VectorAdditionConstants.js'; import ComponentStyleRadioButtonGroup from './ComponentStyleRadioButtonGroup.js'; -import Disposable from '../../../../axon/js/Disposable.js'; const MAX_WIDTH = VectorAdditionConstants.GRAPH_CONTROL_PANEL_CONTENT_WIDTH; @@ -44,14 +43,10 @@ export default class ComponentStyleControl extends VBox { // VBoxOptions children: children, align: 'left', - spacing: VectorAdditionConstants.GRAPH_CONTROL_PANEL_Y_SPACING + spacing: VectorAdditionConstants.GRAPH_CONTROL_PANEL_Y_SPACING, + isDisposable: false } ); } - - public override dispose(): void { - Disposable.assertNotDisposable(); - super.dispose(); - } } vectorAddition.register( 'ComponentStyleControl', ComponentStyleControl ); \ No newline at end of file diff --git a/js/common/view/ComponentStyleRadioButtonGroup.ts b/js/common/view/ComponentStyleRadioButtonGroup.ts index 8470e7be..bb6e0f40 100644 --- a/js/common/view/ComponentStyleRadioButtonGroup.ts +++ b/js/common/view/ComponentStyleRadioButtonGroup.ts @@ -18,7 +18,6 @@ import ComponentVectorStyles from '../model/ComponentVectorStyles.js'; import VectorAdditionConstants from '../VectorAdditionConstants.js'; import GridBox from './GridBox.js'; import VectorAdditionIconFactory from './VectorAdditionIconFactory.js'; -import Disposable from '../../../../axon/js/Disposable.js'; export default class ComponentStyleRadioButtonGroup extends Node { @@ -39,14 +38,10 @@ export default class ComponentStyleRadioButtonGroup extends Node { } ); super( { - children: [ gridBox ] + children: [ gridBox ], + isDisposable: false } ); } - - public override dispose(): void { - Disposable.assertNotDisposable(); - super.dispose(); - } } vectorAddition.register( 'ComponentStyleRadioButtonGroup', ComponentStyleRadioButtonGroup ); \ No newline at end of file diff --git a/js/common/view/CoordinateSnapRadioButtonGroup.ts b/js/common/view/CoordinateSnapRadioButtonGroup.ts index 78e3af88..0ff293a8 100644 --- a/js/common/view/CoordinateSnapRadioButtonGroup.ts +++ b/js/common/view/CoordinateSnapRadioButtonGroup.ts @@ -16,9 +16,8 @@ import CoordinateSnapModes from '../model/CoordinateSnapModes.js'; import VectorColorPalette from '../model/VectorColorPalette.js'; import VectorAdditionConstants from '../VectorAdditionConstants.js'; import VectorAdditionIconFactory from './VectorAdditionIconFactory.js'; -import { EmptySelfOptions, optionize3 } from '../../../../phet-core/js/optionize.js'; +import { EmptySelfOptions, optionize4 } from '../../../../phet-core/js/optionize.js'; import { NodeTranslationOptions } from '../../../../scenery/js/imports.js'; -import Disposable from '../../../../axon/js/Disposable.js'; type SelfOptions = EmptySelfOptions; @@ -31,8 +30,10 @@ export default class CoordinateSnapRadioButtonGroup extends RectangularRadioButt polarVectorColorPalette: VectorColorPalette, providedOptions?: CoordinateSnapRadioButtonGroupOptions ) { - const options = optionize3()( - {}, VectorAdditionConstants.RADIO_BUTTON_GROUP_OPTIONS, providedOptions ); + const options = optionize4()( + {}, VectorAdditionConstants.RADIO_BUTTON_GROUP_OPTIONS, { + isDisposable: false + }, providedOptions ); // Create the description of the buttons const items: RectangularRadioButtonGroupItem[] = [ @@ -48,11 +49,6 @@ export default class CoordinateSnapRadioButtonGroup extends RectangularRadioButt super( coordinateSnapModeProperty, items, options ); } - - public override dispose(): void { - Disposable.assertNotDisposable(); - super.dispose(); - } } vectorAddition.register( 'CoordinateSnapRadioButtonGroup', CoordinateSnapRadioButtonGroup ); \ No newline at end of file diff --git a/js/common/view/GraphControlPanel.ts b/js/common/view/GraphControlPanel.ts index 901a6826..df8ca939 100644 --- a/js/common/view/GraphControlPanel.ts +++ b/js/common/view/GraphControlPanel.ts @@ -11,8 +11,7 @@ import { Node, NodeTranslationOptions, VBox } from '../../../../scenery/js/impor import Panel, { PanelOptions } from '../../../../sun/js/Panel.js'; import vectorAddition from '../../vectorAddition.js'; import VectorAdditionConstants from '../VectorAdditionConstants.js'; -import { EmptySelfOptions, optionize3 } from '../../../../phet-core/js/optionize.js'; -import Disposable from '../../../../axon/js/Disposable.js'; +import { EmptySelfOptions, optionize4 } from '../../../../phet-core/js/optionize.js'; type SelfOptions = EmptySelfOptions; @@ -22,8 +21,10 @@ export default class GraphControlPanel extends Panel { protected constructor( children: Node[], providedOptions?: GraphControlPanelOptions ) { - const options = optionize3()( - {}, VectorAdditionConstants.PANEL_OPTIONS, providedOptions ); + const options = optionize4()( + {}, VectorAdditionConstants.PANEL_OPTIONS, { + isDisposable: false + }, providedOptions ); const content = new VBox( { children: children, @@ -38,11 +39,6 @@ export default class GraphControlPanel extends Panel { super( content, options ); } - - public override dispose(): void { - Disposable.assertNotDisposable(); - super.dispose(); - } } vectorAddition.register( 'GraphControlPanel', GraphControlPanel ); \ No newline at end of file diff --git a/js/common/view/GraphNode.ts b/js/common/view/GraphNode.ts index 7df410ec..43f87b35 100644 --- a/js/common/view/GraphNode.ts +++ b/js/common/view/GraphNode.ts @@ -22,7 +22,6 @@ import Property from '../../../../axon/js/Property.js'; import Bounds2 from '../../../../dot/js/Bounds2.js'; import PickOptional from '../../../../phet-core/js/types/PickOptional.js'; import optionize from '../../../../phet-core/js/optionize.js'; -import Disposable from '../../../../axon/js/Disposable.js'; //---------------------------------------------------------------------------------------- // constants @@ -84,7 +83,8 @@ export default class GraphNode extends Node { children.push( new OriginManipulator( graph ) ); super( { - children: children + children: children, + isDisposable: false } ); // Clicking in the graph clears the active (selected) vector. @@ -95,11 +95,6 @@ export default class GraphNode extends Node { down: () => { graph.activeVectorProperty.value = null; } } ); } - - public override dispose(): void { - Disposable.assertNotDisposable(); - super.dispose(); - } } /** diff --git a/js/common/view/OriginManipulator.ts b/js/common/view/OriginManipulator.ts index 180ce818..bdeeef0e 100644 --- a/js/common/view/OriginManipulator.ts +++ b/js/common/view/OriginManipulator.ts @@ -16,7 +16,6 @@ import { Color, DragListener } from '../../../../scenery/js/imports.js'; import vectorAddition from '../../vectorAddition.js'; import Graph from '../model/Graph.js'; import VectorAdditionColors from '../VectorAdditionColors.js'; -import Disposable from '../../../../axon/js/Disposable.js'; // constants @@ -33,7 +32,8 @@ const ORIGIN_OPTIONS = { highlightColor: Color.WHITE, shadowColor: ORIGIN_COLOR.darkerColor(), lineWidth: 1, - stroke: ORIGIN_COLOR.darkerColor() + stroke: ORIGIN_COLOR.darkerColor(), + isDisposable: false }; export default class OriginManipulator extends ShadedSphereNode { @@ -82,11 +82,6 @@ export default class OriginManipulator extends ShadedSphereNode { this.center = modelViewTransform.modelToViewPosition( Vector2.ZERO ); } ); } - - public override dispose(): void { - Disposable.assertNotDisposable(); - super.dispose(); - } } vectorAddition.register( 'OriginManipulator', OriginManipulator ); \ No newline at end of file diff --git a/js/common/view/RootVectorNode.ts b/js/common/view/RootVectorNode.ts index c91303b0..d83faad8 100644 --- a/js/common/view/RootVectorNode.ts +++ b/js/common/view/RootVectorNode.ts @@ -65,7 +65,11 @@ export default class RootVectorNode extends Node { arrowType: 'solid', arrowOptions: { cursor: 'move' - } + }, + + // NodeOptions + isDisposable: false + }, providedOptions ); //---------------------------------------------------------------------------------------- @@ -113,11 +117,6 @@ export default class RootVectorNode extends Node { }; } - public override dispose(): void { - this.disposeRootVectorNode(); - super.dispose(); - } - /** * Updates the tail and tip position of the view. Called when the model changes tail/tip. */ diff --git a/js/common/view/SceneNode.ts b/js/common/view/SceneNode.ts index 4e3ce034..6b0131fc 100644 --- a/js/common/view/SceneNode.ts +++ b/js/common/view/SceneNode.ts @@ -41,7 +41,6 @@ import ComponentVectorStyles from '../model/ComponentVectorStyles.js'; import optionize from '../../../../phet-core/js/optionize.js'; import Property from '../../../../axon/js/Property.js'; import BaseVector from '../model/BaseVector.js'; -import Disposable from '../../../../axon/js/Disposable.js'; type SelfOptions = { includeEraser?: boolean; // Indicates if an EraserButton should be included @@ -70,7 +69,10 @@ export default class SceneNode extends Node { const options = optionize()( { // SelfOptions - includeEraser: true + includeEraser: true, + + // NodeOptions + isDisposable: false }, providedOptions ); super(); @@ -140,11 +142,6 @@ export default class SceneNode extends Node { this.vectorSets = graph.vectorSets; } - public override dispose(): void { - Disposable.assertNotDisposable(); - super.dispose(); - } - /** * Gets the VectorSetNode associated with a VectorSet. */ diff --git a/js/common/view/SumComponentVectorNode.ts b/js/common/view/SumComponentVectorNode.ts index 9131ad76..9f26e79d 100644 --- a/js/common/view/SumComponentVectorNode.ts +++ b/js/common/view/SumComponentVectorNode.ts @@ -24,7 +24,6 @@ import optionize, { EmptySelfOptions } from '../../../../phet-core/js/optionize. import ComponentVector from '../model/ComponentVector.js'; import ModelViewTransform2 from '../../../../phetcommon/js/view/ModelViewTransform2.js'; import SumVector from '../model/SumVector.js'; -import Disposable from '../../../../axon/js/Disposable.js'; type SelfOptions = EmptySelfOptions; type SumComponentVectorNodeOptions = SelfOptions & ComponentVectorNodeOptions; @@ -66,11 +65,6 @@ export default class SumComponentVectorNode extends ComponentVectorNode { ); } - public override dispose(): void { - Disposable.assertNotDisposable(); - super.dispose(); - } - /** * Handles visibility of sum component vectors. */ diff --git a/js/common/view/SumVectorNode.ts b/js/common/view/SumVectorNode.ts index aa4a74c7..406d4b52 100644 --- a/js/common/view/SumVectorNode.ts +++ b/js/common/view/SumVectorNode.ts @@ -20,7 +20,6 @@ import VectorNode, { VectorNodeOptions } from './VectorNode.js'; import TReadOnlyProperty from '../../../../axon/js/TReadOnlyProperty.js'; import optionize, { combineOptions, EmptySelfOptions } from '../../../../phet-core/js/optionize.js'; import { RootVectorArrowNodeOptions } from './RootVectorNode.js'; -import Disposable from '../../../../axon/js/Disposable.js'; type SelfOptions = EmptySelfOptions; type SumVectorNodeOptions = SelfOptions & VectorNodeOptions; @@ -75,11 +74,6 @@ export default class SumVectorNode extends VectorNode { } } ); } - - public override dispose(): void { - Disposable.assertNotDisposable(); - super.dispose(); - } } vectorAddition.register( 'SumVectorNode', SumVectorNode ); \ No newline at end of file diff --git a/js/common/view/ToggleBox.ts b/js/common/view/ToggleBox.ts index f9666ef5..83dd471e 100644 --- a/js/common/view/ToggleBox.ts +++ b/js/common/view/ToggleBox.ts @@ -35,7 +35,7 @@ type SelfOptions = { }; export type ToggleBoxOptions = SelfOptions & NodeTranslationOptions & - PickOptional; + PickOptional; export default class ToggleBox extends AccordionBox { diff --git a/js/common/view/VectorAdditionScreenView.ts b/js/common/view/VectorAdditionScreenView.ts index e2763680..c3aff843 100644 --- a/js/common/view/VectorAdditionScreenView.ts +++ b/js/common/view/VectorAdditionScreenView.ts @@ -13,7 +13,6 @@ import Tandem from '../../../../tandem/js/Tandem.js'; import vectorAddition from '../../vectorAddition.js'; import VectorAdditionModel from '../model/VectorAdditionModel.js'; import VectorAdditionConstants from '../VectorAdditionConstants.js'; -import Disposable from '../../../../axon/js/Disposable.js'; export default class VectorAdditionScreenView extends ScreenView { @@ -24,6 +23,7 @@ export default class VectorAdditionScreenView extends ScreenView { super( { layoutBounds: VectorAdditionConstants.SCREEN_VIEW_BOUNDS, + isDisposable: false, tandem: tandem } ); @@ -39,11 +39,6 @@ export default class VectorAdditionScreenView extends ScreenView { this.addChild( this.resetAllButton ); } - public override dispose(): void { - Disposable.assertNotDisposable(); - super.dispose(); - } - public reset(): void { // cancel any interactions that are in progress diff --git a/js/common/view/VectorCreatorPanel.ts b/js/common/view/VectorCreatorPanel.ts index 5209c62d..f092ab05 100644 --- a/js/common/view/VectorCreatorPanel.ts +++ b/js/common/view/VectorCreatorPanel.ts @@ -15,7 +15,6 @@ import vectorAddition from '../../vectorAddition.js'; import VectorAdditionConstants from '../VectorAdditionConstants.js'; import VectorCreatorPanelSlot from './VectorCreatorPanelSlot.js'; import { optionize4 } from '../../../../phet-core/js/optionize.js'; -import Disposable from '../../../../axon/js/Disposable.js'; type HorizontalAlign = 'left' | 'center' | 'right'; type VerticalAlign = 'top' | 'center' | 'bottom'; @@ -49,7 +48,8 @@ export default class VectorCreatorPanel extends Panel { xMargin: 2, yMargin: 10, fill: Color.WHITE, - stroke: Color.BLACK + stroke: Color.BLACK, + isDisposable: false }, providedOptions ); // Create the container for the slots in a vertical alignment @@ -69,11 +69,6 @@ export default class VectorCreatorPanel extends Panel { super( fixedSizeSlotsContainer, options ); } - - public override dispose(): void { - Disposable.assertNotDisposable(); - super.dispose(); - } } vectorAddition.register( 'VectorCreatorPanel', VectorCreatorPanel ); \ No newline at end of file diff --git a/js/common/view/VectorCreatorPanelSlot.ts b/js/common/view/VectorCreatorPanelSlot.ts index bc24645f..9fe9b7c2 100644 --- a/js/common/view/VectorCreatorPanelSlot.ts +++ b/js/common/view/VectorCreatorPanelSlot.ts @@ -33,7 +33,6 @@ import ArrowOverSymbolNode from './ArrowOverSymbolNode.js'; import VectorAdditionIconFactory from './VectorAdditionIconFactory.js'; import SceneNode from './SceneNode.js'; import optionize from '../../../../phet-core/js/optionize.js'; -import Disposable from '../../../../axon/js/Disposable.js'; // The fixed-width of the parent of the icon. The Icon is placed in an alignBox to ensure the Icon // contains the same local width regardless of the initial vector components. This ensures that @@ -74,7 +73,10 @@ export default class VectorCreatorPanelSlot extends HBox { iconArrowMagnitude: 30, iconVectorComponents: null, iconPointerAreaXDilation: 10, - iconPointerAreaYDilation: 10 + iconPointerAreaYDilation: 10, + + // HBoxOptions + isDisposable: false }, providedOptions ); super( { spacing: 5 } ); @@ -181,11 +183,6 @@ export default class VectorCreatorPanelSlot extends HBox { vectorSet.vectors.addItemRemovedListener( removeVectorListener ); } ) ); } - - public override dispose(): void { - Disposable.assertNotDisposable(); - super.dispose(); - } } vectorAddition.register( 'VectorCreatorPanelSlot', VectorCreatorPanelSlot ); \ No newline at end of file diff --git a/js/common/view/VectorSetNode.ts b/js/common/view/VectorSetNode.ts index 586c1779..8a86cc67 100644 --- a/js/common/view/VectorSetNode.ts +++ b/js/common/view/VectorSetNode.ts @@ -28,7 +28,6 @@ import VectorNode from './VectorNode.js'; import TReadOnlyProperty from '../../../../axon/js/TReadOnlyProperty.js'; import ComponentVectorStyles from '../model/ComponentVectorStyles.js'; import VectorColorPalette from '../model/VectorColorPalette.js'; -import Disposable from '../../../../axon/js/Disposable.js'; export default class VectorSetNode extends Node { @@ -58,7 +57,8 @@ export default class VectorSetNode extends Node { componentStyleProperty, valuesVisibleProperty, vectorSet.sumVisibleProperty ); super( { - children: [ xSumComponentVectorNode, ySumComponentVectorNode, sumVectorNode ] + children: [ xSumComponentVectorNode, ySumComponentVectorNode, sumVectorNode ], + isDisposable: false } ); this.vectorSet = vectorSet; @@ -84,11 +84,6 @@ export default class VectorSetNode extends Node { } ); } - public override dispose(): void { - Disposable.assertNotDisposable(); - super.dispose(); - } - /** * Registers a Vector by creating its associated VectorNode and the ComponentVectorNodes. * The Nodes are deleted if Vector is ever removed from its VectorSet. diff --git a/js/common/view/VectorValuesNumberDisplay.ts b/js/common/view/VectorValuesNumberDisplay.ts index ee4ba2d6..6f5ae3ba 100644 --- a/js/common/view/VectorValuesNumberDisplay.ts +++ b/js/common/view/VectorValuesNumberDisplay.ts @@ -25,7 +25,6 @@ import Graph from '../model/Graph.js'; import Vector from '../model/Vector.js'; import VectorAdditionConstants from '../VectorAdditionConstants.js'; import VectorQuantities from './VectorQuantities.js'; -import Disposable from '../../../../axon/js/Disposable.js'; export default class VectorValuesNumberDisplay extends NumberDisplay { @@ -71,7 +70,8 @@ export default class VectorValuesNumberDisplay extends NumberDisplay { } ); super( numberDisplayProperty, numberDisplayRange, { - decimalPlaces: VectorAdditionConstants.VECTOR_VALUE_DECIMAL_PLACES + decimalPlaces: VectorAdditionConstants.VECTOR_VALUE_DECIMAL_PLACES, + isDisposable: false } ); this.vectorQuantity = vectorQuantity; @@ -98,11 +98,6 @@ export default class VectorValuesNumberDisplay extends NumberDisplay { } ); } - public override dispose(): void { - Disposable.assertNotDisposable(); - super.dispose(); - } - /** * Gets the value to display based on the attribute display type and a vector */ diff --git a/js/common/view/VectorValuesToggleBox.ts b/js/common/view/VectorValuesToggleBox.ts index 3ca832ce..c4ac1704 100644 --- a/js/common/view/VectorValuesToggleBox.ts +++ b/js/common/view/VectorValuesToggleBox.ts @@ -29,7 +29,6 @@ import VectorValuesNumberDisplay from './VectorValuesNumberDisplay.js'; import optionize, { EmptySelfOptions } from '../../../../phet-core/js/optionize.js'; import NumberDisplay from '../../../../scenery-phet/js/NumberDisplay.js'; import EquationsVector from '../../equations/model/EquationsVector.js'; -import Disposable from '../../../../axon/js/Disposable.js'; //---------------------------------------------------------------------------------------- // constants @@ -61,7 +60,8 @@ export default class VectorValuesToggleBox extends ToggleBox { // ToggleBoxOptions contentFixedWidth: 500, - contentFixedHeight: 45 + contentFixedHeight: 45, + isDisposable: false }, providedOptions ); const contentFixedHeight = options.contentFixedHeight!; @@ -184,11 +184,6 @@ export default class VectorValuesToggleBox extends ToggleBox { super( inspectVectorText, panelOpenContent, options ); } - - public override dispose(): void { - Disposable.assertNotDisposable(); - super.dispose(); - } } vectorAddition.register( 'VectorValuesToggleBox', VectorValuesToggleBox ); \ No newline at end of file diff --git a/js/equations/model/EquationsVector.ts b/js/equations/model/EquationsVector.ts index b8f137fa..14d4c3ef 100644 --- a/js/equations/model/EquationsVector.ts +++ b/js/equations/model/EquationsVector.ts @@ -22,7 +22,6 @@ import Vector2 from '../../../../dot/js/Vector2.js'; import EquationsGraph from './EquationsGraph.js'; import EquationsVectorSet from './EquationsVectorSet.js'; import BaseVector from '../../common/model/BaseVector.js'; -import Disposable from '../../../../axon/js/Disposable.js'; // constants @@ -85,11 +84,6 @@ export default class EquationsVector extends Vector { } ); } - public override dispose(): void { - Disposable.assertNotDisposable(); - super.dispose(); - } - public override reset(): void { super.reset(); this.coefficientProperty.reset(); diff --git a/js/equations/view/BaseVectorsAccordionBox.ts b/js/equations/view/BaseVectorsAccordionBox.ts index eb894512..dad2fe2c 100644 --- a/js/equations/view/BaseVectorsAccordionBox.ts +++ b/js/equations/view/BaseVectorsAccordionBox.ts @@ -32,7 +32,6 @@ import PickRequired from '../../../../phet-core/js/types/PickRequired.js'; import NumberProperty from '../../../../axon/js/NumberProperty.js'; import CartesianBaseVector from '../../common/model/CartesianBaseVector.js'; import PolarBaseVector from '../../common/model/PolarBaseVector.js'; -import Disposable from '../../../../axon/js/Disposable.js'; // constants const LABEL_MAX_WIDTH = 30; // maxWidth for picker labels, determined empirically @@ -59,7 +58,8 @@ export default class BaseVectorsAccordionBox extends AccordionBox { titleNode: new Text( VectorAdditionStrings.baseVectors, { font: VectorAdditionConstants.TITLE_FONT, maxWidth: 0.75 * CONTENT_WIDTH - } ) + } ), + isDisposable: false }, providedOptions ); //---------------------------------------------------------------------------------------- @@ -177,11 +177,6 @@ export default class BaseVectorsAccordionBox extends AccordionBox { } } ); } - - public override dispose(): void { - Disposable.assertNotDisposable(); - super.dispose(); - } } /** diff --git a/js/equations/view/EquationToggleBox.ts b/js/equations/view/EquationToggleBox.ts index f4e6875b..deeb997c 100644 --- a/js/equations/view/EquationToggleBox.ts +++ b/js/equations/view/EquationToggleBox.ts @@ -19,7 +19,6 @@ import EquationTypes from '../model/EquationTypes.js'; import EquationTypeNode from './EquationTypeNode.js'; import EquationTypesRadioButtonGroup from './EquationTypesRadioButtonGroup.js'; import optionize, { EmptySelfOptions } from '../../../../phet-core/js/optionize.js'; -import Disposable from '../../../../axon/js/Disposable.js'; // constants const TEXT_OPTIONS = { font: VectorAdditionConstants.EQUATION_FONT }; @@ -46,7 +45,8 @@ export default class EquationToggleBox extends ToggleBox { // ToggleBoxOptions contentFixedWidth: 670, contentFixedHeight: 50, - contentXSpacing: 17 + contentXSpacing: 17, + isDisposable: false }, providedOptions ); // When the toggle box is collapsed, show 'Equation' @@ -88,11 +88,6 @@ export default class EquationToggleBox extends ToggleBox { } } ); } - - public override dispose(): void { - Disposable.assertNotDisposable(); - super.dispose(); - } } vectorAddition.register( 'EquationToggleBox', EquationToggleBox ); \ No newline at end of file diff --git a/js/equations/view/EquationTypesRadioButtonGroup.ts b/js/equations/view/EquationTypesRadioButtonGroup.ts index b8b3b85f..11f7250a 100644 --- a/js/equations/view/EquationTypesRadioButtonGroup.ts +++ b/js/equations/view/EquationTypesRadioButtonGroup.ts @@ -26,7 +26,6 @@ import VectorAdditionIconFactory from '../../common/view/VectorAdditionIconFacto import vectorAddition from '../../vectorAddition.js'; import EquationTypes from '../model/EquationTypes.js'; import { EmptySelfOptions, optionize4 } from '../../../../phet-core/js/optionize.js'; -import Disposable from '../../../../axon/js/Disposable.js'; type SelfOptions = EmptySelfOptions; @@ -42,7 +41,8 @@ export default class EquationTypesRadioButtonGroup extends RectangularRadioButto const options = optionize4()( {}, VectorAdditionConstants.RADIO_BUTTON_GROUP_OPTIONS, { xMargin: 12, - scale: 0.75 + scale: 0.75, + isDisposable: false }, providedOptions ); // Create the description of the buttons @@ -58,11 +58,6 @@ export default class EquationTypesRadioButtonGroup extends RectangularRadioButto super( equationTypeProperty, items, options ); } - - public override dispose(): void { - Disposable.assertNotDisposable(); - super.dispose(); - } } vectorAddition.register( 'EquationTypesRadioButtonGroup', EquationTypesRadioButtonGroup ); \ No newline at end of file diff --git a/js/explore1D/view/GraphOrientationRadioButtonGroup.ts b/js/explore1D/view/GraphOrientationRadioButtonGroup.ts index 33252136..cc7319d0 100644 --- a/js/explore1D/view/GraphOrientationRadioButtonGroup.ts +++ b/js/explore1D/view/GraphOrientationRadioButtonGroup.ts @@ -12,9 +12,8 @@ import GraphOrientations from '../../common/model/GraphOrientations.js'; import VectorAdditionConstants from '../../common/VectorAdditionConstants.js'; import VectorAdditionIconFactory from '../../common/view/VectorAdditionIconFactory.js'; import vectorAddition from '../../vectorAddition.js'; -import { EmptySelfOptions, optionize3 } from '../../../../phet-core/js/optionize.js'; +import { EmptySelfOptions, optionize4 } from '../../../../phet-core/js/optionize.js'; import { NodeTranslationOptions } from '../../../../scenery/js/imports.js'; -import Disposable from '../../../../axon/js/Disposable.js'; type SelfOptions = EmptySelfOptions; @@ -25,8 +24,10 @@ export default class GraphOrientationRadioButtonGroup extends RectangularRadioBu public constructor( graphOrientationProperty: EnumerationProperty, providedOptions?: GraphOrientationRadioButtonGroupOptions ) { - const options = optionize3()( - {}, VectorAdditionConstants.RADIO_BUTTON_GROUP_OPTIONS, providedOptions ); + const options = optionize4()( + {}, VectorAdditionConstants.RADIO_BUTTON_GROUP_OPTIONS, { + isDisposable: false + }, providedOptions ); // Create the description of the buttons const items: RectangularRadioButtonGroupItem[] = []; @@ -39,11 +40,6 @@ export default class GraphOrientationRadioButtonGroup extends RectangularRadioBu super( graphOrientationProperty, items, options ); } - - public override dispose(): void { - Disposable.assertNotDisposable(); - super.dispose(); - } } vectorAddition.register( 'GraphOrientationRadioButtonGroup', GraphOrientationRadioButtonGroup ); \ No newline at end of file