-
Notifications
You must be signed in to change notification settings - Fork 7
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
Appearance of "Zoom out to see data." is inconsistent #209
Comments
Thanks for the detailed steps @phet-steele. I reproduced steps 1-6. I could not reproduce steps 7-15. At step 11, I did not get the message back. I also tried repeating steps 1-6 before moving on to step 7. But no matter... This should give me enough to work with. |
@pixelzoom I'm going to make an adjustment to the above steps. In step 9, ensure the brown fur mutation is selected as dominant. |
OK. With that change to step 9, I can now reproduce the whole enchilada. Thanks. |
Visibility of the message is the responsibility of PopulationGraphNode: // If the generation clock has started and there's no data visible, display 'Zoom out to see data.'
// unlink is not necessary.
assert && assert( plotsNode.clipArea, 'plotsNode.clipArea is required' );
const clipAreaBounds = plotsNode.clipArea.getBounds();
plotsNode.localBoundsProperty.link( localBounds => {
const clockHasStarted = ( populationModel.timeInGenerationsProperty.value !== 0 );
const dataIsVisible = localBounds.intersectsBounds( clipAreaBounds );
zoomOutToSeeDataText.visible = clockHasStarted && !dataIsVisible;
} ); The problem is that this listener is firing when "Brown Fur" is checked (step 5), but not firing when "Brown Fur" is unchecked (step 6). |
A similar case:
|
To optimize performance, PopulationPlotNode (which draws one plot) is only updated when it's visible. So when it's made invisible, it then has stale points and line segments, which continue to contribute to the bounds. The solution is to clear the plot when it becomes invisible. That is the subject of the patch below. I'm not going to apply this patch until we see what other issues come up for phetsims/qa/issues/539, since this is an issue that might be appropriate to defer for the prototype. patchIndex: js/common/view/population/PopulationPlotNode.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- js/common/view/population/PopulationPlotNode.js (revision 77ad068d5e35951eaad8ed008997172f20d39f60)
+++ js/common/view/population/PopulationPlotNode.js (date 1598643991411)
@@ -107,9 +107,9 @@
}
} );
- // unmultilink is not necessary
+ // Update when visibility or range changes. unmultilink is not necessary.
Property.multilink( [ this.visibleProperty, this.xRangeProperty, this.yRangeProperty ],
- visible => visible && this.updatePlot()
+ visible => visible ? this.updatePlot() : this.clearPlot()
);
}
@@ -218,6 +218,19 @@
}
}
+ /**
+ * Clears the plot. While a plot is invisible, it is not updated. So when a plot is made invisible, it must
+ * also be cleared. This is important because bounds are used to decide if the graph is displaying data, and
+ * whether the "Zoom out to show data" message should be displayed. Bounds computation includes invisible Nodes,
+ * and if the plot still contains geometry, then it will be incorrectly contributing to bounds.
+ * See https://github.com/phetsims/natural-selection/issues/209
+ * @private
+ */
+ clearPlot() {
+ this.pointsPath.setShape( null );
+ this.stepPath.setShape( null );
+ }
+
/**
* Model-view transform for x axis.
* @param {number} xModel - x model value, in generations |
This fix is low risk. I recommend that we roll this fix into the prototype RC, and @ariel-phet approves. |
Fixed in the above commit and ready for verification. To verify in 1.1.0-rc.1:
|
The message seems to be working just fine. I did some other sequences of showing/hiding the message and do find one thing that's a little strange/buggy. If I have nothing checked at all, I see the message "Zoom out to see the data." So I zoom out, but nothing changes, because I have nothing checked. I can't take a screenshot because I am on the iPad, but here were my steps:
|
Well that's weird.. I clicked reset-all to do more testing and "Zoom out to see data" is showing on the graph, but there is one bunny hopping around. I'll try to keep investigating. |
@amanda-phet In #209 (comment), it sounds like you are describing this known issue: #213. |
Indeed. Still wondering about the reset-all thing.. I'll try to reproduce it. |
Re "the reset-all thing"... Steps to reproduce:
Not sure what the issue is (I haven't investigated), but it's reproducible. Now the decision is whether to fix it for the prototype RC. |
Yup I got there too. I was thinking of putting these steps in #213 since it seems more related to that issue. Maybe when that one is fixed this won't happen? |
This is apparently a new problem, introduced by 23f61b8. It's not reproducible in 1.1.0-dev.18. |
It's possible that #213 might make this go away. But "Zoom..." is not supposed to be displayed when the sim has not started running yet, and whether checkboxes are checked is irrelevant. |
Simpler steps to reproduce:
|
PopulationGraphNode.js is responsible for showing the "Zoom..." message. I added a plotsNode.localBoundsProperty.link( localBounds => {
const clockHasStarted = ( populationModel.timeInGenerationsProperty.value !== 0 );
const dataIsVisible = localBounds.intersectsBounds( clipAreaBounds );
+ console.log( `clockHasStarted=${clockHasStarted} dataIsVisible=${dataIsVisible}`);
zoomOutToSeeDataText.visible = clockHasStarted && !dataIsVisible;
} ); When the Reset All button is pressed, it reports:
So what's going on here is that (on Reset All) the graphs are getting cleared before the clock is getting reset. So this code think the clock is still running and "Zoom..." should be visible. So 23f61b8 didn't introduce a new problem, it exposed an additional problem. |
A couple of other notes, and then I'm going to try to ignore this for the weekend :)
EDIT: No, if should not look at |
Here's a patch that should fix the latest problem (that manifests with Reset All), as well as #213 and #214. I recommend that this fix first be tested in a master dev version. Then it can be applied to the prototype release branch, which will require spot checking in another RC. patchIndex: js/common/view/population/PopulationGraphNode.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- js/common/view/population/PopulationGraphNode.js (revision 1c22312b90c1c2c7562848ae4c7f4e9c9f7247d9)
+++ js/common/view/population/PopulationGraphNode.js (date 1598845920173)
@@ -7,6 +7,7 @@
* @author Chris Malley (PixelZoom, Inc.)
*/
+import Bounds2 from '../../../../../dot/js/Bounds2.js';
import Vector2 from '../../../../../dot/js/Vector2.js';
import merge from '../../../../../phet-core/js/merge.js';
import ZoomButtonGroup from '../../../../../scenery-phet/js/ZoomButtonGroup.js';
@@ -143,14 +144,12 @@
yAxisLabelNode.centerY = gridNode.y + ( gridHeight / 2 );
} );
- // If the generation clock has started and there's no data visible, display 'Zoom out to see data.'
+ // If the plot has data that is not visible, display 'Zoom out to see data.'
// unlink is not necessary.
assert && assert( plotsNode.clipArea, 'plotsNode.clipArea is required' );
- const clipAreaBounds = plotsNode.clipArea.getBounds();
plotsNode.localBoundsProperty.link( localBounds => {
- const clockHasStarted = ( populationModel.timeInGenerationsProperty.value !== 0 );
- const dataIsVisible = localBounds.intersectsBounds( clipAreaBounds );
- zoomOutToSeeDataText.visible = clockHasStarted && !dataIsVisible;
+ zoomOutToSeeDataText.visible = !localBounds.equals( Bounds2.NOTHING ) &&
+ !localBounds.intersectsBounds( plotsNode.clipArea.bounds );
} );
super( options ); |
I went ahead and applied the patch to master in the above commit. @amanda-phet please test in 1.2.0-dev.1. Please also confirm that it addresses #213. |
The original issue seems to be fixed, and since #213 is fixed it seems even more unlikely that I can reproduce the reset-all bug as well. All is looking good. @phet-steele should probably look this over too since he originally identified this bug. |
@amanda-phet My understanding is that @phet-steele was not available the first part of this week. Do you want to delay the next RC until he's available, or can @ariel-phet serve as the second set of eyes? |
4affe22 has been cherry-picked into the 1.1 branch. |
I forgot about that. Yes, @ariel-phet please feel free to review this too. |
Looks good to me in latest dev. |
Ready for RC testing in phetsims/qa#542. |
Verified fixed. Closing |
Note the "Zoom out to see data." message is displayed on the population graph.
From this point, I have not figured out how to ever get this message back without pressing "Start Over". However!! Simply pressing Start Over and repeating the steps above will not return the message. However again!! If you instead follow these steps, you will get the message back:
Seen on Win 10 Chrome and ChromeOS. For phetsims/qa/issues/539.
Troubleshooting Information
URL: https://phet-dev.colorado.edu/html/natural-selection/1.1.0-dev.18/phet/natural-selection_all_phet.html
Version: 1.1.0-dev.18 2020-08-27 20:15:32 UTC
Features missing: touch
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.125 Safari/537.36
Language: en-US
Window: 1155x923
Pixel Ratio: 1/1
WebGL: WebGL 1.0 (OpenGL ES 2.0 Chromium)
GLSL: WebGL GLSL ES 1.0 (OpenGL ES GLSL ES 1.0 Chromium)
Vendor: WebKit (WebKit WebGL)
Vertex: attribs: 16 varying: 30 uniform: 4095
Texture: size: 16384 imageUnits: 16 (vertex: 16, combined: 32)
Max viewport: 32767x32767
OES_texture_float: true
The text was updated successfully, but these errors were encountered: