fix: Fixed gc issue
This commit is contained in:
parent
24e5e7f52a
commit
d10936a57e
2 changed files with 12 additions and 7 deletions
|
|
@ -115,7 +115,7 @@ function scrollFrame:render(props)
|
||||||
BackgroundColor3 = props "BackgroundColor3";
|
BackgroundColor3 = props "BackgroundColor3";
|
||||||
ZIndex = props "ZIndex";
|
ZIndex = props "ZIndex";
|
||||||
ClipsDescendants = true;
|
ClipsDescendants = true;
|
||||||
[event.createdSync] = function (this)
|
[event.created] = function (this)
|
||||||
this.InputChanged:Connect(function (input)
|
this.InputChanged:Connect(function (input)
|
||||||
if self._mouseDown or self._scrollbarDown then
|
if self._mouseDown or self._scrollbarDown then
|
||||||
return;
|
return;
|
||||||
|
|
@ -172,7 +172,7 @@ function scrollFrame:render(props)
|
||||||
Size = props "CanvasSize";
|
Size = props "CanvasSize";
|
||||||
ZIndex = props "ZIndex";
|
ZIndex = props "ZIndex";
|
||||||
Position = UDim2.fromOffset(self._targetX,self._targetY);
|
Position = UDim2.fromOffset(self._targetX,self._targetY);
|
||||||
[event.createdSync] = function (this)
|
[event.created] = function (this)
|
||||||
self._holder = this;
|
self._holder = this;
|
||||||
end;
|
end;
|
||||||
};
|
};
|
||||||
|
|
@ -180,7 +180,7 @@ function scrollFrame:render(props)
|
||||||
AnchorPoint = props "ScrollbarPositionY":with(function (_,value)
|
AnchorPoint = props "ScrollbarPositionY":with(function (_,value)
|
||||||
return value == "Right" and Vector2.new(1,0) or Vector2.new(0,0);
|
return value == "Right" and Vector2.new(1,0) or Vector2.new(0,0);
|
||||||
end);
|
end);
|
||||||
[event.createdSync] = function (this)
|
[event.created] = function (this)
|
||||||
self._scrollbarY = this;
|
self._scrollbarY = this;
|
||||||
end;
|
end;
|
||||||
Position = props.ScrollbarPositionY == "Right" and UDim2.new(1,0,0,0) or UDim2.new(0,0,0,0);
|
Position = props.ScrollbarPositionY == "Right" and UDim2.new(1,0,0,0) or UDim2.new(0,0,0,0);
|
||||||
|
|
@ -201,7 +201,7 @@ function scrollFrame:render(props)
|
||||||
AnchorPoint = props "ScrollbarPositionX":with(function (_,value)
|
AnchorPoint = props "ScrollbarPositionX":with(function (_,value)
|
||||||
return value == "Top" and Vector2.new(0,0) or Vector2.new(0,1);
|
return value == "Top" and Vector2.new(0,0) or Vector2.new(0,1);
|
||||||
end);
|
end);
|
||||||
[event.createdSync] = function (this)
|
[event.created] = function (this)
|
||||||
self._scrollbarX = this;
|
self._scrollbarX = this;
|
||||||
end;
|
end;
|
||||||
Position = props.ScrollbarPositionX == "Top" and UDim2.new(0,0,0,0) or UDim2.new(0,0,1,0);
|
Position = props.ScrollbarPositionX == "Top" and UDim2.new(0,0,0,0) or UDim2.new(0,0,1,0);
|
||||||
|
|
|
||||||
|
|
@ -250,6 +250,7 @@ function module.init(shared)
|
||||||
function new.__initStoreRegisterBinding(self,withItem)
|
function new.__initStoreRegisterBinding(self,withItem)
|
||||||
local selfTweens = self.__tweens;
|
local selfTweens = self.__tweens;
|
||||||
local selfValues = self.__self;
|
local selfValues = self.__self;
|
||||||
|
local selfKeep = self.__keep;
|
||||||
for key,item in pairs(selfValues) do
|
for key,item in pairs(selfValues) do
|
||||||
if type(item) == "table" and item.__type == "quad_register" then
|
if type(item) == "table" and item.__type == "quad_register" then
|
||||||
-- fetch data from origin
|
-- fetch data from origin
|
||||||
|
|
@ -270,11 +271,14 @@ function module.init(shared)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- make event connection
|
-- make event connection
|
||||||
item:register(function (_,newValue,eventKey)
|
local function regFn(_,newValue,eventKey)
|
||||||
-- !HOLD IT SELF TO PREVENT THIS REGISTER BEGIN REMOVED FROM MEMORY
|
-- !HOLD IT SELF TO PREVENT THIS REGISTER BEGIN REMOVED FROM MEMORY
|
||||||
local setValue = item:calcWithNewValue(withItem,newValue,eventKey);
|
local setValue = item:calcWithNewValue(withItem,newValue,eventKey);
|
||||||
self[key] = setValue;
|
self[key] = setValue;
|
||||||
end);
|
end
|
||||||
|
item:register(regFn);
|
||||||
|
insert(selfKeep,item);
|
||||||
|
insert(selfKeep,regFn);
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -311,7 +315,8 @@ function module.init(shared)
|
||||||
__self = self or {}, -- real value storage
|
__self = self or {}, -- real value storage
|
||||||
__evt = {}, -- changed event handler functions (dict of array)
|
__evt = {}, -- changed event handler functions (dict of array)
|
||||||
__reg = setmetatable({},week), -- save registers
|
__reg = setmetatable({},week), -- save registers
|
||||||
__tweens = {} -- tweens (if inited with register, save tween and use as default tween data)
|
__tweens = {}, -- tweens (if inited with register, save tween and use as default tween data)
|
||||||
|
__keep = {} -- store data which should not be destoryed
|
||||||
},store
|
},store
|
||||||
);
|
);
|
||||||
if id then -- save in id space
|
if id then -- save in id space
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue