Make sure the scroll bar anim cannot go past 650 ms, and add a percentage of total to the line counter
This commit is contained in:
+4
-2
@@ -782,7 +782,7 @@ class GuiDocEditor(QTextEdit):
|
|||||||
# Compute the needed scroll and duration
|
# Compute the needed scroll and duration
|
||||||
pOld = vBar.value()
|
pOld = vBar.value()
|
||||||
pNew = pOld + cPos - round(mPos*0.01)
|
pNew = pOld + cPos - round(mPos*0.01)
|
||||||
aDur = 150 + round(abs(pNew - pOld)/hWid*500)
|
aDur = 150 + round(min(abs(pNew - pOld)/hWid, 1.0)*500)
|
||||||
|
|
||||||
if pNew >= 0:
|
if pNew >= 0:
|
||||||
doAnim = QPropertyAnimation(vBar, b"value", self)
|
doAnim = QPropertyAnimation(vBar, b"value", self)
|
||||||
@@ -2346,11 +2346,13 @@ class GuiDocEditFooter(QWidget):
|
|||||||
"""
|
"""
|
||||||
if self.theItem is None:
|
if self.theItem is None:
|
||||||
iLine = 0
|
iLine = 0
|
||||||
|
iDist = 0
|
||||||
else:
|
else:
|
||||||
theCursor = self.docEditor.textCursor()
|
theCursor = self.docEditor.textCursor()
|
||||||
iLine = theCursor.blockNumber() + 1
|
iLine = theCursor.blockNumber() + 1
|
||||||
|
iDist = 100*iLine/self.docEditor.qDocument.blockCount()
|
||||||
|
|
||||||
self.linesText.setText(f"Line: {iLine:n}")
|
self.linesText.setText(f"Line: {iLine:n} ({iDist:.0f}\u202f%)")
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user