Revert "fixed layout resizing"
This reverts commit 6f84898a5d4c7bc96e682e5b08ba3973ce36d4fa.
This commit is contained in:
@@ -1504,10 +1504,8 @@ function Element:update(dt)
|
|||||||
local by = self.y
|
local by = self.y
|
||||||
if mx >= bx and mx <= bx + self.width and my >= by and my <= by + self.height then
|
if mx >= bx and mx <= bx + self.width and my >= by and my <= by + self.height then
|
||||||
if love.mouse.isDown(1) then
|
if love.mouse.isDown(1) then
|
||||||
-- set pressed flag
|
|
||||||
self.pressed = true
|
self.pressed = true
|
||||||
elseif not love.mouse.isDown(1) and self.pressed then
|
elseif not love.mouse.isDown(1) and self._pressed then
|
||||||
Logger:debug("calling callback")
|
|
||||||
self.callback(self)
|
self.callback(self)
|
||||||
self.pressed = false
|
self.pressed = false
|
||||||
end
|
end
|
||||||
@@ -1606,7 +1604,7 @@ function Element:resize(newGameWidth, newGameHeight)
|
|||||||
|
|
||||||
-- Recursively resize children
|
-- Recursively resize children
|
||||||
for _, child in ipairs(self.children) do
|
for _, child in ipairs(self.children) do
|
||||||
child:resize(newGameWidth, newGameHeight)
|
child:resize(ratioW, ratioH)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Re-layout children after resizing
|
-- Re-layout children after resizing
|
||||||
|
|||||||
@@ -1,36 +0,0 @@
|
|||||||
-- Test current font behavior during resize
|
|
||||||
package.path = package.path .. ";?.lua"
|
|
||||||
|
|
||||||
require("testing/loveStub") -- Required to mock LOVE functions
|
|
||||||
local FlexLove = require("FlexLove")
|
|
||||||
local Gui = FlexLove.GUI
|
|
||||||
|
|
||||||
local function testCurrentFontBehavior()
|
|
||||||
print("=== Testing Current Font Behavior During Resize ===")
|
|
||||||
|
|
||||||
Gui.destroy() -- Clean slate
|
|
||||||
|
|
||||||
-- Create element with text and specific font size
|
|
||||||
local element = Gui.new({
|
|
||||||
id = "textElement",
|
|
||||||
x = 100, y = 100,
|
|
||||||
w = 400, h = 200,
|
|
||||||
text = "Hello World",
|
|
||||||
textSize = 16
|
|
||||||
})
|
|
||||||
element.prevGameSize = { width = 800, height = 600 }
|
|
||||||
|
|
||||||
print("Before resize:")
|
|
||||||
print(string.format("Element: %dx%d, textSize: %s", element.width, element.height, element.textSize or "nil"))
|
|
||||||
|
|
||||||
-- Resize from 800x600 to 1200x900 (1.5x scale)
|
|
||||||
element:resize(1200, 900)
|
|
||||||
|
|
||||||
print("\nAfter resize (1200x900):")
|
|
||||||
print(string.format("Element: %dx%d, textSize: %s", element.width, element.height, element.textSize or "nil"))
|
|
||||||
|
|
||||||
print("\nExpected: Element should be 600x300, textSize should scale to 24 (16 * 1.5)")
|
|
||||||
print("Current: textSize doesn't scale - this is the issue we need to fix")
|
|
||||||
end
|
|
||||||
|
|
||||||
testCurrentFontBehavior()
|
|
||||||
Reference in New Issue
Block a user