Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/source/frontend
diff options
context:
space:
mode:
Diffstat (limited to 'source/frontend')
-rw-r--r--source/frontend/StarInterfaceLuaBindings.cpp4
-rw-r--r--source/frontend/StarMainInterface.cpp14
-rw-r--r--source/frontend/StarMainInterface.hpp2
3 files changed, 13 insertions, 7 deletions
diff --git a/source/frontend/StarInterfaceLuaBindings.cpp b/source/frontend/StarInterfaceLuaBindings.cpp
index 65bcd68..14b2e7c 100644
--- a/source/frontend/StarInterfaceLuaBindings.cpp
+++ b/source/frontend/StarInterfaceLuaBindings.cpp
@@ -10,8 +10,8 @@ namespace Star {
LuaCallbacks LuaBindings::makeInterfaceCallbacks(MainInterface* mainInterface) {
LuaCallbacks callbacks;
- callbacks.registerCallback("bindCanvas", [mainInterface](String const& canvasName) -> Maybe<CanvasWidgetPtr> {
- if (auto canvas = mainInterface->fetchCanvas(canvasName))
+ callbacks.registerCallback("bindCanvas", [mainInterface](String const& canvasName, Maybe<bool> ignoreInterfaceScale) -> Maybe<CanvasWidgetPtr> {
+ if (auto canvas = mainInterface->fetchCanvas(canvasName, ignoreInterfaceScale.value(false)))
return canvas;
return {};
});
diff --git a/source/frontend/StarMainInterface.cpp b/source/frontend/StarMainInterface.cpp
index 592bc6e..9a47835 100644
--- a/source/frontend/StarMainInterface.cpp
+++ b/source/frontend/StarMainInterface.cpp
@@ -796,7 +796,10 @@ void MainInterface::update() {
for (auto& pair : m_canvases) {
pair.second->setPosition(Vec2I());
- pair.second->setSize(Vec2I(m_guiContext->windowSize()));
+ if (pair.second->ignoreInterfaceScale())
+ pair.second->setSize(Vec2I(m_guiContext->windowSize()));
+ else
+ pair.second->setSize(Vec2I(m_guiContext->windowInterfaceSize()));
pair.second->update();
}
}
@@ -923,14 +926,17 @@ void MainInterface::warpTo(WarpAction const& warpAction) {
}
}
-CanvasWidgetPtr MainInterface::fetchCanvas(String const& canvasName) {
+CanvasWidgetPtr MainInterface::fetchCanvas(String const& canvasName, bool ignoreInterfaceScale) {
if (auto canvasPtr = m_canvases.ptr(canvasName))
return *canvasPtr;
else {
CanvasWidgetPtr canvas = m_canvases.emplace(canvasName, make_shared<CanvasWidget>()).first->second;
canvas->setPosition(Vec2I());
- canvas->setSize(Vec2I(m_guiContext->windowSize()));
- canvas->setIgnoreInterfaceScale(true);
+ if (ignoreInterfaceScale)
+ canvas->setSize(Vec2I(m_guiContext->windowSize()));
+ else
+ canvas->setSize(Vec2I(m_guiContext->windowInterfaceSize()));
+ canvas->setIgnoreInterfaceScale(ignoreInterfaceScale);
return canvas;
}
}
diff --git a/source/frontend/StarMainInterface.hpp b/source/frontend/StarMainInterface.hpp
index 3e05b9b..d96779d 100644
--- a/source/frontend/StarMainInterface.hpp
+++ b/source/frontend/StarMainInterface.hpp
@@ -115,7 +115,7 @@ public:
void warpToOwnShip();
void warpTo(WarpAction const& warpAction);
- CanvasWidgetPtr fetchCanvas(String const& canvasName);
+ CanvasWidgetPtr fetchCanvas(String const& canvasName, bool ignoreInterfaceScale = false);
private:
PanePtr createEscapeDialog();