MCPcopy Create free account
hub / github.com/cogentcore/core / scrollActionDelta

Method scrollActionDelta

core/scroll.go:202–213  ·  view source on GitHub ↗

scrollActionDelta moves the scrollbar in given dimension by given delta. returns whether actually scrolled.

(d math32.Dims, delta float32)

Source from the content-addressed store, hash-verified

200// scrollActionDelta moves the scrollbar in given dimension by given delta.
201// returns whether actually scrolled.
202func (fr *Frame) scrollActionDelta(d math32.Dims, delta float32) bool {
203 if fr.HasScroll[d] && fr.scrolls[d] != nil {
204 sb := fr.scrolls[d]
205 nval := sb.Value + sb.scrollScale(delta)
206 chg := sb.setValueEvent(nval)
207 if chg {
208 fr.NeedsRender() // only render needed -- scroll updates pos
209 }
210 return chg
211 }
212 return false
213}
214
215// scrollDelta processes a scroll event. If only one dimension is processed,
216// and there is a non-zero in other, then the consumed dimension is reset to 0

Callers 1

scrollDeltaMethod · 0.95

Calls 3

scrollScaleMethod · 0.80
NeedsRenderMethod · 0.80
setValueEventMethod · 0.45

Tested by

no test coverage detected