← Back to team overview

yellow team mailing list archive

[Merge] lp:~makyo/juju-gui/svg-width-bug-1076413 into lp:juju-gui

 

Matthew Scott has proposed merging lp:~makyo/juju-gui/svg-width-bug-1076413 into lp:juju-gui.

Requested reviews:
  Juju GUI Hackers (juju-gui)

For more details, see:
https://code.launchpad.net/~makyo/juju-gui/svg-width-bug-1076413/+merge/133989

Fix 1px too wide svg issue

Due to sizes being set with percentages, widths are computed as decimals, but are reported as integers in DOM attributes (Computed width: 1331.949951171875, reported width: 1332) resulting in rounding errors.  YUI's getComputedStyle() returns the decimal width, allowing us to round.
-- 
https://code.launchpad.net/~makyo/juju-gui/svg-width-bug-1076413/+merge/133989
Your team Juju GUI Hackers is requested to review the proposed merge of lp:~makyo/juju-gui/svg-width-bug-1076413 into lp:juju-gui.
=== modified file 'app/views/utils.js'
--- app/views/utils.js	2012-11-01 13:21:53 +0000
+++ app/views/utils.js	2012-11-12 20:39:27 +0000
@@ -811,7 +811,8 @@
           (bottomNavbar ? bottomNavbar.get('offsetHeight') : 0) -
           navbar.get('offsetHeight') - 1;
 
-      result.width = viewport.get('offsetWidth');
+      result.width = Math.floor(parseFloat(
+          viewport.getComputedStyle('width')));
 
       // Make sure we don't get sized any smaller than the minimum.
       result.height = Math.max(result.height, minheight || 0);


Follow ups