Skip to content

Commit

Permalink
fix tableview scrolling: don't reset to int value (UpdateScroll) -- n…
Browse files Browse the repository at this point in the history
…ow continuous; goosi window pos crash guard; reset FavPaths so they don't keep multiplying,
  • Loading branch information
rcoreilly committed Jan 17, 2024
1 parent baed86a commit d54055a
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
6 changes: 6 additions & 0 deletions gi/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,12 @@ func (ss *SystemSettingsData) Apply() { //gti:add
}
}

func (ss *SystemSettingsData) Open() error {
ss.FavPaths = nil // toml is just adding to this, need to reset prior
fnm := ss.Filename()
return tomls.Open(ss, fnm)
}

// TimeFormat returns the Go time format layout string that should
// be used for displaying times to the user, based on the value of
// [SystemSettingsData.Clock24].
Expand Down
2 changes: 1 addition & 1 deletion giv/sliceview.go
Original file line number Diff line number Diff line change
Expand Up @@ -1989,7 +1989,7 @@ func (sg *SliceViewGrid) ScrollChanged(d mat32.Dims, sb *gi.Slider) {
return
}
updt := sg.UpdateStart()
sv.StartIdx = int(sb.Value)
sv.StartIdx = int(mat32.Round(sb.Value))
sv.This().(SliceViewer).UpdateWidgets()
sg.UpdateEndRender(updt)
}
Expand Down
1 change: 0 additions & 1 deletion giv/tableview.go
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,6 @@ func (tv *TableView) UpdateWidgets() {
if tv.IsReadOnly() && tv.SelIdx >= 0 {
tv.SelectIdx(tv.SelIdx)
}
tv.UpdateScroll()
}

func (tv *TableView) StyleRow(w gi.Widget, idx, fidx int) {
Expand Down
3 changes: 3 additions & 0 deletions goosi/driver/desktop/window.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,9 @@ func (w *Window) GetScreenOverlap() *goosi.Screen {
func (w *Window) Position() image.Point {
w.Mu.Lock()
defer w.Mu.Unlock()
if w.Glw == nil {
return w.Pos
}
var ps image.Point
ps.X, ps.Y = w.Glw.GetPos()
w.Pos = ps
Expand Down

0 comments on commit d54055a

Please sign in to comment.