From 0bf13d01d127f18a4800837f095e751c81bc92f0 Mon Sep 17 00:00:00 2001 From: Mohammed Rabeeh Date: Sun, 26 Jan 2020 20:55:07 +0530 Subject: [PATCH] Fix black borders for full screen mode on Designer Signed-off-by: Mohammed Rabeeh --- js/designer/move.js | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/js/designer/move.js b/js/designer/move.js index 391578d050..f5b5cfaf4f 100644 --- a/js/designer/move.js +++ b/js/designer/move.js @@ -21,16 +21,25 @@ AJAX.registerTeardown('designer/move.js', function () { }); AJAX.registerOnload('designer/move.js', function () { - $('#page_content').css({ 'margin-left': '3px' }); + var $content = $('#page_content'); + var $img = $('#toggleFullscreen').find('img'); + var $span = $img.siblings('span'); + + $content.css({ 'margin-left': '3px' }); $(document).on('fullscreenchange', function () { - if (! $.fn.fullScreen()) { - $('#page_content').removeClass('content_fullscreen') + if (!$.fn.fullScreen() || !$content.fullScreen()) { + $content.removeClass('content_fullscreen') .css({ 'width': 'auto', 'height': 'auto' }); - var $img = $('#toggleFullscreen').find('img'); - var $span = $img.siblings('span'); - $span.text($span.data('enter')); + $('#osn_tab').css({ 'width': 'auto', 'height': 'auto' }); $img.attr('src', $img.data('enter')) .attr('title', $span.data('enter')); + $span.text($span.data('enter')); + + // Saving the fullscreen state in config when + // designer exists fullscreen mode via ESC key + + var valueSent = 'off'; + DesignerMove.saveValueInConfig('full_screen', valueSent); } }); @@ -260,8 +269,6 @@ DesignerMove.resizeOsnTab = function () { osnTabWidth = maxX + 50; osnTabHeight = maxY + 50; DesignerMove.canvasPos(); - document.getElementById('osn_tab').style.width = osnTabWidth + 'px'; - document.getElementById('osn_tab').style.height = osnTabHeight + 'px'; }; /** @@ -512,12 +519,17 @@ DesignerMove.toggleFullscreen = function () { $content .addClass('content_fullscreen') .css({ 'width': screen.width - 5, 'height': screen.height - 5 }); + + $('#osn_tab').css({ 'width': screen.width + 'px', 'height': screen.height}); valueSent = 'on'; $content.fullScreen(true); } else { $img.attr('src', $img.data('enter')) .attr('title', $span.data('enter')); $span.text($span.data('enter')); + $content.removeClass('content_fullscreen') + .css({ 'width': 'auto', 'height': 'auto' }); + $('#osn_tab').css({ 'width': 'auto', 'height': 'auto'}); $content.fullScreen(false); valueSent = 'off'; }