Fixed slider not working on monitors
Fixed sending wrong mouse button on monitor_touch events
This commit is contained in:
@@ -167,10 +167,10 @@ function BaseFrame:monitor_touch(name, x, y)
|
|||||||
if _term == nil then return end
|
if _term == nil then return end
|
||||||
if(isPeripheral(_term))then
|
if(isPeripheral(_term))then
|
||||||
if self._peripheralName == name then
|
if self._peripheralName == name then
|
||||||
self:mouse_click(0, x, y)
|
self:mouse_click(1, x, y)
|
||||||
self.basalt.schedule(function()
|
self.basalt.schedule(function()
|
||||||
sleep(0.1)
|
sleep(0.1)
|
||||||
self:mouse_up(0, x, y)
|
self:mouse_up(1, x, y)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -63,7 +63,8 @@ end
|
|||||||
--- @return boolean handled Whether the event was handled
|
--- @return boolean handled Whether the event was handled
|
||||||
--- @protected
|
--- @protected
|
||||||
function Slider:mouse_click(button, x, y)
|
function Slider:mouse_click(button, x, y)
|
||||||
if button == 1 and self:isInBounds(x, y) then
|
self.basalt.LOGGER.debug("Slider:mouse_click", button, x, y)
|
||||||
|
if self:isInBounds(x, y) then
|
||||||
local relX, relY = self:getRelativePosition(x, y)
|
local relX, relY = self:getRelativePosition(x, y)
|
||||||
local pos = self.get("horizontal") and relX or relY
|
local pos = self.get("horizontal") and relX or relY
|
||||||
local maxSteps = self.get("horizontal") and self.get("width") or self.get("height")
|
local maxSteps = self.get("horizontal") and self.get("width") or self.get("height")
|
||||||
@@ -72,6 +73,7 @@ function Slider:mouse_click(button, x, y)
|
|||||||
self:updateRender()
|
self:updateRender()
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
return false
|
||||||
end
|
end
|
||||||
Slider.mouse_drag = Slider.mouse_click
|
Slider.mouse_drag = Slider.mouse_click
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user