Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
LatinIME
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
keyboard
LatinIME
Commits
7aea41ee
Commit
7aea41ee
authored
1 year ago
by
Aleksandras Kostarevas
Browse files
Options
Downloads
Patches
Plain Diff
Add decomposeTapPosition fallback for nonintersecting cases
parent
5e0722c9
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!7
Merge model-metadata to master
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
native/jni/src/suggest/core/layout/proximity_info.h
+28
-0
28 additions, 0 deletions
native/jni/src/suggest/core/layout/proximity_info.h
with
28 additions
and
0 deletions
native/jni/src/suggest/core/layout/proximity_info.h
+
28
−
0
View file @
7aea41ee
...
...
@@ -147,6 +147,7 @@ class ProximityInfo {
float
tapRadius
=
MOST_COMMON_KEY_WIDTH
/
1.33
f
;
float
totalArea
=
M_PI
*
((
float
)(
tapRadius
*
tapRadius
));
bool
anySet
=
false
;
for
(
int
key
=
0
;
key
<
KEY_COUNT
;
key
++
)
{
const
int
left
=
mKeyXCoordinates
[
key
];
const
int
top
=
mKeyYCoordinates
[
key
];
...
...
@@ -154,6 +155,33 @@ class ProximityInfo {
const
int
bottom
=
top
+
mKeyHeights
[
key
];
percentages
[
key
]
=
insmat
::
area
(
left
,
right
,
bottom
,
top
,
tapX
,
tapY
,
tapRadius
)
/
totalArea
;
if
(
percentages
[
key
]
>
0.05
f
)
{
anySet
=
true
;
}
}
if
(
!
anySet
)
{
// Fallback - have to pick the closest key
AKLOGE
(
"FALLBACK - Have to pick closest key"
);
int
closestKey
=
-
1
;
int
minDistance
=
1000000
;
for
(
int
key
=
0
;
key
<
KEY_COUNT
;
key
++
)
{
const
int
keyX
=
mKeyXCoordinates
[
key
];
const
int
keyY
=
mKeyYCoordinates
[
key
];
const
int
distance
=
(
keyX
-
tapX
)
*
(
keyX
-
tapX
)
+
(
keyY
-
tapY
)
*
(
keyY
-
tapY
);
if
(
distance
<
minDistance
)
{
minDistance
=
distance
;
closestKey
=
key
;
}
}
if
(
closestKey
!=
-
1
)
{
percentages
[
closestKey
]
=
1.0
f
;
}
else
{
AKLOGE
(
"Failed to find even the closest key!"
);
}
}
return
percentages
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment