mirror of
https://github.com/xiaoqidun/ofdgo.git
synced 2026-10-29 14:53:44 +08:00
This commit is contained in:
1 parent
bf27afea13
commit
f924f008a3
9 files changed
+105
-29
No files matched your search
@@ -80,7 +80,7 @@ export class FontPicker {
|
||||
label.textContent = source;
|
||||
option.append(label);
|
||||
}
|
||||
option.title = font.name || font.fullName;
|
||||
option.title = [...new Set([font.fullName, font.name].filter(Boolean))].join(" · ");
|
||||
this.list.append(option);
|
||||
}
|
||||
if (!this.matches.length) {
|
||||
@@ -100,9 +100,9 @@ export class FontPicker {
|
||||
|
||||
position() {
|
||||
if (!this.open) return;
|
||||
const rect = this.input.getBoundingClientRect();
|
||||
const rect = this.input.parentElement.getBoundingClientRect();
|
||||
if (rect.right <= 0 || rect.left >= window.innerWidth) { this.close(); return; }
|
||||
const width = Math.min(Math.max(rect.width, 260), window.innerWidth - 16);
|
||||
const width = Math.min(rect.width, window.innerWidth - 16);
|
||||
Object.assign(this.list.style, { left: `${Math.max(8, Math.min(rect.left, window.innerWidth - width - 8))}px`,
|
||||
top: `${rect.bottom + 4}px`, width: `${width}px`, maxHeight: `${Math.max(40, Math.min(280, window.innerHeight - rect.bottom - 12))}px` });
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user