-
Notifications
You must be signed in to change notification settings - Fork 134
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
app: [js] fix tabbing #116
Open
inkeliz
wants to merge
5
commits into
gioui:main
Choose a base branch
from
inkeliz:fix-tab
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
cb12116
internal/stroke: tiny optimization to approxCubeTo
egonelbre 2176fed
internal/stroke: add BenchmarkSplitCubic
egonelbre 47384fd
internal/stroke: optimize SplitCubic
egonelbre ef78b70
app: [js] fix tabbing
inkeliz 1934b4f
widget: request software-keyboard on focus
inkeliz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
// SPDX-License-Identifier: Unlicense OR MIT | ||
|
||
package stroke | ||
|
||
import ( | ||
"strconv" | ||
"testing" | ||
|
||
"gioui.org/internal/f32" | ||
) | ||
|
||
func BenchmarkSplitCubic(b *testing.B) { | ||
type scenario struct { | ||
segments int | ||
from, ctrl0, ctrl1, to f32.Point | ||
} | ||
|
||
scenarios := []scenario{ | ||
{ | ||
segments: 4, | ||
from: f32.Pt(0, 0), | ||
ctrl0: f32.Pt(10, 10), | ||
ctrl1: f32.Pt(10, 10), | ||
to: f32.Pt(20, 0), | ||
}, | ||
{ | ||
segments: 8, | ||
from: f32.Pt(-145.90305, 703.21277), | ||
ctrl0: f32.Pt(-940.20215, 606.05994), | ||
ctrl1: f32.Pt(74.58341, 405.815), | ||
to: f32.Pt(104.35474, -241.543), | ||
}, | ||
{ | ||
segments: 16, | ||
from: f32.Pt(770.35626, 639.77765), | ||
ctrl0: f32.Pt(735.57135, 545.07837), | ||
ctrl1: f32.Pt(286.7138, 853.7052), | ||
to: f32.Pt(286.7138, 890.5413), | ||
}, | ||
{ | ||
segments: 33, | ||
from: f32.Pt(0, 0), | ||
ctrl0: f32.Pt(0, 0), | ||
ctrl1: f32.Pt(100, 100), | ||
to: f32.Pt(100, 100), | ||
}, | ||
} | ||
|
||
for _, s := range scenarios { | ||
s := s | ||
b.Run(strconv.Itoa(s.segments), func(b *testing.B) { | ||
from, ctrl0, ctrl1, to := s.from, s.ctrl0, s.ctrl1, s.to | ||
quads := make([]QuadSegment, s.segments) | ||
b.ResetTimer() | ||
for i := 0; i < b.N; i++ { | ||
quads = SplitCubic(from, ctrl0, ctrl1, to, quads[:0]) | ||
} | ||
if len(quads) != s.segments { | ||
// this is just for checking that we are benchmarking similar splits | ||
// when splitting algorithm splits differently, then it's fine to adjust the | ||
// parameters to give appropriate number of segments. | ||
b.Fatalf("expected %d but got %d", s.segments, len(quads)) | ||
} | ||
}) | ||
} | ||
} |
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
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.
Can you expand the commit message to say what issue this fixes? Is there a TODO number?
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.
Without that change TAB on browser will switch the focus to another input (which is expected!), but the focus is removed, in the next frame.
Currently, on JS, Gio focus/blur one input based on
SoftKeyboardOp
, even on desktop.Previously, SoftKeyboardOp is requested using
requestFocus
, which happens only after clicking into the input. However, when the focus shifts to another input without clicking (which is the tabbing case): it don't triggersrequestFocus
, then it doesn't useSoftKeyboardOp
.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.
This losing of focus after TAB sounds like a browser-only issue, correct? If so, can it be fixed in
os_js.go
soEditor
doesn't need to know?