edit/crop: Implement crop apply as overlay

This commit is contained in:
Sophie Herold 2025-01-23 14:06:30 +01:00
parent 02f22816b8
commit 29e807a7b0
3 changed files with 78 additions and 72 deletions

View file

@ -46,8 +46,3 @@ lpcrop {
.discarded-area {
background: var(--discarded-background);
}
.apply-button {
margin-right: 12px;
margin-top: -6px;
}

View file

@ -214,6 +214,13 @@ mod imp {
let obj = self.obj();
obj.set_direction(gtk::TextDirection::Ltr);
self.selection.set_direction(gtk::TextDirection::Ltr);
self.handle_bottom_left
.set_direction(gtk::TextDirection::Ltr);
self.handle_bottom_right
.set_direction(gtk::TextDirection::Ltr);
self.handle_top_left.set_direction(gtk::TextDirection::Ltr);
self.handle_top_right.set_direction(gtk::TextDirection::Ltr);
// List of widgets that are drag handles
let drag_corners = std::collections::BTreeMap::from([

View file

@ -98,13 +98,33 @@
</object>
</child>
<child>
<object class="GtkGrid" id="selection">
<object class="GtkOverlay">
<property name="hexpand-set">true</property>
<property name="vexpand-set">true</property>
<layout>
<property name="row">1</property>
<property name="column">1</property>
</layout>
<child type="overlay">
<object class="GtkButton" id="apply_button">
<property name="halign">end</property>
<property name="valign">start</property>
<property name="margin-end">12</property>
<property name="margin-top">12</property>
<property name="action-name">edit-crop.apply-crop</property>
<property name="icon-name">apply-crop</property>
<property name="tooltip-text" translatable="yes">Crop Selection</property>
<style>
<class name="circular" />
<class name="osd" />
<class name="apply-button" />
</style>
</object>
</child>
<property name="child">
<object class="GtkGrid" id="selection">
<property name="hexpand-set">true</property>
<property name="vexpand-set">true</property>
<style>
<class name="selection" />
</style>
@ -128,7 +148,7 @@
<property name="hexpand">true</property>
<layout>
<property name="row">0</property>
<property name="column">2</property>
<property name="column">1</property>
</layout>
<style>
<class name="handle" />
@ -136,30 +156,12 @@
</style>
</object>
</child>
<child>
<object class="GtkButton" id="apply_button">
<property name="hexpand">true</property>
<layout>
<property name="row">1</property>
<property name="column">2</property>
</layout>
<property name="action-name">edit-crop.apply-crop</property>
<property name="icon-name">apply-crop</property>
<property name="halign">end</property>
<property name="valign">start</property>
<style>
<class name="circular" />
<class name="osd" />
<class name="apply-button" />
</style>
</object>
</child>
<child>
<object class="AdwBin" id="handle_bottom_left">
<property name="valign">end</property>
<property name="vexpand">true</property>
<layout>
<property name="row">2</property>
<property name="row">1</property>
<property name="column">0</property>
</layout>
<style>
@ -175,8 +177,8 @@
<property name="valign">end</property>
<property name="vexpand">true</property>
<layout>
<property name="row">2</property>
<property name="column">2</property>
<property name="row">1</property>
<property name="column">1</property>
</layout>
<style>
<class name="handle" />
@ -185,6 +187,8 @@
</object>
</child>
</object>
</property>
</object>
</child>
</template>
</interface>