mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-23 00:25:57 +01:00
parent
93d0511471
commit
132ab8d035
1 changed files with 27 additions and 10 deletions
|
@ -65,12 +65,27 @@ void SLayerSurface::applyRules() {
|
|||
void SLayerSurface::startAnimation(bool in, bool instant) {
|
||||
const auto ANIMSTYLE = animationStyle.value_or(realPosition.m_pConfig->pValues->internalStyle);
|
||||
|
||||
if (ANIMSTYLE == "slide") {
|
||||
if (ANIMSTYLE.starts_with("slide")) {
|
||||
// get closest edge
|
||||
const auto MIDDLE = geometry.middle();
|
||||
|
||||
const auto PMONITOR = g_pCompositor->getMonitorFromVector(MIDDLE);
|
||||
|
||||
int force = -1;
|
||||
|
||||
CVarList args(ANIMSTYLE, 0, 's');
|
||||
if (args.size() > 1) {
|
||||
const auto ARG2 = args[1];
|
||||
if (ARG2 == "top")
|
||||
force = 0;
|
||||
else if (ARG2 == "bottom")
|
||||
force = 1;
|
||||
else if (ARG2 == "left")
|
||||
force = 2;
|
||||
else if (ARG2 == "right")
|
||||
force = 3;
|
||||
}
|
||||
|
||||
const std::array<Vector2D, 4> edgePoints = {
|
||||
PMONITOR->vecPosition + Vector2D{PMONITOR->vecSize.x / 2, 0},
|
||||
PMONITOR->vecPosition + Vector2D{PMONITOR->vecSize.x / 2, PMONITOR->vecSize.y},
|
||||
|
@ -79,7 +94,8 @@ void SLayerSurface::startAnimation(bool in, bool instant) {
|
|||
};
|
||||
|
||||
float closest = std::numeric_limits<float>::max();
|
||||
size_t leader = 0;
|
||||
int leader = force;
|
||||
if (leader == -1) {
|
||||
for (size_t i = 0; i < 4; ++i) {
|
||||
float dist = MIDDLE.distance(edgePoints[i]);
|
||||
if (dist < closest) {
|
||||
|
@ -87,6 +103,7 @@ void SLayerSurface::startAnimation(bool in, bool instant) {
|
|||
closest = dist;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
realSize.setValueAndWarp(geometry.size());
|
||||
alpha.setValueAndWarp(in ? 0.f : 1.f);
|
||||
|
|
Loading…
Reference in a new issue