Fix the splitter percentage size to 2 trialing decimals

This commit is contained in:
Hadi Nategh 2015-03-03 13:50:11 +00:00
parent 0ffad430f0
commit 854e8b123d

View File

@ -188,27 +188,31 @@ var et2_split = et2_DOMWidget.extend([et2_IResizeable,et2_IPrint],
var per2pix = function(_size) var per2pix = function(_size)
{ {
var size = _size.replace("%",''); var size = _size.replace("%",'');
var pix = 0;
if (widget.orientation == "v") if (widget.orientation == "v")
{ {
return size * widget.dynheight.outerNode.width() / 100; pix = size * widget.dynheight.outerNode.width() / 100;
} }
else else
{ {
return size * widget.dynheight.outerNode.height() / 100; pix = size * widget.dynheight.outerNode.height() / 100;
} }
return pix.toFixed(2);
} }
//Convert pixel size to percent //Convert pixel size to percent
var pix2per = function (_size) var pix2per = function (_size)
{ {
var per = 0;
if (widget.orientation == "v") if (widget.orientation == "v")
{ {
return _size * 100 / widget.dynheight.outerNode.width() + '%'; per = _size * 100 / widget.dynheight.outerNode.width();
} }
else 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 // Check for position preference, load it in