Skip to content

Commit

Permalink
Only write component change when drag ends
Browse files Browse the repository at this point in the history
Fixes #79
  • Loading branch information
Jacalz committed Nov 13, 2023
1 parent a430639 commit 0939d62
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions internal/ui/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,14 @@ func (s *settings) onCheckUpdatesChanged(selected string) {
}

func (s *settings) onComponentsChange(value float64) {
s.client.PassPhraseComponentLength = int(value)
s.preferences.SetInt("ComponentLength", s.client.PassPhraseComponentLength)
s.componentLabel.SetText(string('0' + byte(value)))
}

func (s *settings) onComponentsChangeEnded(value float64) {
s.client.PassPhraseComponentLength = int(value)
s.preferences.SetInt("ComponentLength", int(value))
}

func (s *settings) onAppIDChanged(appID string) {
s.client.AppID = appID
s.preferences.SetString("AppID", appID)
Expand Down Expand Up @@ -212,7 +215,8 @@ func (s *settings) buildUI(app fyne.App) *container.Scroll {

s.verifyRadio = &widget.RadioGroup{Options: onOffOptions, Horizontal: true, Required: true, OnChanged: s.onVerifyChanged}

s.componentSlider, s.componentLabel = &widget.Slider{Min: 2.0, Max: 6.0, Step: 1, OnChanged: s.onComponentsChange}, &widget.Label{}
s.componentSlider = &widget.Slider{Min: 2.0, Max: 6.0, Step: 1, OnChanged: s.onComponentsChange, OnChangeEnded: s.onComponentsChangeEnded}
s.componentLabel = &widget.Label{}

s.appID = widget.NewSelectEntry([]string{wormhole.WormholeCLIAppID})
s.appID.PlaceHolder = wormhole.WormholeCLIAppID
Expand Down

0 comments on commit 0939d62

Please sign in to comment.