← Back to team overview

yellow team mailing list archive

Fix 1px too wide svg issue (issue 6814125)

 

Reviewers: mp+133989_code.launchpad.net,

Message:
Please take a look.

Description:
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

(do not edit description out of merge proposal)


Please review this at https://codereview.appspot.com/6814125/

Affected files:
   A [revision details]
   M app/views/utils.js


Index: [revision details]
=== added file '[revision details]'
--- [revision details]	2012-01-01 00:00:00 +0000
+++ [revision details]	2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision: matthew.scott@xxxxxxxxxxxxx-20121109212716-o9xv6d3cbvclvcq8
+New revision: matthew.scott@xxxxxxxxxxxxx-20121112203610-er70riqmmilvlqcs

Index: app/views/utils.js
=== 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:36:10 +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);





-- 
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.


References