This commit is contained in:
恍兮惚兮 2024-06-21 21:15:46 +08:00
parent 3dd1cb295b
commit 7010cdac42
2 changed files with 36 additions and 11 deletions

View File

@ -120,13 +120,26 @@ class saveposwindow(QMainWindow):
super().__init__(parent, flags=flags) super().__init__(parent, flags=flags)
else: else:
super().__init__(parent) super().__init__(parent)
d = QApplication.primaryScreen()
self.poslist = poslist self.poslist = poslist
if self.poslist: if self.poslist:
poslist[2] = max(0, min(poslist[2], d.size().width())) contains = False
poslist[3] = max(0, min(poslist[3], d.size().height())) usescreen = QApplication.primaryScreen()
poslist[0] = min(max(poslist[0], 0), d.size().width() - poslist[2]) for screen in QApplication.screens():
poslist[1] = min(max(poslist[1], 0), d.size().height() - poslist[3]) if not screen.geometry().contains(QPoint(poslist[0], poslist[1])):
continue
contains = True
usescreen = screen
break
poslist[2] = max(0, min(poslist[2], usescreen.size().width()))
poslist[3] = max(0, min(poslist[3], usescreen.size().height()))
if not contains:
poslist[0] = min(
max(poslist[0], 0), usescreen.size().width() - poslist[2]
)
poslist[1] = min(
max(poslist[1], 0), usescreen.size().height() - poslist[3]
)
self.setGeometry(*poslist) self.setGeometry(*poslist)
def __checked_savepos(self): def __checked_savepos(self):

View File

@ -201,13 +201,13 @@
ele.style.textAlign = "center" ele.style.textAlign = "center"
let tags = _splittags(tag) let tags = _splittags(tag)
tags.forEach(tag => { tags.forEach(tag => {
let ruby = document.createElement('ruby') let mayberuby = []
tag.forEach(word => { tag.forEach(word => {
let eleori = regist_style_imp[style](styleargs, word.orig, { atcenter: true, fontFamily: fmori, fontSize: fsori, bold: boldori, color: color, lineHeight: line_height }) let eleori = regist_style_imp[style](styleargs, word.orig, { atcenter: true, fontFamily: fmori, fontSize: fsori, bold: boldori, color: color, lineHeight: line_height })
if (isshow_fenci || isfenciclick) { if (isshow_fenci || isfenciclick) {
let div = document.createElement('div') let div = document.createElement('div')
div.style.display='inline-block'
div.id = _simpleuid() div.id = _simpleuid()
let style = document.createElement('style') let style = document.createElement('style')
if (isshow_fenci) if (isshow_fenci)
@ -228,9 +228,9 @@
div.appendChild(style) div.appendChild(style)
div.appendChild(eleori) div.appendChild(eleori)
ruby.appendChild(div) mayberuby.push(div)
} else } else
ruby.appendChild(eleori) mayberuby.push(div)
if (isshowhira) { if (isshowhira) {
let rt = document.createElement('rt') let rt = document.createElement('rt')
@ -238,10 +238,22 @@
rt.appendChild(regist_style_imp[style](styleargs, word.hira, { atcenter: true, fontFamily: fmkana, fontSize: fskana, bold: boldkana, color: kanacolor, lineHeight: 0 })) rt.appendChild(regist_style_imp[style](styleargs, word.hira, { atcenter: true, fontFamily: fmkana, fontSize: fskana, bold: boldkana, color: kanacolor, lineHeight: 0 }))
} }
ruby.appendChild(rt) mayberuby.push(rt)
} }
}) })
ele.appendChild(ruby) if (isshowhira) {
let ruby = document.createElement('ruby')
mayberuby.forEach(e => {
ruby.appendChild(e)
});
ele.appendChild(ruby)
}
else {
mayberuby.forEach(e => {
ele.appendChild(e)
});
}
ele.appendChild(document.createElement('br')) ele.appendChild(document.createElement('br'))
}) })
safe_calllunaheightchange(document.getElementById(rootdivid).offsetHeight) safe_calllunaheightchange(document.getElementById(rootdivid).offsetHeight)