-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Zoom feature results in incorrect behavior of RewardNode. #97
Comments
Thanks for making the issue, I agree this should not stop publication releases at the moment, and while I think we should investigate this issue and fix it in the long run, this issue seems like something that can wait a bit since its consequences are pretty minor. I've added it to quarterly planning to discuss if we do it in Q1 2022. |
RewardNode uses CanvasNode and sets |
We can use TransformTracker to watch transforms along the Trail to the RewardNode. This means using |
This is potentially something that shouldn't require too much work, and was marked as a goal for Q1 2022. Removing the deferred label. |
The change to use TransformTracker to watch transforms of any ancestor (not just the ScreenView) to update RewardNode bounds was done in the above commit. I tested this by zooming in and out of the RewardScreenView and also by verifying the case in phetsims/equality-explorer#176 was fixed (RewardNode looks correct when it starts animating while already zoomed in). EDIT: An easier way to test this case is to add a conditional to RewardScreenView.step so you can control from the dev tools when the RewardNode starts animating and zoom in first. step( timeElapsed ) {
if ( window.running ) {
this.rewardNode.step( timeElapsed );
}
} |
@samreid since you were the original author of RewardNode and previously worked on |
Working copy patch for the review: Index: js/demo/RewardScreenView.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/js/demo/RewardScreenView.js b/js/demo/RewardScreenView.js
--- a/js/demo/RewardScreenView.js (revision 45af27c74fe03a2908ecaf9caa778e2ce64c8e0e)
+++ b/js/demo/RewardScreenView.js (date 1644789901330)
@@ -47,7 +47,9 @@
// @public
step( timeElapsed ) {
- this.rewardNode.step( timeElapsed );
+ if ( window.running ) {
+ this.rewardNode.step( timeElapsed );
+ }
}
}
Index: js/RewardNode.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/js/RewardNode.js b/js/RewardNode.js
--- a/js/RewardNode.js (revision 45af27c74fe03a2908ecaf9caa778e2ce64c8e0e)
+++ b/js/RewardNode.js (date 1644790141455)
@@ -223,7 +223,8 @@
// These bounds represent the full window relative to the scene. It is transformed by the inverse of the
// ScreenView's matrix (globalToLocalBounds) because the RewardNode is meant to fill the ScreenView. RewardNode
// nodes are placed within these bounds.
- this.canvasDisplayBounds = trailFromScreenViewToThis.globalToLocalBounds( options.display.bounds );
+ console.log( options.display.bounds );
+ this.canvasDisplayBounds = trailFromScreenViewToThis.globalToLocalBounds( options.display.bounds.eroded( 100 ) );
const local = this.globalToLocalBounds( options.display.bounds );
this.setCanvasBounds( local );
|
At today's quarterly planning meeting, it was requested to increase the priority of this review. Maybe get to it within a few weeks? |
I tested zooming in before enabling the reward node. I tried eroding the bounds of the reward node, so I could see the edge. Everything seemed to behave as expected. From the code inspection:
Everything else seems good, nice work. Back to @jessegreenberg |
Great ideas, thanks. I added a note of doc and an assertion to make sure that the trail to the RewardNode hasn't changed between I tested the assertion with this patch in RewardScreenView.ts: Index: js/demo/RewardScreenView.ts
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/js/demo/RewardScreenView.ts b/js/demo/RewardScreenView.ts
--- a/js/demo/RewardScreenView.ts (revision efe7863e2835c3adfe5c40193e9fb22b2bc9eca2)
+++ b/js/demo/RewardScreenView.ts (date 1657224362486)
@@ -15,10 +15,14 @@
import RewardNode from '../RewardNode.js';
import vegas from '../vegas.js';
import Tandem from '../../../tandem/js/Tandem.js';
+import IntentionalAny from '../../../phet-core/js/types/IntentionalAny.js';
export default class RewardScreenView extends ScreenView {
private readonly rewardNode: RewardNode;
+ private readonly dummyNode: IntentionalAny;
+
+ private moveTest = true;
public constructor() {
super( {
@@ -29,6 +33,9 @@
this.rewardNode = new RewardNode();
this.addChild( this.rewardNode );
+ this.dummyNode = new phet.scenery.Node();
+ this.addChild( this.dummyNode );
+
// RewardDialog
const rewardDialogButton = new RectangularPushButton( {
content: new Text( 'open RewardDialog', { font: new PhetFont( 20 ) } ),
@@ -52,6 +59,12 @@
public override step( timeElapsed: number ): void {
this.rewardNode.step( timeElapsed );
+
+ if ( this.moveTest ) {
+ this.moveTest = false;
+ this.removeChild( this.rewardNode );
+ this.dummyNode.addChild( this.rewardNode );
+ }
}
}
|
Looks great, thanks! Closing. |
The general zoom feature is not working properly with RewardNode. RewardNode does not adjust to fill the visibile bounds of the ScreenView. See for example phetsims/equality-explorer#176. And this seems to be happening with all sims that use RewardNode.
I believe @jessegreenberg was the developer for the zoom feature, so I'll start by assigning to him. We'll start with high prioirity, because this impacts the RC testing for Equality Explorer 1.1, phetsims/qa#735. If you'd like to verify whether this needs to be fixed for Equality Explorer 1.1 (and possibly adjust the priority), please consult with @amanda-phet.
The text was updated successfully, but these errors were encountered: