-
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
Keyboard input should snap to grid #47
Comments
Not sure why this wasn't working. First thought is that downDelta is annotated as being in view coordinates. If that is the case, why?!?! Index: js/free-objects/view/RatioHalf.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- js/free-objects/view/RatioHalf.js (revision 3dc94cafabd4a341bacf6b1826275ccf7737e32b)
+++ js/free-objects/view/RatioHalf.js (date 1589244791833)
@@ -133,9 +133,13 @@
pointer.addInputListener( dragListener );
// transform and dragBounds set in layout code below
+ const downDelta = 1 / designingProperties.gridBaseUnitProperty.value;
+ debugger;
const keyboardDragListener = new KeyboardDragListener( {
positionProperty: positionProperty,
start: () => { firstInteractionProperty.value = false; },
+ downDelta: downDelta,
+ shifDownDelta: downDelta / 4,
end: () => this.alertManager.dragEndListener( valueProperty.get() )
} );
pointer.addInputListener( keyboardDragListener );
|
@zepumph Yes, this behavior is intended only for focus-based navigation. |
I made each hand a slider above. Now it will snap to each grid line, and using |
@zepumph I think the general snap-to-gridline behavior looks great. I think we'll need the shift behavior to change based on the current ratio, to ensure that success can always be reached. Note, there will likely be an option for teachers / students to change the ratio, so this will need to be anything reasonable with a range of (likely ) 1-10 for the left and 1-10 for the right. |
I agree we will need to make sure that the target ratio is always available, but I worry a bit about changing the behavior of keys as a side-effect of changing the target ratio. Possible easy solution: Make the shift step be 1/10 of a grid line (10 up arrows when holding shift make a single key press when not holding shift). This is simple to implement, and will give the needed granularity for any target ratio. Possible harder solution: put this on hold, and then once the keyboard interaction get's a bit more set in stone, come back and determine the best way to alter the step size based on the target ratio. I prefer the easy solution, to see how far it can take us. Let me know what you would like to do with this issue. |
I like the "shift = 1/10 of a step" idea. I worry that it might introduce some description challenges for the scenario where there are no gridlines or numbers (the qualitative description scenario) but if this is the "easy solution" let's go with it for now and (as you said) see how far it can take us. |
Implemented above. Let's see how that goes, and revisit as needed. |
@zepumph It still seems like 1/4 steps for me, from phettest. |
Hmmm. I just tested and it looks to be using 1/10 step for the shift key step on master locally and on phettest. Perhaps it was a caching problem? |
Looks good! |
From #44
@emily-phet I am confirming here that this behavior is only for keyboard, and we don't want this for mouse. Because of this, I felt like it deserved its own issue to think about how to apply singulary to this input modality.
The text was updated successfully, but these errors were encountered: