Skip to content

Commit

Permalink
Pad progress percentage with figure space
Browse files Browse the repository at this point in the history
So that the scale width will stay the same
  • Loading branch information
johnfactotum committed Oct 26, 2023
1 parent 95f836f commit 9935d19
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/navbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import * as utils from './utils.js'
import * as format from './format.js'
import './tts.js'

const ONE_HUNDRED_PERCENT_LENGTH = format.percent(1).length

const Landmark = utils.makeDataClass('FoliateLandmark', {
'label': 'string',
'href': 'string',
Expand Down Expand Up @@ -187,6 +189,7 @@ GObject.registerClass({
this._cfi_entry.text = cfi ?? ''
this._progress_scale.update(fraction)
this._location_button.label = format.percent(fraction)
.padStart(ONE_HUNDRED_PERCENT_LENGTH, '\u2007')
this._time_book.label = format.duration(time.total)
this._time_section.label = format.duration(time.section)
this._loc_entry.text = (location.current + 1).toString()
Expand Down

0 comments on commit 9935d19

Please sign in to comment.