From 4155fee5571d668483eaf115a1e763264e1b782a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=84=B8=EC=A0=A4=EA=B7=80=20=EA=B3=A0=EC=96=91=EC=9D=B4?= =?UTF-8?q?=EB=93=A4?= <46598063+qwreey75@users.noreply.github.com> Date: Wed, 2 Feb 2022 21:16:28 +0900 Subject: [PATCH] fixed gc issue --- exemple/elasticScrollFrame.lua | 23 +++++------------------ src/store.lua | 4 ++-- 2 files changed, 7 insertions(+), 20 deletions(-) diff --git a/exemple/elasticScrollFrame.lua b/exemple/elasticScrollFrame.lua index 4f5436c..e766392 100644 --- a/exemple/elasticScrollFrame.lua +++ b/exemple/elasticScrollFrame.lua @@ -137,6 +137,8 @@ function scrollFrame:render(props) end); end; [event "MouseButton1Down"] = function (this,downX,downY) + local lastX,lastY = self._targetX,self._targetY; + local upX,upY = downX,downY; self._mouseDown = true; local mouseConnection = self._mouseConnection; mouseConnection:disconnect(); @@ -147,7 +149,7 @@ function scrollFrame:render(props) local position = input.Position; local x = position.X; 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(); self:fit(); end @@ -156,24 +158,9 @@ function scrollFrame:render(props) if input.UserInputType == mouseMovement then local position = input.Position; local x,y = position.X,position.Y; - local overscrollX,overscrollY = self._overscrollX,self._overscrollY; - local xIns = downX - x; - if overscrollX and ((overscrollX == -1 and xIns > 0) or (overscrollX == 1 and xIns < 0)) then - 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; + self:update(lastX + (downX - x),lastY + (downY - y)); + upX,upY = x,y; end end)); end; diff --git a/src/store.lua b/src/store.lua index 8a271f5..d0eb64d 100644 --- a/src/store.lua +++ b/src/store.lua @@ -16,7 +16,7 @@ local function catch(...) end end -local week = {__mode = "vk"}; +local week = {__mode = "v"}; function module.init(shared) local new = {}; local items = shared.items; @@ -163,7 +163,7 @@ function module.init(shared) end end local this = setmetatable( - {__self = self or {},__evt = setmetatable({},week),__reg = setmetatable({},week)},store + {__self = self or {},__evt = {},__reg = setmetatable({},week)},store ); if id then storeIdSpace[id] = this;