Skip to content

Commit

Permalink
Address TODOs, see #45
Browse files Browse the repository at this point in the history
  • Loading branch information
samreid committed Apr 30, 2023
1 parent 3e648b3 commit 1eaefad
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
3 changes: 2 additions & 1 deletion js/common/view/CAVObjectNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ export default abstract class CAVObjectNode extends Node {

const viewRadius = modelViewTransform.modelToViewDeltaX( modelRadius );

// TODO: Make sure it is always in the front in z-ordering, sometimes it gets obscured by adjacent soccer balls
// Visibilty controlled by subclass logic. Also this whole node is moved to front when the medianHighlight is shown
// so it will appear in front (unless the user drags another object on top of it).
this.medianHighlight = new Circle( viewRadius + 1.75, {
fill: CAVColors.medianColorProperty
} );
Expand Down
6 changes: 6 additions & 0 deletions js/common/view/DataPointNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ export default class DataPointNode extends CAVObjectNode {
[ soccerBall.isMedianObjectProperty, isShowingPlayAreaMedianProperty, soccerBall.isShowingAnimationHighlightProperty ],
( isMedianObject, isShowingPlayAreaMedian, isShowingAnimationHighlight ) => {
this.medianHighlight.visible = isShowingAnimationHighlight;

// Median highlights should be in front in z-ordering. Rather than accomplishing this via a different layer,
// move this to the front when it is visible.
if ( this.medianHighlight.visible ) {
this.moveToFront();
}
} );
}
}
Expand Down
6 changes: 6 additions & 0 deletions js/common/view/SoccerBallNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,12 @@ export default class SoccerBallNode extends CAVObjectNode {
[ soccerBall.isMedianObjectProperty, isShowingPlayAreaMedianProperty, soccerBall.isShowingAnimationHighlightProperty ],
( isMedianObject, isShowingPlayAreaMedian, isShowingAnimationHighlight ) => {
this.medianHighlight.visible = isShowingPlayAreaMedian && isMedianObject;

// Median highlights should be in front in z-ordering. Rather than accomplishing this via a different layer,
// move this to the front when it is visible.
if ( this.medianHighlight.visible ) {
this.moveToFront();
}
} );
}
}
Expand Down

0 comments on commit 1eaefad

Please sign in to comment.