MCPcopy Create free account
hub / github.com/YACReader/yacreader / setContinuousScrollImpl

Method setContinuousScrollImpl

YACReader/viewer.cpp:1274–1314  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1272}
1273
1274void Viewer::setContinuousScrollImpl(bool enabled, bool persistSettings)
1275{
1276 if (continuousScroll == enabled) {
1277 return;
1278 }
1279
1280 continuousScroll = enabled;
1281 if (persistSettings) {
1282 Configuration::getConfiguration().setContinuousScroll(continuousScroll);
1283 }
1284
1285 if (continuousScroll) {
1286 continuousViewModel->setZoomFactor(zoom);
1287 if (render->hasLoadedComic()) {
1288 continuousViewModel->setViewportSize(viewport()->width(), viewport()->height());
1289 continuousViewModel->setNumPages(render->numPages());
1290 continuousPageProvider->setNumPages(render->numPages());
1291 continuousPageProvider->setRotation(continuousRotation);
1292 lastCenterPage = render->getIndex();
1293 continuousViewModel->setAnchorPage(lastCenterPage);
1294 continuousPageProvider->requestRange(lastCenterPage - 2, lastCenterPage + 4);
1295 setActiveWidget(continuousWidget);
1296 scrollToCurrentContinuousPage();
1297 continuousWidget->update();
1298 viewport()->update();
1299 }
1300 } else {
1301 // Leaving continuous mode: bring Render to the reading position so
1302 // single-page mode shows the page the user was on.
1303 if (render->hasLoadedComic() && lastCenterPage >= 0) {
1304 const int page = qBound(0, lastCenterPage, static_cast<int>(render->numPages()) - 1);
1305 if (static_cast<int>(render->getIndex()) != page) {
1306 render->goTo(page);
1307 }
1308 }
1309 lastCenterPage = -1;
1310 if (render->hasLoadedComic()) {
1311 updatePage();
1312 }
1313 }
1314}
1315
1316void Viewer::setContinuousScrollWithoutStoringSetting(bool enabled)
1317{

Callers

nothing calls this directly

Calls 12

hasLoadedComicMethod · 0.80
setViewportSizeMethod · 0.80
setAnchorPageMethod · 0.80
requestRangeMethod · 0.80
setContinuousScrollMethod · 0.45
setZoomFactorMethod · 0.45
setNumPagesMethod · 0.45
numPagesMethod · 0.45
setRotationMethod · 0.45
getIndexMethod · 0.45
updateMethod · 0.45
goToMethod · 0.45

Tested by

no test coverage detected