Skip to content
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

trime.yaml 中设置悬浮窗口位置(style/layout/position)为 right 后,在 fennec f-droid 浏览器网页内输入时悬浮窗口不正常 #1372

Open
calico-cat-3333 opened this issue May 11, 2024 · 4 comments

Comments

@calico-cat-3333
Copy link

我有一台小米平板5, 搭配键盘使用,所以将 trime.yaml 中的悬浮窗口相关的设置进行调整以得到类似 PC 的输入体验,但是我发现在 fennec f-droid 浏览器的网页中表现不正常。
一开始我将键盘设置中的嵌入式编辑模式设置为“无”,此时在网页内输入,悬浮窗不显示,如下两图:
在地址栏输入,显示正常。
Screenshot_20240511-175631_Fennec

在网页中输入,不显示悬浮窗
Screenshot_20240511-175647_Fennec

偶然间将嵌入式编辑模式设置为首选,此时悬浮窗可以正常显示,但是选词后悬浮窗不会消失而是会一直显示在屏幕上,此时再按数字键不会继续选词而是直接输入数字,将嵌入式编辑模式设置为编码和输入码也是这个情况。
Screenshot_20240511-183430_Fennec

顺便一提,在 Acode 中,悬浮窗将始终显示在左上角。
Screenshot_20240511-192848

trime 版本为 v3.2.17-0-g98e201b9-release 是从 F-Droid 下载安装的。
系统为 ArrowOS 13
trime.yaml 文件的 style 部分内容如下:

