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:
parent
73a1702c47
commit
029c0c9244
9 changed files with 952 additions and 155 deletions
|
|
@ -38,6 +38,18 @@
|
|||
<property name="accelerator"><Primary>q</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkShortcutsShortcut">
|
||||
<property name="title" translatable="yes" context="shortcut window">Show with orginal scale</property>
|
||||
<property name="accelerator">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkShortcutsShortcut">
|
||||
<property name="title" translatable="yes" context="shortcut window">Show with 200% of orginal scale</property>
|
||||
<property name="accelerator">2</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
|
|
|||
|
|
@ -57,45 +57,49 @@
|
|||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="LpImage" id="image">
|
||||
<child>
|
||||
<object class="GtkGestureClick" id="click_gesture">
|
||||
<property name="button">3</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkGestureLongPress" id="press_gesture">
|
||||
<property name="touch-only">True</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkPopoverMenu" id="popover">
|
||||
<property name="has-arrow">False</property>
|
||||
<property name="menu-model">image_menu</property>
|
||||
<child type="rotate-left">
|
||||
<object class="GtkButton">
|
||||
<property name="icon-name">object-rotate-left-symbolic</property>
|
||||
<property name="tooltip-text" translatable="yes">Rotate Left</property>
|
||||
<property name="action-name">win.rotate</property>
|
||||
<property name="action-target">-90.0</property>
|
||||
<style>
|
||||
<class name="flat" />
|
||||
</style>
|
||||
<object class="GtkScrolledWindow" id="scrolled_window">
|
||||
<property name="child">
|
||||
<object class="LpImage" id="image">
|
||||
<child>
|
||||
<object class="GtkGestureClick" id="click_gesture">
|
||||
<property name="button">3</property>
|
||||
</object>
|
||||
</child>
|
||||
<child type="rotate-right">
|
||||
<object class="GtkButton">
|
||||
<property name="icon-name">object-rotate-right-symbolic</property>
|
||||
<property name="tooltip-text" translatable="yes">Rotate Right</property>
|
||||
<property name="action-name">win.rotate</property>
|
||||
<property name="action-target">90.0</property>
|
||||
<style>
|
||||
<class name="flat" />
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkGestureLongPress" id="press_gesture">
|
||||
<property name="touch-only">True</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkPopoverMenu" id="popover">
|
||||
<property name="has-arrow">False</property>
|
||||
<property name="menu-model">image_menu</property>
|
||||
<child type="rotate-left">
|
||||
<object class="GtkButton">
|
||||
<property name="icon-name">object-rotate-left-symbolic</property>
|
||||
<property name="tooltip-text" translatable="yes">Rotate Left</property>
|
||||
<property name="action-name">win.rotate</property>
|
||||
<property name="action-target">-90.0</property>
|
||||
<style>
|
||||
<class name="flat" />
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
<child type="rotate-right">
|
||||
<object class="GtkButton">
|
||||
<property name="icon-name">object-rotate-right-symbolic</property>
|
||||
<property name="tooltip-text" translatable="yes">Rotate Right</property>
|
||||
<property name="action-name">win.rotate</property>
|
||||
<property name="action-target">90.0</property>
|
||||
<style>
|
||||
<class name="flat" />
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue