You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Scrollbar cursors still aren't aligning to the grid correctly.
Example-code by Antti Riikonen:
frommathimport*# Input text has this many lines (starts at 0 because that's where you'll probably be indexing from)textHeight=200# Scrollbar has this many linesscrollbarHeight=34defscrollbarPos(textHeight, scrollbarHeight, currentHeight):
# One scrollbar line corresponds to at least this many lines of textminSegmentHeight=floor(textHeight/scrollbarHeight)
# How many extra lines we have that don't fit neatly into segments of minSegmentHeight sizeremainder=textHeight-scrollbarHeight*minSegmentHeight# Extra line is added to a scrollbar segment after each remainderSplit number of linesremainderSplit=textHeight/remainderreturnfloor((currentHeight-floor(currentHeight/remainderSplit)) /minSegmentHeight)
print("Text height: ", textHeight, ", scrollbar height: ",scrollbarHeight,", minSegmentHeight: ",floor(textHeight/scrollbarHeight),", remainder: ", textHeight-scrollbarHeight*floor(textHeight/scrollbarHeight))
foriinrange(textHeight):
print ("Line ",i,"/",textHeight,", scrollbar at ",scrollbarPos(textHeight,scrollbarHeight, i))
The text was updated successfully, but these errors were encountered:
Scrollbar cursors still aren't aligning to the grid correctly.
Example-code by Antti Riikonen:
The text was updated successfully, but these errors were encountered: