Skip to content

OpenToonz - An open-source full-featured 2D animation creation software

C

Make sure opacity slider doesn't go off screen.

Martin van Zijlfbb7149b8c24
diff --git a/toonz/sources/toonz/xshcolumnviewer.cpp b/toonz/sources/toonz/xshcolumnviewer.cpp
index 5fb402e6c..3bd94006a 100644
--- a/toonz/sources/toonz/xshcolumnviewer.cpp
+++ b/toonz/sources/toonz/xshcolumnviewer.cpp
@@ -62,6 +62,7 @@
#include <QLabel>
#include <QComboBox>
#include <QPushButton>
+#include <QDesktopWidget>
#include <QBitmap>
//=============================================================================
@@ -2329,6 +2330,19 @@ void ColumnArea::mouseReleaseEvent(QMouseEvent *event) {
m_columnTransparencyPopup->move(event->globalPos().x() + x,
event->globalPos().y() - y);
+ // make sure the popup doesn't go off the screen to the right
+ QDesktopWidget *desktop = qApp->desktop();
+ QRect screenRect = desktop->screenGeometry(app->getMainWindow());
+
+ int popupLeft = event->globalPos().x() + x;
+ int popupRight = popupLeft + m_columnTransparencyPopup->width();
+
+ if (popupRight > screenRect.right()) {
+ int distance = popupRight - screenRect.right();
+ m_columnTransparencyPopup->move(m_columnTransparencyPopup->x() - distance,
+ m_columnTransparencyPopup->y());
+ }
+
openTransparencyPopup();
}
} else if (m_doOnRelease == ToggleAllPreviewVisible) {