mirror of
https://github.com/edubart/otclient.git
synced 2025-10-14 11:34:54 +02:00
Option: Don't Stretch/Shrink Game Window
Sets gameMapPanel to size 480 x 352 Prevents resizing.
This commit is contained in:
@@ -10,6 +10,7 @@ mouseGrabberWidget = nil
|
||||
countWindow = nil
|
||||
logoutWindow = nil
|
||||
exitWindow = nil
|
||||
bottomSplitter = nil
|
||||
|
||||
function init()
|
||||
g_ui.importStyle('styles/countwindow.otui')
|
||||
@@ -25,6 +26,7 @@ function init()
|
||||
mouseGrabberWidget = gameRootPanel:getChildById('mouseGrabber')
|
||||
mouseGrabberWidget.onMouseRelease = onMouseGrabberRelease
|
||||
|
||||
bottomSplitter = gameRootPanel:getChildById('bottomSplitter')
|
||||
gameMapPanel = gameRootPanel:getChildById('gameMapPanel')
|
||||
gameRightPanel = gameRootPanel:getChildById('gameRightPanel')
|
||||
gameLeftPanel = gameRootPanel:getChildById('gameLeftPanel')
|
||||
@@ -90,6 +92,7 @@ function show()
|
||||
gameRootPanel:show()
|
||||
gameRootPanel:focus()
|
||||
gameMapPanel:followCreature(g_game.getLocalPlayer())
|
||||
updateStretchShrink()
|
||||
end
|
||||
|
||||
function hide()
|
||||
@@ -187,6 +190,16 @@ function smartWalk(defaultDir)
|
||||
end
|
||||
end
|
||||
|
||||
function updateStretchShrink()
|
||||
if Options.getOption('dontStretchShrink') then
|
||||
gameMapPanel:setKeepAspectRatio(true)
|
||||
gameMapPanel:setVisibleDimension({ width = 15, height = 11 })
|
||||
|
||||
-- Set gameMapPanel size to height = 11 * 32
|
||||
bottomSplitter:setMarginBottom(bottomSplitter:getMarginBottom() + (gameMapPanel:getHeight() - 32 * 11) - 10)
|
||||
end
|
||||
end
|
||||
|
||||
function toggleAspectRatio()
|
||||
if gameMapPanel:isKeepAspectRatioEnabled() then
|
||||
gameMapPanel:setKeepAspectRatio(false)
|
||||
|
@@ -63,7 +63,7 @@ UIWidget
|
||||
anchors.bottom: parent.bottom
|
||||
relative-margin: bottom
|
||||
margin-bottom: 172
|
||||
@canUpdateMargin: function(self, newMargin) return math.max(math.min(newMargin, self:getParent():getHeight() - 300), 100) end
|
||||
@canUpdateMargin: function(self, newMargin) if Options.getOption('dontStretchShrink') then return self:getMarginBottom() end return math.max(math.min(newMargin, self:getParent():getHeight() - 300), 100) end
|
||||
@onGeometryChange: function(self) self:setMarginBottom(math.min(math.max(self:getParent():getHeight() - 300, 100), self:getMarginBottom())) end
|
||||
|
||||
UIWidget
|
||||
|
Reference in New Issue
Block a user