Fix scrolled text input widgetdiv positioning. (#3533)

* Fix scrolled text input widgetdiv positioning.

* Fix dropdown div bounds element when scrolled.
This commit is contained in:
Sam El-Husseini
2020-01-02 17:19:32 -08:00
committed by GitHub
parent 4ce67bb108
commit f06d7b3cfd
2 changed files with 11 additions and 10 deletions

View File

@@ -377,16 +377,16 @@ Blockly.DropDownDiv.show = function(owner, rtl, primaryX, primaryY,
* @private
*/
Blockly.DropDownDiv.getBoundsInfo_ = function() {
var boundPosition = Blockly.DropDownDiv.boundsElement_
.getBoundingClientRect();
var boundPosition = Blockly.utils.style.getPageOffset(
/** @type {!Element} */ (Blockly.DropDownDiv.boundsElement_));
var boundSize = Blockly.utils.style.getSize(
Blockly.DropDownDiv.boundsElement_);
/** @type {!Element} */ (Blockly.DropDownDiv.boundsElement_));
return {
left: boundPosition.left,
right: boundPosition.left + boundSize.width,
top: boundPosition.top,
bottom: boundPosition.top + boundSize.height,
left: boundPosition.x,
right: boundPosition.x + boundSize.width,
top: boundPosition.y,
bottom: boundPosition.y + boundSize.height,
width: boundSize.width,
height: boundSize.height
};

View File

@@ -698,9 +698,10 @@ Blockly.Field.prototype.getScaledBBox = function() {
scaledHeight += 1 * scale;
}
} else {
var xy = this.borderRect_.getBoundingClientRect();
var scaledWidth = xy.width;
var scaledHeight = xy.height;
var bBox = this.borderRect_.getBoundingClientRect();
var xy = Blockly.utils.style.getPageOffset(this.borderRect_);
var scaledWidth = bBox.width;
var scaledHeight = bBox.height;
}
return {
top: xy.y,