Commit f601bdc3 authored by Neil Fraser's avatar Neil Fraser

Fix FF editor location by a pixel.

parent fe12aeee
This diff is collapsed.
......@@ -227,13 +227,13 @@ Blockly.Field.prototype.getSize = function() {
/**
* Returns the height and width of the field,
* accounting for the workspace scaling.
* @return {!Object} Height and width.
* @return {!goog.math.Size} Height and width.
*/
Blockly.Field.prototype.getScaledBBox_ = function() {
var bBox = this.borderRect_.getBBox();
// Create new object, as getBBox can return an uneditable SVGRect.
return {width: bBox.width * this.sourceBlock_.workspace.scale,
height: bBox.height * this.sourceBlock_.workspace.scale};
// Create new object, as getBBox can return an uneditable SVGRect in IE.
return new goog.math.Size(bBox.width * this.sourceBlock_.workspace.scale,
bBox.height * this.sourceBlock_.workspace.scale);
};
/**
......
......@@ -240,6 +240,12 @@ Blockly.FieldTextInput.prototype.resizeEditor_ = function() {
}
// Shift by a few pixels to line up exactly.
xy.y += 1;
if (goog.userAgent.GECKO && Blockly.WidgetDiv.DIV.style.top) {
// Firefox mis-reports the location of the border by a pixel
// once the WidgetDiv is moved into position.
xy.x -= 1;
xy.y -= 1;
}
if (goog.userAgent.WEBKIT) {
xy.y -= 3;
}
......
......@@ -85,6 +85,8 @@ Blockly.WidgetDiv.show = function(newOwner, rtl, dispose) {
Blockly.WidgetDiv.hide = function() {
if (Blockly.WidgetDiv.owner_) {
Blockly.WidgetDiv.DIV.style.display = 'none';
Blockly.WidgetDiv.DIV.style.left = '';
Blockly.WidgetDiv.DIV.style.top = '';
Blockly.WidgetDiv.dispose_ && Blockly.WidgetDiv.dispose_();
Blockly.WidgetDiv.owner_ = null;
Blockly.WidgetDiv.dispose_ = null;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment