From 7b0cc0e97f3f0f718d085d21e9a4061506be68ec Mon Sep 17 00:00:00 2001 From: Felix Niklas Date: Wed, 25 Nov 2015 13:59:08 +0100 Subject: [PATCH] chat designer: make preview readjust on resize --- .../javascripts/app/controllers/_channel/chat.coffee | 9 ++++++++- app/assets/stylesheets/zammad.scss | 4 ++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/app/controllers/_channel/chat.coffee b/app/assets/javascripts/app/controllers/_channel/chat.coffee index 0d8836fab..7d459e442 100644 --- a/app/assets/javascripts/app/controllers/_channel/chat.coffee +++ b/app/assets/javascripts/app/controllers/_channel/chat.coffee @@ -143,6 +143,12 @@ class App.ChannelChat extends App.Controller @adjustBrowserWidth() @updateParams() + # bind adjustBrowserWidth with parameter animate = false + $(window).on 'resize.chat-designer', => @adjustBrowserWidth false + + release: -> + $(window).off 'resize.chat-designer' + selectBrowserWidth: (event) => tab = $(event.target).closest('[data-value]') @@ -151,12 +157,13 @@ class App.ChannelChat extends App.Controller @browserWidth = tab.attr('data-value') @adjustBrowserWidth() - adjustBrowserWidth: -> + adjustBrowserWidth: (animate = true) => width = parseInt @browserWidth, 10 # reset zoom @chat .removeClass('is-fullscreen') + .toggleClass('no-transition', !animate) .css 'transform', "translateY(#{ @getChatOffset() }px)" @browser.css('width', '') @website.css diff --git a/app/assets/stylesheets/zammad.scss b/app/assets/stylesheets/zammad.scss index e0e8e7479..28dcdf1cc 100644 --- a/app/assets/stylesheets/zammad.scss +++ b/app/assets/stylesheets/zammad.scss @@ -7512,6 +7512,10 @@ output { transition: 500ms; user-select: none; will-change: transform; + + &.no-transition { + transition: none; + } .zammad-chat-welcome { display: block !important;