yuntaozhu / closure-library

Automatically exported from code.google.com/p/closure-library
0 stars 0 forks source link

Bug in goog.fx.DragScrollSupport#constrainBounds_ #577

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago

What steps will reproduce the problem?
1. Run this test code:
     goog.fx.DragScrollSupport.prototype.constrainBounds_.call({margin_:25}, new goog.math.Rect(0, 0, 100, 100))

What is the expected output? What do you see instead?

A goog.math.Rect constrained by a margin of 25 is expected: {left: 25, top: 25, 
width: 50, height: 50 }
Instead, #constrainBounds_ produces a goog.math.Rect with this value: {left: 0, 
top: 50, width: 100, height: 0 }

What version of the product are you using? On what operating system?

6fb5ead969d2

Please provide any additional information below.

The problem is located at lines 193 and 194 in goog/fx/dragscrollsupport.js:

    bounds.top += xMargin;
    bounds.height -= 2 * xMargin;

This issue is fixed if I change them to:

    bounds.left += xMargin;
    bounds.width -= 2 * xMargin;

Note: we cannot accept patches without the contributor license agreement
being signed. See http://code.google.com/p/closure-
library/wiki/Contributors for more info.

Original issue reported on code.google.com by alo.and on 30 Jul 2013 at 1:49