MCPcopy
hub / github.com/ollm/OpenComic / calculateView

Function calculateView

scripts/reading.js:671–782  ·  view source on GitHub ↗
(first = false)

Source from the content-addressed store, hash-verified

669var rightSize = {}; // Right content size
670
671function calculateView(first = false)
672{
673 let contentRight = template._contentRight();
674
675 let content = contentRight.firstElementChild;
676 let rect = content.getBoundingClientRect();
677
678 rightSize = {
679 height: rect.height,
680 width: rect.width,
681 top: rect.top,
682 left: rect.left,
683 // readingRect: content.querySelector('.reading-body').getBoundingClientRect(),
684 scrollHeight: content.scrollHeight,
685 };
686
687 if(readingViewIs('compact'))
688 {
689 dom.this(contentRight).find('.reading-body > div, .reading-lens > div > div', true).css({
690 width: rect.width+'px',
691 height: rect.height+'px',
692 flexDirection: '',
693 }).addClass('compact', readingView());
694 }
695 else if(readingViewIs('slide'))
696 {
697 dom.this(contentRight).find('.reading-body > div, .reading-lens > div > div', true).css({
698 width: (rect.width * indexNum)+'px',
699 height: rect.height+'px',
700 flexDirection: '',
701 }).removeClass('compact', 'fade', 'rough-page-turn', 'smooth-page-turn');
702 }
703 else if(readingViewIs('scroll'))
704 {
705 dom.this(contentRight).find('.reading-body > div').css({
706 width: '100%',
707 flexDirection: 'column',
708 }).removeClass('compact', 'fade', 'rough-page-turn', 'smooth-page-turn');
709
710 dom.this(contentRight).find('.reading-lens > div > div').css({
711 width: rect.width+'px',
712 flexDirection: 'column',
713 }).removeClass('compact', 'fade', 'rough-page-turn', 'smooth-page-turn');
714
715 rect = content.getBoundingClientRect();
716
717 rightSize = {
718 height: rect.height,
719 width: rect.width,
720 top: rect.top,
721 left: rect.left,
722 // readingRect: content.querySelector('.reading-body').getBoundingClientRect(),
723 scrollHeight: content.scrollHeight,
724 };
725 }
726
727 if(readingViewIs('scroll'))
728 {

Callers 6

applyScaleFunction · 0.85
resizedFunction · 0.85
changePagesViewFunction · 0.85
fastUpdateEbookPagesFunction · 0.85
generateEbookPagesFunction · 0.85
readFunction · 0.85

Calls 3

readingViewIsFunction · 0.85
readingViewFunction · 0.85
readingMarginFunction · 0.85

Tested by

no test coverage detected