Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/phetsims/scenery
Browse files Browse the repository at this point in the history
  • Loading branch information
zepumph committed Jul 14, 2022
2 parents 1cc2557 + 05d8017 commit 22b6ca7
Show file tree
Hide file tree
Showing 16 changed files with 30 additions and 30 deletions.
2 changes: 1 addition & 1 deletion js/accessibility/voicing/ReadingBlock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ const ReadingBlock = <SuperType extends Constructor>( Type: SuperType, optionsAr

const displays = ( this as unknown as Node ).getConnectedDisplays();

const readingBlockUtterance = this.voicingUtterance as ReadingBlockUtterance;
const readingBlockUtterance = this.voicingUtterance;

const content = this.collectResponse( {
nameResponse: this.getReadingBlockNameResponse(),
Expand Down
16 changes: 8 additions & 8 deletions js/display/Display.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1166,7 +1166,7 @@ export default class Display {
this._pointerOverlay = null;
}
else {
this._pointerOverlay = new PointerOverlay( this, this._rootNode! );
this._pointerOverlay = new PointerOverlay( this, this._rootNode );
this.addOverlay( this._pointerOverlay );
}
}
Expand All @@ -1187,7 +1187,7 @@ export default class Display {
this._pointerAreaOverlay = null;
}
else {
this._pointerAreaOverlay = new PointerAreaOverlay( this, this._rootNode! );
this._pointerAreaOverlay = new PointerAreaOverlay( this, this._rootNode );
this.addOverlay( this._pointerAreaOverlay );
}
}
Expand All @@ -1208,8 +1208,8 @@ export default class Display {
this._hitAreaOverlay = null;
}
else {
this._hitAreaOverlay = new HitAreaOverlay( this, this._rootNode! );
this.addOverlay( this._hitAreaOverlay! );
this._hitAreaOverlay = new HitAreaOverlay( this, this._rootNode );
this.addOverlay( this._hitAreaOverlay );
}
}
}
Expand All @@ -1229,7 +1229,7 @@ export default class Display {
this._canvasAreaBoundsOverlay = null;
}
else {
this._canvasAreaBoundsOverlay = new CanvasNodeBoundsOverlay( this, this._rootNode! );
this._canvasAreaBoundsOverlay = new CanvasNodeBoundsOverlay( this, this._rootNode );
this.addOverlay( this._canvasAreaBoundsOverlay );
}
}
Expand All @@ -1250,7 +1250,7 @@ export default class Display {
this._fittedBlockBoundsOverlay = null;
}
else {
this._fittedBlockBoundsOverlay = new FittedBlockBoundsOverlay( this, this._rootNode! );
this._fittedBlockBoundsOverlay = new FittedBlockBoundsOverlay( this, this._rootNode );
this.addOverlay( this._fittedBlockBoundsOverlay );
}
}
Expand Down Expand Up @@ -1484,7 +1484,7 @@ export default class Display {
}

// @ts-ignore TODO BackboneDrawable
result += this._rootBackbone ? ( `Drawables: ${drawableCount( this._rootBackbone! )}<br/>` ) : '';
result += this._rootBackbone ? ( `Drawables: ${drawableCount( this._rootBackbone )}<br/>` ) : '';

const drawableCountMap: Record<string, number> = {}; // {string} drawable constructor name => {number} count of seen
// increment the count in our map
Expand Down Expand Up @@ -1752,7 +1752,7 @@ export default class Display {
if ( this._rootBackbone ) {
result += '<div style="font-weight: bold;">Root Drawable Tree</div>';
// @ts-ignore TODO BackboneDrawable
printDrawableSubtree( this._rootBackbone! );
printDrawableSubtree( this._rootBackbone );
}

//OHTWO TODO: add shared cache drawable trees
Expand Down
2 changes: 1 addition & 1 deletion js/input/BatchedDOMEvent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export default class BatchedDOMEvent implements IPoolable {
// according to spec (http://www.w3.org/TR/touch-events/), this is not an Array, but a TouchList
const touch = touchEvent.changedTouches.item( i )!;

callback.call( input, touch!.identifier, input.pointFromEvent( touch ), touchEvent );
callback.call( input, touch.identifier, input.pointFromEvent( touch ), touchEvent );
}
}
else if ( this.type === BatchedDOMEventType.MOUSE_TYPE ) {
Expand Down
8 changes: 4 additions & 4 deletions js/layout/LayoutAlign.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,19 +63,19 @@ export default class LayoutAlign extends EnumerationValue {
return null;
}

assert && assert( horizontalAlignMap[ key as 'left' | 'right' | 'center' | 'origin' ] );
assert && assert( horizontalAlignMap[ key ] );

return horizontalAlignMap[ key as 'left' | 'right' | 'center' | 'origin' ];
return horizontalAlignMap[ key ];
}

