MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / scrollRatio

Method scrollRatio

source/windowing/StarScrollArea.cpp:168–182  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

166}
167
168float ScrollBar::scrollRatio() const {
169 if (m_parent) {
170 auto scrollArea = convert<ScrollArea>(m_parent);
171 if (m_direction == GuiDirection::Vertical) {
172 if (scrollArea->maxScrollPosition()[1] == 0)
173 return 0;
174 return scrollArea->scrollOffset()[1] / (float)(scrollArea->maxScrollPosition()[1]);
175 } else {
176 if (scrollArea->maxScrollPosition()[0] == 0)
177 return 0;
178 return scrollArea->scrollOffset()[0] / (float)(scrollArea->maxScrollPosition()[0]);
179 }
180 }
181 return 0;
182}
183
184ButtonWidgetPtr ScrollBar::forwardButton() const {
185 return m_forward;

Callers

nothing calls this directly

Calls 2

maxScrollPositionMethod · 0.80
scrollOffsetMethod · 0.80

Tested by

no test coverage detected