image: Add zoom and scrolling support

Zoom via
- Scroll event controller
- Zoom gesture
- Overlay buttons
- Fixed zoom level shortcuts (1=100%, 2=200%)
Scrolling via
- Scrolled window
- Drag gesture
Changes
- Implement best-fit via calculating a zoom level
- Gesture for carousel no longer working because of scrolled window
- Split control overlays into two to not steal inputs in area between

Closes #17
This commit is contained in:
Sophie Herold 2022-11-10 19:39:23 +01:00
parent 73a1702c47
commit 029c0c9244
9 changed files with 952 additions and 155 deletions

View file

@ -16,8 +16,9 @@
</object>
</child>
<child type="overlay">
<object class="GtkBox" id="controls_box">
<object class="GtkBox" id="controls_box_start">
<property name="valign">end</property>
<property name="halign">start</property>
<property name="margin-start">18</property>
<property name="margin-end">18</property>
<property name="margin-top">18</property>
@ -46,9 +47,19 @@
</style>
</object>
</child>
</object>
</child>
<child type="overlay">
<object class="GtkBox" id="controls_box_end">
<property name="valign">end</property>
<property name="halign">end</property>
<property name="margin-start">18</property>
<property name="margin-end">18</property>
<property name="margin-top">18</property>
<property name="margin-bottom">18</property>
<property name="spacing">12</property>
<child>
<object class="GtkButton" id="fullscreen_button">
<property name="hexpand">True</property>
<property name="halign">end</property>
<binding name="icon-name">
<closure type="gchararray" function="get_fullscreen_icon">
@ -65,6 +76,28 @@
</style>
</object>
</child>
<child>
<object class="GtkButton" id="zoom_out">
<property name="icon-name">zoom-out-symbolic</property>
<property name="action-name">win.zoom-out</property>
<property name="tooltip-text" translatable="yes">Zoom Out</property>
<style>
<class name="osd"/>
<class name="circular"/>
</style>
</object>
</child>
<child>
<object class="GtkButton" id="zoom_in">
<property name="icon-name">zoom-in-symbolic</property>
<property name="action-name">win.zoom-in</property>
<property name="tooltip-text" translatable="yes">Zoom In</property>
<style>
<class name="osd"/>
<class name="circular"/>
</style>
</object>
</child>
</object>
</child>
</object>