mirror of
https://gitlab.freedesktop.org/pipewire/helvum
synced 2026-03-15 19:46:10 +08:00
graph: Move port link anchor calculation into port widget
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
use gtk::{
|
||||
gdk,
|
||||
glib::{self, clone, subclass::Signal},
|
||||
graphene,
|
||||
prelude::*,
|
||||
subclass::prelude::*,
|
||||
};
|
||||
@@ -223,4 +224,20 @@ impl Port {
|
||||
.get()
|
||||
.expect("Port direction is not set")
|
||||
}
|
||||
|
||||
pub fn link_anchor(&self) -> graphene::Point {
|
||||
let style_context = self.style_context();
|
||||
let padding_right: f32 = style_context.padding().right().into();
|
||||
let border_right: f32 = style_context.border().right().into();
|
||||
let padding_left: f32 = style_context.padding().left().into();
|
||||
let border_left: f32 = style_context.border().left().into();
|
||||
|
||||
graphene::Point::new(
|
||||
match self.direction() {
|
||||
Direction::Output => self.width() as f32 + padding_right + border_right,
|
||||
Direction::Input => 0.0 - padding_left - border_left,
|
||||
},
|
||||
self.height() as f32 / 2.0,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user