From 6df93eb29874f4639c2b5ab8d83ed89ca91e0e06 Mon Sep 17 00:00:00 2001 From: "Squishy (C6H12O6+NaCl+H2O)" <106439598+SweetSea-ButImNotSweet@users.noreply.github.com> Date: Sat, 25 May 2024 00:18:23 +0700 Subject: [PATCH] =?UTF-8?q?Fix=20l=E1=BB=97i=20gi=E1=BB=AFa=20=C4=91=C3=AA?= =?UTF-8?q?m?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scene/touch_config.lua | 44 ++++++++++++++++------------------ scene/touch_config_preview.lua | 2 +- 2 files changed, 22 insertions(+), 24 deletions(-) diff --git a/scene/touch_config.lua b/scene/touch_config.lua index 39011e1..5dcfe0c 100644 --- a/scene/touch_config.lua +++ b/scene/touch_config.lua @@ -24,12 +24,12 @@ buttonList = { showToggle = BUTTON.new{ text = function() if focusingButton then - return string.format("Show / Hide\n[%s]", focusingButton.show and "Show" or "Hide") + return focusingButton.show and "[SHOW]\nHide" or "Show\n[HIDE]" else - return "Show / Hide\n[----]" + return "Show\nHide" end end, - x = 240, y = 5, w = 90, h = 50, + x = 275, y = 5, w = 50, h = 75, codeWhenReleased = function () if focusingButton then focusingButton.show = not focusingButton.show @@ -40,7 +40,7 @@ buttonList = { }, previewToggle = BUTTON.new{ text = "Preview\nON", - x = 520, y = 5, w = 60, h = 50, + x = 570, y = 35, w = 60, h = 40, codeWhenReleased = function() VCTRL.release() BUTTON.release(buttonList) @@ -49,7 +49,7 @@ buttonList = { }, menuScreen = BUTTON.new{ text = "MENU", - x = 585, y = 5, w = 50, h = 50, + x = 570, y = 5, w = 60, h = 25, codeWhenReleased = function() if hasChanged then local selection = love.window.showMessageBox( @@ -77,7 +77,7 @@ buttonList = { } sliderList = {} sliderList.opacity = newSlider( - 135, 20+2.5, 100, 100, 0, 100, + 155, 20+5, 120, 100, 0, 100, function() local v if focusingButton then @@ -89,10 +89,10 @@ sliderList.opacity = newSlider( sliderList.opacity.value = v end end, - {width = 20} + {width = 30} ) sliderList.size = newSlider( - 135, 50+2.5, 100, 45, 0, 120, + 155, 60+2.5, 120, 45, 0, 120, function(v) if focusingButton then local v = math.roundUnit(v, 5) @@ -103,17 +103,17 @@ sliderList.size = newSlider( sliderList.size.value = v / 120 end end, - {width = 20} + {width = 30} ) local gridSizeTable = {1, 2, 5, 10, 20, 50, 100} sliderList.gridSize = newSlider( - 400, 40-1, 100, 1, 1, #gridSizeTable - 1, + 405, 50, 100, 1, 1, #gridSizeTable - 1, function() local v = math.roundUnit(sliderList.gridSize.value, 1 / 6) sliderList.gridSize.value = v gridSize = gridSizeTable[math.roundUnit(v * (#gridSizeTable - 1) + 1, 1)] end, - {width = 20} + {width = 30} ); sliderList.gridSize.forceLight = true local function sliderList_draw() @@ -179,18 +179,18 @@ function TouchConfigScene:render() love.graphics.setColor(0, 0, 0, 0.7) -- Opacity and Size - love.graphics.rectangle("fill", 10, 5, 227, 58) + love.graphics.rectangle("fill", 10, 5, 263, 75) -- Snap to grid - love.graphics.rectangle("fill", 335, 5, 130, 50) + love.graphics.rectangle("fill", 330, 5, 150, 75) -- Opacity - drawText("Opacity", 20, 10, 100, "left") - drawText(string.format("%3.1d%%", focusingButton and focusingButton.alpha * 100 or 0), 190, 10, 40, "left") + drawText("Opacity", 20, 15, 100, "left") + drawText(string.format("%3.1d%%", focusingButton and focusingButton.alpha * 100 or 0), 225, 15, 40, "left") -- Size - drawText("Size", 20, 40, 100, "left") - drawText(string.format("%3.1dpx", focusingButton and focusingButton.r or 0), 190, 40, 40, "left") + drawText("Size", 20, 55, 100, "left") + drawText(string.format("%3.1dpx", focusingButton and focusingButton.r or 0), 225, 55, 40, "left") -- Snap to grid - drawText(string.format("Snap to grid: %3s", gridSize), 340, 10, 140, "left") + drawText(string.format("Snap to grid: %3s", gridSize), 345, 15, 140, "left") for _, v in ipairs(VCTRL) do if v ~= focusingButton then @@ -217,10 +217,8 @@ end ---@param e SCENE_onInput function TouchConfigScene:onInputMove(e) - if e.type == "mouse" or e.type == "touch" then - if love.mouse.isDown(1) then - if VCTRL.drag(e.dx, e.dy, e.id or 1) then hasChanged = true end - end + if (e.type == "mouse" and love.mouse.isDown(1)) or e.type == "touch" then + if VCTRL.drag(e.dx, e.dy, e.id or 1) then hasChanged = true end end if e.type == "mouse" then @@ -233,7 +231,7 @@ function TouchConfigScene:onInputPress(e) if not ( VCTRL.press(e.x, e.y, e.id and e.id or 1, true) or BUTTON.press(buttonList, e.x, e.y, e.id) or - (e.x >= 75 and e.x <= 195 and e.y >= 12 and e.y <= 63) + (e.x >= 80 and e.x <= 230 and e.y >= 10 and e.y <= 77) ) then VCTRL.focus = nil focusingButton = nil diff --git a/scene/touch_config_preview.lua b/scene/touch_config_preview.lua index f8c8e54..eb6814e 100644 --- a/scene/touch_config_preview.lua +++ b/scene/touch_config_preview.lua @@ -8,7 +8,7 @@ local buttonList buttonList = { previewToggle = BUTTON.new{ text = "Preview\nOFF", - x = 520, y = 5, w = 60, h = 50, + x = 570, y = 35, w = 60, h = 40, codeWhenReleased = function() VCTRL.release() BUTTON.release(buttonList)