Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tweak slide up animations #71

Merged
merged 3 commits into from
Aug 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file modified .github/ISSUE_TEMPLATE/bug_report.md
100644 → 100755
Empty file.
Empty file modified .github/ISSUE_TEMPLATE/feature_request.md
100644 → 100755
Empty file.
Empty file modified .github/pull_request_template.md
100644 → 100755
Empty file.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Unreleased

* Fix text processing pipeline (#70)
* Fix jittery animations (#71)

## 1.1.0 (2020-08-24)

Expand Down
14 changes: 7 additions & 7 deletions Glass/Modules/SlidingMessageFrame.lua
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ function SlidingMessageFrame:Initialize()
self.scrollFrame:SetWidth(self.config.width)
self.scrollFrame:SetPoint("BOTTOMLEFT", 0, self.config.overflowHeight * -1)

-- Set initial scroll position
self.scrollFrame:SetVerticalScroll(self.config.overflowHeight)

self.scrollFrame.bg = self.scrollFrame:CreateTexture(nil, "BACKGROUND")
self.scrollFrame.bg:SetAllPoints()
self.scrollFrame.bg:SetColorTexture(0, 1, 0, 0)
Expand Down Expand Up @@ -113,9 +116,6 @@ function SlidingMessageFrame:Initialize()

-- Initialize slide up animations
self.sliderAg = self.slider:CreateAnimationGroup()
self.sliderStartOffset = self.sliderAg:CreateAnimation("Translation")
self.sliderStartOffset:SetDuration(0)

self.sliderTranslateUp = self.sliderAg:CreateAnimation("Translation")
self.sliderTranslateUp:SetDuration(0.3)
self.sliderTranslateUp:SetSmoothing("OUT")
Expand Down Expand Up @@ -396,19 +396,19 @@ function SlidingMessageFrame:Update()

local newHeight = self.slider:GetHeight() + offset
self.slider:SetHeight(newHeight)
self.sliderStartOffset:SetOffset(0, offset * -1)
self.sliderTranslateUp:SetOffset(0, offset)

-- Display and run everything
self.scrollFrame:SetVerticalScroll(newHeight - self.scrollFrame:GetHeight() + self.config.overflowHeight)
self.sliderAg:SetScript("OnFinished", function ()
self.scrollFrame:SetVerticalScroll(newHeight - self.scrollFrame:GetHeight() + self.config.overflowHeight)
end)
self.sliderAg:Play()

for _, messageFrame in ipairs(newMessages) do
messageFrame:Show()
table.insert(self.state.messages, messageFrame)
end

self.sliderAg:Play()

-- Release old messages
local historyLimit = 128
if #self.state.messages > historyLimit then
Expand Down