20 #ifndef OMNI_UI_MIXIN_TRANSFORMEDRECT_H
21 #define OMNI_UI_MIXIN_TRANSFORMEDRECT_H
32 template<
typename WIDGET>
47 auto _windowRect =
widget_->rect();
49 if ((_windowRect.height() == 0) ||
50 (_windowRect.width() == 0))
return 0.0;
54 if ((_desktopRect.height() == 0) ||
55 (_desktopRect.width() == 0))
return 0.0;
57 float _rectAspect = float(_desktopRect.width()) /
58 float(_desktopRect.height());
59 float _windowAspect = float(_windowRect.width()) /
60 float(_windowRect.height());
64 if (_windowAspect < _rectAspect) {
65 _factor = float(_windowRect.width()) / _desktopRect.width();
67 _factor = float(_windowRect.height()) / _desktopRect.height();
70 return _factor *
zoom();
77 auto _windowRect =
widget_->rect();
82 0.5 * (_windowRect.width() - _zoom * (_desktopRect.width())),
83 0.5 * (_windowRect.height() - _zoom * (_desktopRect.height())),
84 _zoom * _desktopRect.width(),
85 _zoom * _desktopRect.height());
98 _desktopRect.x() + _rect.x() * _zoom,
99 _desktopRect.y() + _rect.y() * _zoom,
100 _rect.width() * _zoom,
101 _rect.height() * _zoom);