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
core: Render yellow rectangular highlight on keyboard focus #15717
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
f000f5f
core: Move FocusTracker to Stage
kjarosh 0be9ca9
swf: Add Rectangle::grow method
kjarosh f360666
core: Render yellow highlight on keyboard focus
kjarosh 3be37a7
tests: Add focus_highlight/focus_highlight_basic
kjarosh ebef447
tests: Add focus_highlight/focus_highlight_render
kjarosh File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
tests/tests/swfs/visual/focus_highlight/focus_highlight_basic/input.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
[ | ||
{ "type": "KeyDown", "key_code": 9 }, | ||
{ "type": "Wait" }, | ||
{ "type": "KeyDown", "key_code": 9 }, | ||
{ "type": "Wait" }, | ||
{ "type": "KeyDown", "key_code": 9 }, | ||
{ "type": "MouseMove", "pos": [42, 42] }, | ||
{ "type": "Wait" }, | ||
{ "type": "KeyDown", "key_code": 9 }, | ||
{ "type": "MouseDown", "pos": [42, 42], "btn": "Left" }, | ||
{ "type": "Wait" }, | ||
{ "type": "KeyDown", "key_code": 9 }, | ||
{ "type": "MouseUp", "pos": [42, 42], "btn": "Left" }, | ||
{ "type": "Wait" }, | ||
{ "type": "KeyDown", "key_code": 9 }, | ||
{ "type": "KeyDown", "key_code": 97 }, | ||
{ "type": "Wait" }, | ||
{ "type": "KeyDown", "key_code": 27 }, | ||
{ "type": "KeyDown", "key_code": 9 }, | ||
{ "type": "KeyDown", "key_code": 27 }, | ||
{ "type": "Wait" }, | ||
{ "type": "KeyDown", "key_code": 9 }, | ||
{ "type": "KeyDown", "key_code": 27 }, | ||
{ "type": "KeyDown", "key_code": 9 }, | ||
{ "type": "Wait" }, | ||
{ "type": "MouseMove", "pos": [42, 42] }, | ||
{ "type": "KeyDown", "key_code": 27 }, | ||
{ "type": "Wait" } | ||
] |
Binary file added
BIN
+1.56 KB
...al/focus_highlight/focus_highlight_basic/output.01_highlight_under.expected.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.54 KB
...ual/focus_highlight/focus_highlight_basic/output.02_highlight_over.expected.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.52 KB
...l/focus_highlight/focus_highlight_basic/output.03_after_mouse_move.expected.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.52 KB
...ual/focus_highlight/focus_highlight_basic/output.04_after_mouse_up.expected.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.52 KB
...l/focus_highlight/focus_highlight_basic/output.05_after_mouse_down.expected.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.54 KB
...ual/focus_highlight/focus_highlight_basic/output.06_after_key_down.expected.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.56 KB
...focus_highlight/focus_highlight_basic/output.07_after_focus_change.expected.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.54 KB
...ghlight/focus_highlight_basic/output.08_after_focus_change_and_tab.expected.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.56 KB
...cus_highlight_basic/output.09_after_focus_change_without_highlight.expected.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.
15 changes: 15 additions & 0 deletions
15
tests/tests/swfs/visual/focus_highlight/focus_highlight_basic/test.as
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
clip.tabEnabled = true; | ||
clip.focusEnabled = true; | ||
clip.tabIndex = 1; | ||
clip2.tabEnabled = true; | ||
clip2.focusEnabled = true; | ||
clip2.tabIndex = 2; | ||
|
||
var listener = new Object(); | ||
listener.onKeyDown = function() { | ||
if (Key.getCode() == 27) { | ||
Selection.setFocus(clip2); | ||
Selection.setFocus(clip); | ||
} | ||
}; | ||
Key.addListener(listener); |
Binary file added
BIN
+369 Bytes
tests/tests/swfs/visual/focus_highlight/focus_highlight_basic/test.swf
Binary file not shown.
40 changes: 40 additions & 0 deletions
40
tests/tests/swfs/visual/focus_highlight/focus_highlight_basic/test.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
num_ticks = 9 | ||
|
||
[image_comparisons."output.01_highlight_under"] | ||
tolerance = 0 | ||
trigger = 1 | ||
|
||
[image_comparisons."output.02_highlight_over"] | ||
tolerance = 0 | ||
trigger = 2 | ||
|
||
[image_comparisons."output.03_after_mouse_move"] | ||
tolerance = 0 | ||
trigger = 3 | ||
|
||
[image_comparisons."output.04_after_mouse_up"] | ||
tolerance = 0 | ||
trigger = 4 | ||
|
||
[image_comparisons."output.05_after_mouse_down"] | ||
tolerance = 0 | ||
trigger = 5 | ||
|
||
[image_comparisons."output.06_after_key_down"] | ||
tolerance = 0 | ||
trigger = 6 | ||
|
||
[image_comparisons."output.07_after_focus_change"] | ||
tolerance = 0 | ||
trigger = 7 | ||
|
||
[image_comparisons."output.08_after_focus_change_and_tab"] | ||
tolerance = 0 | ||
trigger = 8 | ||
|
||
[image_comparisons."output.09_after_focus_change_without_highlight"] | ||
tolerance = 0 | ||
trigger = 9 | ||
|
||
[player_options] | ||
with_renderer = { optional = false, sample_count = 1 } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using Drawing for this is going to be a little expensive on the rendering side, but realistically this isn't going to be hit enough to be noticed (I hope?)
Ideally we have a draw command that's "draw box outline" later, and let the render backend optimise that. It can make it screen-pixel perfect too, which would be nice.
Not something you need to change for this PR - just a comment!