Skip to content

Commit d4684a7

Browse files
committed
Cleanup: drop unused locals and fix the container return annotation
1 parent ad842b7 commit d4684a7

7 files changed

Lines changed: 8 additions & 10 deletions

File tree

druid/base/drag.lua

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ function M:on_input(action_id, action)
185185
if touch.released and self.is_touch then
186186
if action.touch then
187187
-- Mobile
188-
self:_on_touch_release(action_id, action, touch)
188+
self:_on_touch_release(action, touch)
189189
else
190190
-- PC
191191
self:_end_touch(touch)
@@ -376,10 +376,9 @@ end
376376

377377
---Process on touch release. We should to find, if any other
378378
---touches exists to switch to another touch.
379-
---@param action_id hash Action id from on_input
380379
---@param action table Action from on_input
381380
---@param touch table Touch action
382-
function M:_on_touch_release(action_id, action, touch)
381+
function M:_on_touch_release(action, touch)
383382
if #action.touch >= 2 then
384383
-- Find next unpressed touch
385384
local next_touch

druid/base/scroll.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ function M:update(dt)
152152
end
153153

154154
if self.drag.is_drag then
155-
self:_update_hand_scroll(dt)
155+
self:_update_hand_scroll()
156156
else
157157
self:_update_free_scroll(dt)
158158
end
@@ -768,7 +768,7 @@ function M:_update_free_scroll(dt)
768768
end
769769

770770

771-
function M:_update_hand_scroll(dt)
771+
function M:_update_hand_scroll()
772772
if self.is_animate then
773773
self:_cancel_animate()
774774
end

druid/base/static_grid.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ end
306306
---@return vector3[] positions All grid node positions
307307
function M:get_all_pos()
308308
local result = {}
309-
for i, node in pairs(self.nodes) do
309+
for _, node in pairs(self.nodes) do
310310
table.insert(result, gui.get_position(node))
311311
end
312312

druid/base/text.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ function M:_update_text_area_size()
363363
local is_fit = self:_is_fit_info_area(metrics)
364364
local step = is_fit and self.style.ADJUST_SCALE_DELTA or -self.style.ADJUST_SCALE_DELTA
365365

366-
for i = 1, self.style.ADJUST_STEPS do
366+
for _ = 1, self.style.ADJUST_STEPS do
367367
-- Grow down to check if we fit
368368
if step < 0 and is_fit then
369369
break

druid/custom/rich_text/module/rt.lua

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@ local function get_image_metrics(word, settings)
126126
gui.play_flipbook(node, hash(word.image.anim))
127127

128128
local node_size = gui.get_size(node)
129-
local aspect = node_size.x / node_size.y
130129
node_size.x = word.image.width or node_size.x
131130
node_size.y = word.image.height or node_size.y
132131

druid/extended/container.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ function M:add_container(node_or_container, mode, on_resize_callback)
291291
---@cast node node
292292
node = self:get_node(node)
293293

294-
container = container or self.druid:new(M, node, mode)
294+
container = container or self.druid:new(M, node, mode) --[[@as druid.container]]
295295
container:set_parent_container(self)
296296
if on_resize_callback then
297297
container.on_size_changed:subscribe(on_resize_callback)

druid/extended/slider.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,9 @@ function M:on_input(action_id, action)
107107

108108
if not self.is_drag and self._input_node and gui.pick_node(self._input_node, action.x, action.y) then
109109
if action.pressed and gui.screen_to_local then
110+
-- Refreshed for the drag delta below, screen_to_local does not need it
110111
self._scene_scale = helper.get_scene_scale(self.node)
111112
self.pos = gui.screen_to_local(self.node, vmath.vector3(action.screen_x, action.screen_y, 0))
112-
-- gui.screen_to_local already accounts for the scene scale, no need to divide it again
113113
self.pos.x = helper.clamp(self.pos.x, self.start_pos.x, self.end_pos.x)
114114
self.pos.y = helper.clamp(self.pos.y, self.start_pos.y, self.end_pos.y)
115115

0 commit comments

Comments
 (0)