mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-23 19:45:58 +01:00
better
This commit is contained in:
parent
276652b44e
commit
d3e26652d6
1 changed files with 46 additions and 47 deletions
|
@ -114,58 +114,57 @@ void CWorkspace::startAnim(bool in, bool left, bool instant) {
|
||||||
m_fAlpha = in ? 1.F : 0.F;
|
m_fAlpha = in ? 1.F : 0.F;
|
||||||
|
|
||||||
// handle animation styles for the movement one
|
// handle animation styles for the movement one
|
||||||
if (ANIMSTYLE.starts_with("slide") && ANIMSTYLE.contains("%")) {
|
if (m_vRenderOffset.m_pConfig->pValues->internalEnabled) {
|
||||||
const auto PMONITOR = g_pCompositor->getMonitorFromID(m_iMonitorID);
|
if (ANIMSTYLE.starts_with("slide") && ANIMSTYLE.contains("%")) {
|
||||||
float movePerc = 0.F;
|
const auto PMONITOR = g_pCompositor->getMonitorFromID(m_iMonitorID);
|
||||||
|
float movePerc = 0.F;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
auto percstr = ANIMSTYLE.substr(ANIMSTYLE.find_last_of(' ') + 1);
|
auto percstr = ANIMSTYLE.substr(ANIMSTYLE.find_last_of(' ') + 1);
|
||||||
movePerc = std::stoi(percstr.substr(0, percstr.length() - 1));
|
movePerc = std::stoi(percstr.substr(0, percstr.length() - 1));
|
||||||
} catch (std::exception& e) { Debug::log(ERR, "Error in startAnim: invalid percentage"); }
|
} catch (std::exception& e) { Debug::log(ERR, "Error in startAnim: invalid percentage"); }
|
||||||
|
|
||||||
m_vRenderOffset.setValueAndWarp(Vector2D(0, 0));
|
m_vRenderOffset.setValueAndWarp(Vector2D(0, 0));
|
||||||
m_fScaleClients.setValueAndWarp(1.F);
|
|
||||||
|
|
||||||
if (ANIMSTYLE.starts_with("slidevert")) {
|
|
||||||
if (in) {
|
|
||||||
m_vRenderOffset.setValueAndWarp(Vector2D(0.0, (left ? PMONITOR->vecSize.y : -PMONITOR->vecSize.y) * (movePerc / 100.f)));
|
|
||||||
m_vRenderOffset = Vector2D(0, 0);
|
|
||||||
} else
|
|
||||||
m_vRenderOffset = Vector2D(0.0, (left ? -PMONITOR->vecSize.y : PMONITOR->vecSize.y) * (movePerc / 100.f));
|
|
||||||
|
|
||||||
} else {
|
|
||||||
if (in) {
|
|
||||||
m_vRenderOffset.setValueAndWarp(Vector2D((left ? PMONITOR->vecSize.x : -PMONITOR->vecSize.x) * (movePerc / 100.f), 0.0));
|
|
||||||
m_vRenderOffset = Vector2D(0, 0);
|
|
||||||
} else
|
|
||||||
m_vRenderOffset = Vector2D((left ? -PMONITOR->vecSize.x : PMONITOR->vecSize.x) * (movePerc / 100.f), 0.0);
|
|
||||||
}
|
|
||||||
} else if (ANIMSTYLE.starts_with("popin")) {
|
|
||||||
m_vRenderOffset.setValueAndWarp(Vector2D(0, 0));
|
|
||||||
|
|
||||||
float startPerc = 0.F;
|
|
||||||
|
|
||||||
try {
|
|
||||||
auto percstr = ANIMSTYLE.substr(ANIMSTYLE.find_last_of(' ') + 1);
|
|
||||||
startPerc = std::stoi(percstr.substr(0, percstr.length() - 1));
|
|
||||||
} catch (std::exception& e) { Debug::log(ERR, "Error in startAnim: invalid percentage"); }
|
|
||||||
|
|
||||||
if (in) {
|
|
||||||
m_fScaleClients.setValueAndWarp(startPerc / 100.F);
|
|
||||||
m_fScaleClients = 1.F;
|
|
||||||
} else {
|
|
||||||
m_fScaleClients.setValueAndWarp(1.F);
|
m_fScaleClients.setValueAndWarp(1.F);
|
||||||
m_fScaleClients = startPerc / 100.F;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// fallback is slide
|
|
||||||
const auto PMONITOR = g_pCompositor->getMonitorFromID(m_iMonitorID);
|
|
||||||
const auto XDISTANCE = PMONITOR->vecSize.x + *PWORKSPACEGAP;
|
|
||||||
|
|
||||||
m_fScaleClients.setValueAndWarp(1.F);
|
if (ANIMSTYLE.starts_with("slidevert")) {
|
||||||
|
if (in) {
|
||||||
|
m_vRenderOffset.setValueAndWarp(Vector2D(0.0, (left ? PMONITOR->vecSize.y : -PMONITOR->vecSize.y) * (movePerc / 100.f)));
|
||||||
|
m_vRenderOffset = Vector2D(0, 0);
|
||||||
|
} else
|
||||||
|
m_vRenderOffset = Vector2D(0.0, (left ? -PMONITOR->vecSize.y : PMONITOR->vecSize.y) * (movePerc / 100.f));
|
||||||
|
|
||||||
|
} else {
|
||||||
|
if (in) {
|
||||||
|
m_vRenderOffset.setValueAndWarp(Vector2D((left ? PMONITOR->vecSize.x : -PMONITOR->vecSize.x) * (movePerc / 100.f), 0.0));
|
||||||
|
m_vRenderOffset = Vector2D(0, 0);
|
||||||
|
} else
|
||||||
|
m_vRenderOffset = Vector2D((left ? -PMONITOR->vecSize.x : PMONITOR->vecSize.x) * (movePerc / 100.f), 0.0);
|
||||||
|
}
|
||||||
|
} else if (ANIMSTYLE.starts_with("popin")) {
|
||||||
|
m_vRenderOffset.setValueAndWarp(Vector2D(0, 0));
|
||||||
|
|
||||||
|
float startPerc = 0.F;
|
||||||
|
|
||||||
|
try {
|
||||||
|
auto percstr = ANIMSTYLE.substr(ANIMSTYLE.find_last_of(' ') + 1);
|
||||||
|
startPerc = std::stoi(percstr.substr(0, percstr.length() - 1));
|
||||||
|
} catch (std::exception& e) { Debug::log(ERR, "Error in startAnim: invalid percentage"); }
|
||||||
|
|
||||||
|
if (in) {
|
||||||
|
m_fScaleClients.setValueAndWarp(startPerc / 100.F);
|
||||||
|
m_fScaleClients = 1.F;
|
||||||
|
} else {
|
||||||
|
m_fScaleClients.setValueAndWarp(1.F);
|
||||||
|
m_fScaleClients = startPerc / 100.F;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// fallback is slide
|
||||||
|
const auto PMONITOR = g_pCompositor->getMonitorFromID(m_iMonitorID);
|
||||||
|
const auto XDISTANCE = PMONITOR->vecSize.x + *PWORKSPACEGAP;
|
||||||
|
|
||||||
|
m_fScaleClients.setValueAndWarp(1.F);
|
||||||
|
|
||||||
// special case: fade enabled but this anim is disabled, so don't change anything. Only do the anim otherwise.
|
|
||||||
if (m_vRenderOffset.m_pConfig->pValues->internalEnabled || !m_fAlpha.m_pConfig->pValues->internalEnabled) {
|
|
||||||
if (in) {
|
if (in) {
|
||||||
m_vRenderOffset.setValueAndWarp(Vector2D(left ? XDISTANCE : -XDISTANCE, 0.0));
|
m_vRenderOffset.setValueAndWarp(Vector2D(left ? XDISTANCE : -XDISTANCE, 0.0));
|
||||||
m_vRenderOffset = Vector2D(0, 0);
|
m_vRenderOffset = Vector2D(0, 0);
|
||||||
|
|
Loading…
Reference in a new issue