diff --git a/src/pyj/read_book/view.pyj b/src/pyj/read_book/view.pyj index 4b201e2f08..b60fc9c9ef 100644 --- a/src/pyj/read_book/view.pyj +++ b/src/pyj/read_book/view.pyj @@ -38,10 +38,10 @@ from viewer.constants import READER_BACKGROUND_URL add_extra_css(def(): sel = '.book-side-margin' - ans = build_rule(sel, cursor='pointer', text_align='center', height='100vh', user_select='none', display='flex', align_items='center', justify_content='center') - ans += build_rule(sel + ' > svg', display='none') - ans += build_rule(sel + ':hover > svg', display='block') - ans += build_rule(sel + ':active > svg', color=get_color('window-hover-foreground'), display='block', transform='scale(2)') + ans = build_rule(sel, cursor='pointer', text_align='center', height='100vh', user_select='none', display='flex', align_items='center', justify_content='space-between') + ans += build_rule(sel + ' > .arrow', display='none') + ans += build_rule(sel + ':hover > .arrow', display='block') + ans += build_rule(sel + ':active > .arrow', color=get_color('window-hover-foreground'), display='block', transform='scale(2)') return ans ) @@ -146,9 +146,14 @@ def margin_elem(sd, which, id, onclick, oncontextmenu): def side_margin_elem(self, sd, which): ans = E.div( - svgicon(f'caret-{which}'), style='width:{}px;'.format(sd.get(f'margin_{which}', 20)), - class_='book-side-margin', id=f'book-{which}-margin', onclick=self.side_margin_clicked.bind(None, which), - oncontextmenu=self.margin_context_menu.bind(None, which), onwheel=self.on_margin_wheel.bind(None, which)) + E.div(class_='arrow', svgicon(f'caret-{which}', '100%', '100%')), + + style='width:{}px;'.format(sd.get(f'margin_{which}', 20)), + class_='book-side-margin', id=f'book-{which}-margin', + onclick=self.side_margin_clicked.bind(None, which), + oncontextmenu=self.margin_context_menu.bind(None, which), + onwheel=self.on_margin_wheel.bind(None, which) + ) return ans @@ -549,8 +554,9 @@ class View: margin_left + margin_right + self.book_scrollbar.effective_width) set_css(m, width=val + 'px') val = min(val, 25) - m.firstChild.style.width = val + 'px' - m.firstChild.style.height = val + 'px' + s = m.querySelector('.arrow').style + s.width = val + 'px' + s.height = val + 'px' side_margin('left', margin_left), side_margin('right', margin_right) def on_iframe_ready(self, data):