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
f608d67f
Commit
f608d67f
authored
5 months ago
by
Aleksandras Kostarevas
Browse files
Options
Downloads
Patches
Plain Diff
Make left of A and right of L tappable again (on qwerty)
parent
fe1b99d8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
java/src/org/futo/inputmethod/v2keyboard/LayoutEngine.kt
+27
-5
27 additions, 5 deletions
java/src/org/futo/inputmethod/v2keyboard/LayoutEngine.kt
with
27 additions
and
5 deletions
java/src/org/futo/inputmethod/v2keyboard/LayoutEngine.kt
+
27
−
5
View file @
f608d67f
...
...
@@ -476,8 +476,10 @@ data class LayoutEngine(
}
}
private
fun
addKey
(
data
:
ComputedKeyData
,
x
:
Int
,
y
:
Int
,
width
:
Int
,
height
:
Int
)
{
// Gap
private
fun
addKey
(
data
:
ComputedKeyData
,
x
:
Int
,
y
:
Int
,
width
:
Int
,
height
:
Int
,
leftGap
:
LayoutEntry
.
Gap
?,
rightGap
:
LayoutEntry
.
Gap
?)
{
// These keys are empty keys and do not get added, leaving an empty gap in place of the key
// The hitbox of other keys does not get expanded to include this gap though, unlike
// gaps added for centering rows
if
(
data
.
label
.
isEmpty
()
&&
data
.
icon
.
isEmpty
()
&&
data
.
code
==
Constants
.
CODE_UNSPECIFIED
)
return
...
...
@@ -510,7 +512,21 @@ data class LayoutEngine(
moreKeysColumnAndFlags
=
data
.
moreKeyFlags
,
visualStyle
=
data
.
style
,
outputText
=
data
.
outputText
,
hintLabel
=
data
.
hint
.
ifEmpty
{
null
}
hintLabel
=
data
.
hint
.
ifEmpty
{
null
},
// Add leftGap and rightGap to the hitbox
// This makes the following area tappable,
// otherwise taps there wouldn't be registered
// q w e r t y u i o p
// #a s d f g h j k l#
// ^ ^
// taps A taps L
hitBox
=
Rect
(
x
-
(
leftGap
?.
widthPx
?.
roundToInt
()
?:
0
),
y
,
x
+
width
+
(
leftGap
?.
widthPx
?.
roundToInt
()
?:
0
)
+
(
rightGap
?.
widthPx
?.
roundToInt
()
?:
0
),
y
+
height
),
)
params
.
onAddKey
(
key
)
...
...
@@ -518,10 +534,16 @@ data class LayoutEngine(
private
fun
addRow
(
row
:
List
<
LayoutEntry
>,
x
:
Float
,
y
:
Int
,
height
:
Int
)
{
var
currentX
=
x
row
.
forEach
{
entry
->
row
.
forEach
Indexed
{
i
,
entry
->
when
(
entry
)
{
is
LayoutEntry
.
Gap
->
{
}
is
LayoutEntry
.
Key
->
addKey
(
entry
.
data
,
currentX
.
roundToInt
(),
y
,
entry
.
widthPx
.
roundToInt
(),
height
)
is
LayoutEntry
.
Key
->
{
// Adding gaps is only applicable on unanchored keys on the correct side of the keyboard
val
leftGap
=
if
(
i
<
row
.
size
/
2
&&
!
entry
.
data
.
anchored
)
{
row
.
getOrNull
(
i
-
1
)
as
?
LayoutEntry
.
Gap
}
else
{
null
}
val
rightGap
=
if
(
i
>=
row
.
size
/
2
&&
!
entry
.
data
.
anchored
)
{
row
.
getOrNull
(
i
+
1
)
as
?
LayoutEntry
.
Gap
}
else
{
null
}
addKey
(
entry
.
data
,
currentX
.
roundToInt
(),
y
,
entry
.
widthPx
.
roundToInt
(),
height
,
leftGap
,
rightGap
)
}
}
currentX
+=
entry
.
widthPx
...
...
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