static verticalAlignToInternal( key: VerticalLayoutAlign | null ): LayoutAlign | null {
if ( key === null ) {
return null;
}

assert && assert( verticalAlignMap[ key as 'top' | 'bottom' | 'center' | 'origin' ] );
assert && assert( verticalAlignMap[ key ] );

return verticalAlignMap[ key as 'top' | 'bottom' | 'center' | 'origin' ];
return verticalAlignMap[ key ];
}

// Converts an internal Enumeration value into a string union value.
Expand Down
2 changes: 1 addition & 1 deletion js/layout/constraints/FlowConstraint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ export default class FlowConstraint extends FlowConfigurable( NodeLayoutConstrai
assert && assert( amountToGrow > 1e-11 );

growableCells.forEach( cell => {
cell.size += amountToGrow * cell.effectiveGrow!;
cell.size += amountToGrow * cell.effectiveGrow;
} );
spaceRemaining -= amountToGrow * totalGrow;
}
Expand Down
2 changes: 1 addition & 1 deletion js/listeners/DragListener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ export default class DragListener extends PressListener implements IInputListene
this.attachTransformTracker();

assert && assert( pressedListener.pointer.point !== null );
const point = pressedListener.pointer.point!;
const point = pressedListener.pointer.point;

// Compute the parent point corresponding to the pointer's position
const parentPoint = this.globalToParentPoint( this._localPoint.set( point ) );
Expand Down
2 changes: 1 addition & 1 deletion js/listeners/FireListener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export default class FireListener extends PressListener implements IInputListene
this._fireOnDown = options.fireOnDown;

