Skip to content

Commit

Permalink
Check if the browser's value was plausible, and use it if so.
Browse files Browse the repository at this point in the history
  • Loading branch information
rachel-fenichel committed Apr 12, 2018
1 parent 29571e9 commit 40e74d4
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions core/flyout_vertical.js
Original file line number Diff line number Diff line change
Expand Up @@ -329,8 +329,12 @@ Blockly.VerticalFlyout.prototype.getClientRect = function() {
// oddities in our rendering optimizations. The actual scale is the same
// as the scale on the parent workspace.
var scale = this.targetWorkspace_.options.parentWorkspace.scale;
x += this.leftEdge_ * scale;

var altX = x + this.leftEdge_ * scale;
// If the browser was obviously wrong, use the calculated value. If the
// browser's value was plausible, trust it.
if (Math.abs(altX - x) > 10) {

This comment has been minimized.

Copy link
@picklesrus

picklesrus Apr 12, 2018

Contributor

Can you explain in the comments what plausible and non-plausible numbers are? In other words, I have no context for why 10 is a reasonable comparison point or why I would do the math that is on the left hand side of the comparison.

x = altX;
}
}
return new goog.math.Rect(x, -BIG_NUM, BIG_NUM + width, BIG_NUM * 2);
}
Expand Down

0 comments on commit 40e74d4

Please sign in to comment.