MCPcopy Create free account
hub / github.com/SolarLune/masterplan / DrawOnTop

Method DrawOnTop

gui.go:3556–3581  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3554}
3555
3556func (s *Scrollbar) DrawOnTop() {
3557
3558 rect := s.Rect
3559 if s.WorldSpace {
3560 rect = globals.Project.Camera.TranslateRect(rect)
3561 }
3562
3563 headRect := *rect
3564
3565 if s.Vertical() {
3566 scroll := s.Rect.H*s.Value - (12 * s.Value)
3567 headRect.X = rect.X + 4
3568 headRect.Y = rect.Y + 4 + scroll
3569 } else {
3570 scroll := s.Rect.W*s.Value - (12 * s.Value)
3571 headRect.X = rect.X + 4 + scroll
3572 headRect.Y = rect.Y + 4
3573 }
3574
3575 if (s.MouseClose || s.Dragging) && s.DisplayValue {
3576 // gfx.RoundedBoxColor(globals.Renderer, x, y, x+64, y+48, 4, getThemeColor(GUICompletedColor).SDLColor())
3577
3578 DrawLabel(Vector{headRect.X - 16, headRect.Y - 16}, 1, fmt.Sprintf("%.0f%%", (s.ValueMin+(s.ValueMax-s.ValueMin)*s.TargetValue)*100), getThemeColor(GUIMenuColor))
3579 }
3580
3581}
3582
3583func (s *Scrollbar) Vertical() bool { return s.Rect.H > s.Rect.W }
3584

Callers

nothing calls this directly

Calls 4

VerticalMethod · 0.95
DrawLabelFunction · 0.85
getThemeColorFunction · 0.85
TranslateRectMethod · 0.80

Tested by

no test coverage detected