style:
  auto_caps: false #自動句首大寫:true|false|ascii
  background_dim_amount: 0.5
  candidate_font: han.ttf #候選字型
  candidate_padding: 5 #候選項內邊距
  candidate_spacing: 0.5 #候選間距
  candidate_text_size: 22 #候選字號
  candidate_use_cursor: true #高亮候選項
  candidate_view_height: 24 #候選區高度
  color_scheme: default #配色方案
  comment_font: comment.ttf #編碼提示字型
  comment_height: 12 #編碼提示區高度
  comment_on_top: true #編碼提示在上方或右側
  comment_text_size: 12 #編碼提示字號
  hanb_font: hanb.ttf #擴充字型
  horizontal: true #水平模式
  horizontal_gap: 1 #鍵水平間距
  keyboard_padding: 5 #竖屏模式下,屏幕左右两侧与键盘的距离(曲面屏减少误触)
  keyboard_padding_left: 0 #竖屏屏模式下,左手键盘布局,屏幕左侧与键盘的距离
  keyboard_padding_right: 40 #竖屏屏模式下,左手键盘布局,屏幕右侧与键盘的距离
  keyboard_padding_bottom: 0 #竖屏模式下,屏幕下边缘与键盘的距离(避免误触发全面屏手势)
  keyboard_padding_land: 40 #横屏模式下,屏幕左右两侧与键盘的距离(避免横屏按键过度拉伸变形)
  keyboard_padding_land_bottom: 0 #横屏模式下,屏幕下侧与键盘的距离
  layout: #懸浮窗口設置
    position: right #位置:left|right|left_up|right_up|fixed|bottom_left|bottom_right|top_left|top_right(left、right需要>=Android5.0)
    min_length: 1 #最小詞長
    max_length: 30 #超過字數則換行
    sticky_lines: 0 #固頂行數
    sticky_lines_land: 0 #横屏模式下的固顶行数
    max_entries: 9 #最大詞條數
    min_check: 3 #只要前n个候选词有长度大于等于min_length的词,就会把长度符合以及之前的词全部加到悬浮窗内。
    all_phrases: false #所有滿足條件的詞語都顯示在窗口
    border: 2 #邊框寬度
    max_width: 1000 #最大寬度,超過則自動換行
    max_height: 900 #最大高度
    min_width: 40 #最小寬度
    min_height: 0 #最小高度
    margin_x: 5 #水平邊距 NOTE: margin_{x, y, bottom} 实际为 padding
    margin_y: 5 #豎直邊距
    margin_bottom: 0 #底部边距 (用于适配特定背景图)
    line_spacing: 0 #候选詞的行間距(px)
    line_spacing_multiplier: 1.2 #候选詞的行間距(倍數)
    real_margin: 3 #屏幕左右边缘和悬浮窗之间的距离 TODO: 在 4.0 时给 real_margin 与 spacing 换一个更适合的名字
    spacing: 1 #屏幕上下边缘或预编辑上下边缘和悬浮窗之间的距离
    round_corner: 8 #窗口圓角
    alpha: 0xdd #透明度(0-255)
    elevation: 5 #陰影(>=Android5.0)
    movable: once #是否可移動窗口,或僅移動一次 true|false|once
  window: #懸浮窗口組件
    - {start: "", move: 'ㄓ ', end: ""}
    - {start: "", composition: "%s", end: " ", letter_spacing: 0} #letter_spacing需要>=Android5.0。TODO: 不爲0時,會導致不換行的問題
    - {start: "\n", label: "%s.", candidate: "%s", comment: " %s", end: "", sep: " "}
  key_font: symbol.ttf #鍵盤字型
  key_height: 44 #鍵高
  key_long_text_size: 18 #長標籤字號
  key_text_size: 26 #鍵字號
  key_width: 10.0 #鍵寬,佔螢幕寬的百分比
  keyboards: [.default, letter, number, symbols, nokey, force_default] #鍵盤配置:自動鍵盤、字母、數字、符號、精简(供插入实体键盘使用)
  label_text_size: 26 #標籤字號
  label_font: label.ttf #編標籤字型
  latin_font: latin.ttf #西文字型
  latin_locale: en_US #西文語言
  locale: zh_TW #預設語言 zh_TW,zh_CN,zh_HK,""
  keyboard_height: 390 #锁定键盘高度,避免切换时键盘高度变化而造成闪烁
  keyboard_height_land: 270 #锁定横屏下键盘高度,避免切换时键盘高度变化而造成闪烁
  preview_font: latin.ttf #按鍵提示字型
  preview_height: 60 #按鍵提示高度
  preview_offset: -12 #按鍵提示縱向偏移
  preview_text_size: 40 #按鍵提示字號
  proximity_correction: true #按鍵糾錯
  reset_ascii_mode: false #顯示鍵盤時重置爲中文狀態
  round_corner: 8 #按鍵圓角半徑
  shadow_radius: 0.0 #按鍵陰影半徑
  speech_opencc_config: s2t.json #語音輸入簡繁轉換
  symbol_font: symbol.ttf #符號字型
  symbol_text_size: 10 #符號字號
  text_font: latin.ttf #編碼字型
  #text_height: 22 #編碼區高度
  text_size: 16 #編碼區字號
  vertical_correction: -10
  vertical_gap: 1 #鍵盤行距
  long_text_font: comment.ttf #剪贴板等可能包含大段文本使用的字体
  #background_folder: #背景图保存在background目录下的哪个子目录
  key_long_text_border: 1
  enter_label_mode: 0  #是否使用App提供的ActionLabel内容作为Enter键的文本(由于多数App没有适配ActionLable,实际影响不大)。0不使用,1只使用actionlabel,2优先使用,3当其他方式没有获得label时才读取actionlabel
  enter_labels:  # 定义Enter键的文本
    go: 前往
    done: 完成
    next: 下个
    pre:  上个
    search: 搜索
    send: 发送
    default: Enter   # 定义默认Enter键的文本
@nopdan
Copy link
Contributor

nopdan commented May 11, 2024

请使用 nightly 版本测试

@calico-cat-3333
Copy link
Author

请使用 nightly 版本测试

nightly 版本(nightly-3-g46cd7451-release)中,此问题依然存在,表现与上文描述相同。

@WhiredPlanck
Copy link
Collaborator

@calico-cat-3333 现阶段我不鼓励尝试 fixed 以外的选项(当然如果发现有其他堪用的选项可以保持)。原因是相关的逻辑代码已经至少五年内没有任何实质性的更新,但是随着 Android 系统的迭代,这些逻辑可能已不再能可靠工作。目前没有想到更好的实现。

@cabins
Copy link
Contributor

cabins commented May 14, 2024

要想让这个悬浮窗口的位置正确,可能得需要自己修改一下源码。看上去每台设备的适配情况都不一样。我使用的是vivo Pad3 Pro,在我的设备上,这个地方会崩溃。原因是获取到的maxX可能是一个负值,后来他们修复过,然后获取到的maxX就一直是0了。

所以我就自己改了一下,让maxX<0的时候赋值是屏幕的宽度。这样看上去就是正常的了(PS:我的选项是left)。但这里如上面大佬说的,可能需要考虑更好的实现。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants