From 74b9e60ad6a5f9e630b71f652d616283c2e514f0 Mon Sep 17 00:00:00 2001 From: Felix Niklas Date: Mon, 4 Jul 2016 16:20:59 +0200 Subject: [PATCH] customer chat: add scroll snap tolerance --- app/assets/javascripts/app/controllers/chat.coffee | 3 ++- app/assets/stylesheets/zammad.scss | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/app/controllers/chat.coffee b/app/assets/javascripts/app/controllers/chat.coffee index c9b96fc73..59369c927 100644 --- a/app/assets/javascripts/app/controllers/chat.coffee +++ b/app/assets/javascripts/app/controllers/chat.coffee @@ -367,6 +367,7 @@ class ChatWindow extends App.Controller @isAgentTyping = false @resetUnreadMessages() @scrolledToBottom = true + @scrollSnapTolerance = 10 # pixels @chat = App.Chat.find(@session.chat_id) @name = "#{@chat.displayName()} ##{@session.id}" @@ -682,7 +683,7 @@ class ChatWindow extends App.Controller detectScrolledtoBottom: => scrollBottom = @scrollHolder.scrollTop() + @scrollHolder.height() - @scrolledToBottom = scrollBottom == @scrollHolder.prop('scrollHeight') + @scrolledToBottom = Math.abs(scrollBottom - @scrollHolder.prop('scrollHeight')) <= @scrollSnapTolerance onScrollHintClick: -> # animate scroll diff --git a/app/assets/stylesheets/zammad.scss b/app/assets/stylesheets/zammad.scss index 47d008ec0..a6aedc58e 100644 --- a/app/assets/stylesheets/zammad.scss +++ b/app/assets/stylesheets/zammad.scss @@ -7833,7 +7833,7 @@ output { .chat-footer { border-top: 1px solid hsl(0,0%,93%); - padding: 10px; + padding: 10px 10px 0; display: flex; justify-content: center; align-self: stretch;