test
This commit is contained in:
parent
468aad896f
commit
f3881af24f
2 changed files with 42 additions and 6 deletions
|
|
@ -22,6 +22,7 @@ frame.BorderSizePixel = 0;
|
|||
local button = class "TextButton";
|
||||
button.BorderSizePixel = 0;
|
||||
button.Text = nil;
|
||||
local image = class "ImageLabel";
|
||||
|
||||
-- tween for moving
|
||||
local out = advancedTween.EasingDirections.Out;
|
||||
|
|
@ -80,8 +81,12 @@ function scrollFrame:init(props)
|
|||
props:default("ZIndex",1);
|
||||
props:default("BackgroundColor3",white);
|
||||
props:default("ScrollbarSizeX",2);
|
||||
props:default("ScrollbarVisibleY",false);
|
||||
props:default("ScrollbarSizeX",2);
|
||||
props:default("ScrollbarVisibleX",true);
|
||||
props:default("ScrollbarPadding",2);
|
||||
props:default("ScrollbarVisible",true);
|
||||
props:default("ScrollbarColor3",Color3.fromRGB(172, 172, 172));
|
||||
props:default("ScrollbarTransparency",0.5);
|
||||
end
|
||||
|
||||
-- Render objects
|
||||
|
|
@ -95,7 +100,7 @@ function scrollFrame:render(props)
|
|||
ClipsDescendants = true;
|
||||
[event.createdSync] = function (this)
|
||||
this.InputChanged:Connect(function (input)
|
||||
if self._mouseDown then
|
||||
if self._mouseDown or self._scrollbarDown then
|
||||
return;
|
||||
end
|
||||
local inputType = input.UserInputType;
|
||||
|
|
@ -157,9 +162,22 @@ function scrollFrame:render(props)
|
|||
self._holder = this;
|
||||
end;
|
||||
};
|
||||
-- button {
|
||||
|
||||
-- }
|
||||
button {
|
||||
Visible = props "ScrollbarVisibleY";
|
||||
Size = props "ScrollbarPadding,ScrollbarSizeX":with(function (store)
|
||||
self:fit();
|
||||
end);
|
||||
image {
|
||||
roundSize = 2000;
|
||||
ImageColor3 = props "ScrollbarColor3";
|
||||
ImageTransparency = props "ScrollbarTransparency";
|
||||
Size = props "ScrollbarSizeX,ScrollbarPadding":with(function (store)
|
||||
return UDim2.new(0,store.ScrollbarSizeX,1,store.ScrollbarPadding * 2);
|
||||
end);
|
||||
Position = UDim2.fromScale(0.5,0.5);
|
||||
AnchorPoint = Vector2.new(0.5,0.5);
|
||||
};
|
||||
}
|
||||
};
|
||||
end
|
||||
|
||||
|
|
@ -183,6 +201,7 @@ function scrollFrame:update(x,y)
|
|||
Position = UDim2.fromOffset(x,-y);
|
||||
});
|
||||
self._targetX,self._targetY = x,y;
|
||||
self:updateScrollbar(x,y);
|
||||
return inputIndex;
|
||||
end
|
||||
|
||||
|
|
@ -215,6 +234,8 @@ function scrollFrame:fit()
|
|||
max(min(targetX,maxX),0),
|
||||
max(min(targetY,maxY),0)
|
||||
);
|
||||
else
|
||||
self:updateScrollbar(targetX,targetY);
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -225,6 +225,12 @@ function module.init(shared)
|
|||
((type(object) == "table" and object.__object) or object):GetPropertyChangedSignal "ClassName":Connect(function()
|
||||
return self;
|
||||
end);
|
||||
|
||||
--after render
|
||||
local afterRender = this.afterRender;
|
||||
if afterRender then
|
||||
afterRender(self,object);
|
||||
end
|
||||
return self;
|
||||
end
|
||||
|
||||
|
|
@ -239,10 +245,12 @@ function module.init(shared)
|
|||
if lastObject then
|
||||
lastObject.Parent = nil;
|
||||
end
|
||||
|
||||
object = self:render(self.__prop); -- new instance
|
||||
rawset(self,"__holder",object);
|
||||
rawset(self,"__object",object);
|
||||
object.Parent = getHolder(parent); -- update parent
|
||||
|
||||
-- restore childs
|
||||
local child = rawget(self,"__child");
|
||||
if child then
|
||||
|
|
@ -252,6 +260,7 @@ function module.init(shared)
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- prevnet gc
|
||||
((type(object) == "table" and object.__object) or object):GetPropertyChangedSignal "ClassName":Connect(function()
|
||||
return self;
|
||||
|
|
@ -259,6 +268,12 @@ function module.init(shared)
|
|||
if lastObject then -- remove old instance
|
||||
self:Destroy(lastObject);
|
||||
end
|
||||
|
||||
--after render
|
||||
local afterRender = this.afterRender;
|
||||
if afterRender then
|
||||
afterRender(self,object);
|
||||
end
|
||||
end
|
||||
|
||||
-- define destroy method
|
||||
|
|
|
|||
Loading…
Reference in a new issue