this.firedEmitter = new Emitter<[ SceneryEvent<MouseEvent | TouchEvent | PointerEvent | FocusEvent | KeyboardEvent> | null ]>( {
tandem: options.tandem!.createTandem( 'firedEmitter' ),
tandem: options.tandem.createTandem( 'firedEmitter' ),
// @ts-ignore TODO EventType
phetioEventType: EventType.USER,
phetioReadOnly: options.phetioReadOnly,
Expand Down
2 changes: 1 addition & 1 deletion js/listeners/KeyboardDragListener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -882,7 +882,7 @@ class KeyboardDragListener extends EnabledComponent implements IInputListener {
if ( this._pointer ) {
assert && assert( this._pointer.listeners.includes( this._pointerListener ),
'A reference to the Pointer means it should have the pointerListener' );
this._pointer!.removeInputListener( this._pointerListener );
this._pointer.removeInputListener( this._pointerListener );
this._pointer = null;
}
}
Expand Down
2 changes: 1 addition & 1 deletion js/nodes/Imageable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ const Imageable = <SuperType extends Constructor>( type: SuperType ) => {
}

// We ruled out the string | Mipmap cases above
this._image = image as HTMLImageElement | HTMLCanvasElement;
this._image = image;

// If our image is an HTML image that hasn't loaded yet, attach a load listener.
if ( this._image instanceof HTMLImageElement && ( !this._image.width || !this._image.height ) ) {
Expand Down
2 changes: 1 addition & 1 deletion js/nodes/Node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2603,7 +2603,7 @@ class Node extends ParallelDOM {
if ( typeof a === 'number' ) {
assert && assert( typeof a === 'number' && isFinite( a ), 'Parameters to setTranslation should be finite numbers' );
assert && assert( typeof b === 'number' && isFinite( b ), 'Parameters to setTranslation should be finite numbers' );
dx = a as number - tx;
dx = a - tx;
dy = b as number - ty;
}
else {
Expand Down
2 changes: 1 addition & 1 deletion js/nodes/Text.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ export default class Text extends Paintable( Node ) {
}
}

return this._cachedRenderedText!;
return this._cachedRenderedText;
}

get renderedText(): string { return this.getRenderedText(); }
Expand Down
4 changes: 2 additions & 2 deletions js/overlays/PointerAreaOverlay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ export default class PointerAreaOverlay extends ShapeBasedOverlay implements IOv
const transform = trail.getTransform();

if ( node.mouseArea ) {
this.addShape( transform.transformShape( node.mouseArea instanceof Bounds2 ? Shape.bounds( node.mouseArea as Bounds2 ) : node.mouseArea ), 'rgba(0,0,255,0.8)', true );
this.addShape( transform.transformShape( node.mouseArea instanceof Bounds2 ? Shape.bounds( node.mouseArea ) : node.mouseArea ), 'rgba(0,0,255,0.8)', true );
}
if ( node.touchArea ) {
this.addShape( transform.transformShape( node.touchArea instanceof Bounds2 ? Shape.bounds( node.touchArea as Bounds2 ) : node.touchArea ), 'rgba(255,0,0,0.8)', false );
this.addShape( transform.transformShape( node.touchArea instanceof Bounds2 ? Shape.bounds( node.touchArea ) : node.touchArea ), 'rgba(255,0,0,0.8)', false );
}
}
return false;
Expand Down
2 changes: 1 addition & 1 deletion js/util/Font.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ export default class Font extends PhetioObject {
size: this._size,
lineHeight: this._lineHeight,
family: this._family
}, options ) as FontOptions );
}, options ) );
}

/**
Expand Down
4 changes: 2 additions & 2 deletions js/util/Picker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ export default class Picker {
// do this before the transformation to the parent coordinate frame (the mouseArea is in the local coordinate frame)
if ( pointerArea ) {
// we accept either Bounds2, or a Shape (in which case, we take the Shape's bounds)
mutableBounds.includeBounds( pointerArea instanceof Bounds2 ? ( pointerArea as Bounds2 ) : ( pointerArea as unknown as Shape ).bounds );
mutableBounds.includeBounds( pointerArea instanceof Bounds2 ? ( pointerArea ) : ( pointerArea as unknown as Shape ).bounds );
}

const clipArea = this.node.clipArea;
Expand Down Expand Up @@ -679,7 +679,7 @@ export default class Picker {
node._picker.audit();
} );

const localAssertSlow = assertSlow!;
const localAssertSlow = assertSlow;

const expectedSelfPruned = this.node.pickable === false || !this.node.isVisible();
const expectedSelfInclusive = this.node.pickable === true || this.node._inputListeners.length > 0;
Expand Down
2 changes: 1 addition & 1 deletion js/util/ProfileColorProperty.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export default class ProfileColorProperty extends ColorProperty {
useDeepEquality: true
}, providedOptions );

const tandem = options.tandem!;
const tandem = options.tandem;

// All values are eagerly coerced to Color instances for efficiency (so it only has to be done once) and simplicity
// (so the types are uniform)
Expand Down
6 changes: 3 additions & 3 deletions js/util/scenerySerialize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ const scenerySerialize = ( value: unknown ): any => {
if ( value instanceof Vector2 ) {
return {
type: 'Vector2',
x: ( value as Vector2 ).x,
y: ( value as Vector2 ).y
x: ( value ).x,
y: ( value ).y
};
}
else if ( value instanceof Matrix3 ) {
Expand All @@ -38,7 +38,7 @@ const scenerySerialize = ( value: unknown ): any => {
};
}
else if ( value instanceof Bounds2 ) {
const bounds = value as Bounds2;
const bounds = value;
return {
type: 'Bounds2',
maxX: bounds.maxX,
Expand Down

0 comments on commit 22b6ca7

Please sign in to comment.