@@ -47,6 +47,9 @@ import { readPipControlState, requestPipStart, requestPipStop } from "../service
4747
4848const TAB_FAVORITE = 0
4949const TAB_CLIPS = 1
50+ const KEYBOARD_ROOT_SIDE_PADDING = 6
51+ const CLIP_SCROLL_SIDE_PADDING = 8
52+ const CLIP_GRID_SPACING = 10
5053const CONFIGURABLE_BUILTIN_ACTIONS : KeyboardMenuBuiltinAction [ ] = [
5154 "base64Encode" ,
5255 "base64Decode" ,
@@ -232,6 +235,11 @@ function getOrderedKeyboardBuiltins(settings: CaisSettings): KeyboardMenuBuiltin
232235 return [ ...order , ...missing ]
233236}
234237
238+ function clipTileWidth ( ) : number {
239+ const availableWidth = Device . screen . width - KEYBOARD_ROOT_SIDE_PADDING * 2 - CLIP_SCROLL_SIDE_PADDING * 2
240+ return Math . max ( 132 , Math . floor ( ( availableWidth - CLIP_GRID_SPACING ) / 2 ) )
241+ }
242+
235243function ClipTile ( props : {
236244 item : ClipItem
237245 settings : CaisSettings
@@ -244,7 +252,7 @@ function ClipTile(props: {
244252 return (
245253 < Button
246254 buttonStyle = "plain"
247- frame = { { width : 206 , maxHeight : "infinity" as any } }
255+ frame = { { width : clipTileWidth ( ) , maxHeight : "infinity" as any } }
248256 action = { ( ) => {
249257 playClick ( )
250258 void props . onInsert ( item )
@@ -734,7 +742,7 @@ export function KeyboardView() {
734742 < VStack
735743 spacing = { 7 }
736744 frame = { { maxWidth : "infinity" , maxHeight : "infinity" } }
737- padding = { { top : 6 , bottom : 6 , leading : 6 , trailing : 6 } }
745+ padding = { { top : 6 , bottom : 6 , leading : KEYBOARD_ROOT_SIDE_PADDING , trailing : KEYBOARD_ROOT_SIDE_PADDING } }
738746 pip = { {
739747 isPresented : pipPresented ,
740748 maximumUpdatesPerSecond : 2 ,
@@ -791,12 +799,12 @@ export function KeyboardView() {
791799 axes = "horizontal"
792800 scrollIndicator = "hidden"
793801 frame = { { maxWidth : "infinity" , maxHeight : "infinity" } }
794- padding = { { leading : 8 , trailing : 8 } }
802+ padding = { { leading : CLIP_SCROLL_SIDE_PADDING , trailing : CLIP_SCROLL_SIDE_PADDING } }
795803 >
796804 { visibleItems . length ? (
797805 < LazyHGrid
798806 rows = { clipGridRows }
799- spacing = { 10 }
807+ spacing = { CLIP_GRID_SPACING }
800808 frame = { { maxHeight : "infinity" } }
801809 >
802810 < ForEach
0 commit comments