fixed gc issue

This commit is contained in:
세젤귀 고양이들 2022-02-02 21:16:28 +09:00
parent 79a603dfcb
commit 4155fee557
2 changed files with 7 additions and 20 deletions

View file

@ -137,6 +137,8 @@ function scrollFrame:render(props)
end); end);
end; end;
[event "MouseButton1Down"] = function (this,downX,downY) [event "MouseButton1Down"] = function (this,downX,downY)
local lastX,lastY = self._targetX,self._targetY;
local upX,upY = downX,downY;
self._mouseDown = true; self._mouseDown = true;
local mouseConnection = self._mouseConnection; local mouseConnection = self._mouseConnection;
mouseConnection:disconnect(); mouseConnection:disconnect();
@ -147,7 +149,7 @@ function scrollFrame:render(props)
local position = input.Position; local position = input.Position;
local x = position.X; local x = position.X;
local y = position.Y; local y = position.Y;
self:update(self._targetX + ((x - downX) * mouseUpMut),self._targetY + ((- y + downY)*mouseUpMut)); self:update(self._targetX + ((x - upX) * mouseUpMut),self._targetY + ((- y + upY)*mouseUpMut));
mouseConnection:disconnect(); mouseConnection:disconnect();
self:fit(); self:fit();
end end
@ -156,24 +158,9 @@ function scrollFrame:render(props)
if input.UserInputType == mouseMovement then if input.UserInputType == mouseMovement then
local position = input.Position; local position = input.Position;
local x,y = position.X,position.Y; local x,y = position.X,position.Y;
local overscrollX,overscrollY = self._overscrollX,self._overscrollY;
local xIns = downX - x; self:update(lastX + (downX - x),lastY + (downY - y));
if overscrollX and ((overscrollX == -1 and xIns > 0) or (overscrollX == 1 and xIns < 0)) then upX,upY = x,y;
xIns = xIns * dragRestMut;
elseif overscrollX and ((overscrollX == -1 and xIns < 0) or (overscrollX == 1 and xIns > 0)) then
xIns = xIns * dragOverMut;
end
local yIns = downY - y;
if overscrollY and ((overscrollY == -1 and yIns > 0) or (overscrollY == 1 and yIns < 0)) then
yIns = yIns * dragRestMut;
elseif overscrollY and ((overscrollY == -1 and yIns < 0) or (overscrollY == 1 and yIns > 0)) then
yIns = yIns * dragOverMut;
end
self:update(self._targetX + xIns,self._targetY + yIns);
downX,downY = x,y;
end end
end)); end));
end; end;

View file

@ -16,7 +16,7 @@ local function catch(...)
end end
end end
local week = {__mode = "vk"}; local week = {__mode = "v"};
function module.init(shared) function module.init(shared)
local new = {}; local new = {};
local items = shared.items; local items = shared.items;
@ -163,7 +163,7 @@ function module.init(shared)
end end
end end
local this = setmetatable( local this = setmetatable(
{__self = self or {},__evt = setmetatable({},week),__reg = setmetatable({},week)},store {__self = self or {},__evt = {},__reg = setmetatable({},week)},store
); );
if id then if id then
storeIdSpace[id] = this; storeIdSpace[id] = this;