MCPcopy Create free account
hub / github.com/buggins/coolreader / scrollPosToDocPos

Method scrollPosToDocPos

crengine/src/lvdocview.cpp:4457–4477  ·  view source on GitHub ↗

converts scrollbar pos to doc pos

Source from the content-addressed store, hash-verified

4455
4456/// converts scrollbar pos to doc pos
4457int LVDocView::scrollPosToDocPos(int scrollpos) {
4458 if (m_view_mode == DVM_SCROLL) {
4459 int n = scrollpos << m_scrollinfo.scale;
4460 if (n < 0)
4461 n = 0;
4462 int fh = GetFullHeight();
4463 if (n > fh)
4464 n = fh;
4465 return n;
4466 } else {
4467 int vpc = getVisiblePageCount();
4468 int n = scrollpos * vpc;
4469 if (!m_pages.length())
4470 return 0;
4471 if (n >= m_pages.length())
4472 n = m_pages.length() - 1;
4473 if (n < 0)
4474 n = 0;
4475 return m_pages[n]->start;
4476 }
4477}
4478
4479/// get list of links
4480void LVDocView::getCurrentPageLinks(ldomXRangeList & list) {

Callers 2

OnScrollMethod · 0.80
WndProcFunction · 0.80

Calls 1

lengthMethod · 0.45

Tested by 1

WndProcFunction · 0.64