From cc71dba657c8081855ac19ee0a1a5827a53d424e Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Tue, 3 Mar 2015 13:50:46 +0000 Subject: [PATCH] Fix the splitter percentage size to 2 trialing decimals --- etemplate/js/et2_widget_split.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/etemplate/js/et2_widget_split.js b/etemplate/js/et2_widget_split.js index 031673085c..f0c09e8a61 100644 --- a/etemplate/js/et2_widget_split.js +++ b/etemplate/js/et2_widget_split.js @@ -188,27 +188,31 @@ var et2_split = et2_DOMWidget.extend([et2_IResizeable,et2_IPrint], var per2pix = function(_size) { var size = _size.replace("%",''); + var pix = 0; if (widget.orientation == "v") { - return size * widget.dynheight.outerNode.width() / 100; + pix = size * widget.dynheight.outerNode.width() / 100; } else { - return size * widget.dynheight.outerNode.height() / 100; + pix = size * widget.dynheight.outerNode.height() / 100; } + return pix.toFixed(2); } //Convert pixel size to percent var pix2per = function (_size) { + var per = 0; if (widget.orientation == "v") { - return _size * 100 / widget.dynheight.outerNode.width() + '%'; + per = _size * 100 / widget.dynheight.outerNode.width(); } else { - return _size * 100 / widget.dynheight.outerNode.height() + '%'; + per = _size * 100 / widget.dynheight.outerNode.height(); } + return per.toFixed(2) + "%"; } // Check for position preference, load it in