diff --git a/lib/Internal.lua b/lib/Internal.lua index 2e93767..00fab5e 100644 --- a/lib/Internal.lua +++ b/lib/Internal.lua @@ -438,8 +438,6 @@ return function(Iris: Types.Iris): Types.Internal if Internal._localRefreshActive then -- we are redrawing every widget. Internal._DiscardWidget(lastWidget) - -- so we don't accidentally discard it twice - lastWidget.lastCycleTick = -1 lastWidget = nil end end @@ -616,6 +614,9 @@ return function(Iris: Types.Iris): Types.Internal -- using the widget class discard function. Internal._widgets[widgetToDiscard.type].Discard(widgetToDiscard) + + -- mark as discarded + widgetToDiscard.lastCycleTick = -1 end --[=[ diff --git a/lib/demoWindow.lua b/lib/demoWindow.lua index 4784442..4c63723 100644 --- a/lib/demoWindow.lua +++ b/lib/demoWindow.lua @@ -77,11 +77,6 @@ return function(Iris: Types.Iris) local ImageTransparencyState = Iris.State(Iris._config.ImageTransparency) Iris.InputColor4({ "Image Tint" }, { color = ImageColorState, transparency = ImageTransparencyState }) - Iris.PushConfig({ - ImageColor = ImageColorState:get(), - ImageTransparency = ImageTransparencyState:get(), - }) - Iris.Combo({ "Asset" }, { index = AssetState }) do Iris.Selectable({ "Robux Small", "rbxasset://textures/ui/common/robux.png" }, { index = AssetState }) @@ -105,32 +100,51 @@ return function(Iris: Types.Iris) Iris.End() Iris.Checkbox({ "Pixelated" }, { isChecked = PixelatedCheckState }) + Iris.PushConfig({ + ImageColor = ImageColorState:get(), + ImageTransparency = ImageTransparencyState:get(), + }) Iris.Image({ AssetState:get(), SizeState:get(), RectState:get(), ScaleTypeState:get(), PixelatedState:get() }) + Iris.PopConfig() Iris.SeparatorText({ "Tile" }) - local TileState = Iris.State(UDim2.fromScale(1, 1)) + local TileState = Iris.State(UDim2.fromScale(0.5, 0.5)) Iris.SliderUDim2({ "Tile Size", nil, nil, UDim2.new(1, 240, 1, 240) }, { number = TileState }) + Iris.PushConfig({ + ImageColor = ImageColorState:get(), + ImageTransparency = ImageTransparencyState:get(), + }) Iris.Image({ "rbxasset://textures/grid2.png", SizeState:get(), nil, Enum.ScaleType.Tile, PixelatedState:get(), TileState:get() }) + Iris.PopConfig() Iris.SeparatorText({ "Slice" }) local SliceScaleState = Iris.State(1) Iris.SliderNum({ "Image Slice Scale", 0.1, 0.1, 5 }, { number = SliceScaleState }) + Iris.PushConfig({ + ImageColor = ImageColorState:get(), + ImageTransparency = ImageTransparencyState:get(), + }) Iris.Image({ "rbxasset://textures/ui/chatBubble_blue_notify_bkg.png", SizeState:get(), nil, Enum.ScaleType.Slice, PixelatedState:get(), nil, Rect.new(12, 12, 56, 56), 1 }, SliceScaleState:get()) + Iris.PopConfig() Iris.SeparatorText({ "Image Button" }) local count = Iris.State(0) + Iris.SameLine() do + Iris.PushConfig({ + ImageColor = ImageColorState:get(), + ImageTransparency = ImageTransparencyState:get(), + }) if Iris.ImageButton({ "rbxasset://textures/AvatarCompatibilityPreviewer/add.png", UDim2.fromOffset(20, 20) }).clicked() then count:set(count.value + 1) end + Iris.PopConfig() Iris.Text({ `Click count: {count.value}` }) end - - Iris.PopConfig() Iris.End() end Iris.End() diff --git a/lib/widgets/Input.lua b/lib/widgets/Input.lua index 2f87c2e..780134a 100644 --- a/lib/widgets/Input.lua +++ b/lib/widgets/Input.lua @@ -1136,7 +1136,9 @@ return function(Iris: Types.Internal, widgets: Types.WidgetUtility) local desiredCycleTick: number = Iris._cycleTick + 1 Iris._postCycleCallbacks[callbackIndex] = function() if Iris._cycleTick >= desiredCycleTick then - Iris._widgets[`Slider{dataType}`].UpdateState(thisWidget) + if thisWidget.lastCycleTick ~= -1 then + Iris._widgets[`Slider{dataType}`].UpdateState(thisWidget) + end Iris._postCycleCallbacks[callbackIndex] = nil end end diff --git a/lib/widgets/Window.lua b/lib/widgets/Window.lua index 9852123..cd3efb7 100644 --- a/lib/widgets/Window.lua +++ b/lib/widgets/Window.lua @@ -859,7 +859,9 @@ return function(Iris: Types.Internal, widgets: Types.WidgetUtility) local desiredCycleTick: number = Iris._cycleTick + 1 Iris._postCycleCallbacks[callbackIndex] = function() if Iris._cycleTick >= desiredCycleTick then - ChildContainer.CanvasPosition = Vector2.new(0, stateScrollDistance) + if thisWidget.lastCycleTick ~= -1 then + ChildContainer.CanvasPosition = Vector2.new(0, stateScrollDistance) + end Iris._postCycleCallbacks[callbackIndex] = nil end end