# HG changeset patch # User rt@lightning # Date 2013-09-24 15:39:23 # Node ID 9c21e850132e530f764a9328e021cce46562e2e3 # Parent 356869eb23411ffc9d7796db1a88cd932bdb8fa0 Add margin param for image preview. diff --git a/boards/static/js/image.js b/boards/static/js/image.js --- a/boards/static/js/image.js +++ b/boards/static/js/image.js @@ -1,4 +1,6 @@ function addImgPreview() { + var margin = 20; + //keybind $(document).on('keyup.removepic', function(e) { if(e.which === 27) { @@ -18,12 +20,12 @@ function addImgPreview() { var win_h = $(window).height(); //new image size if (img_w > win_w) { - img_h = img_h * (win_w/img_w); - img_w = win_w; + img_h = img_h * (win_w/img_w) - margin; + img_w = win_w - margin; } if (img_h > win_h) { - img_w = img_w * (win_h/img_h); - img_h = win_h; + img_w = img_w * (win_h/img_h) - margin; + img_h = win_h - margin; } var img_pv = new Image();