mirror of
https://github.com/google/blockly.git
synced 2026-01-23 00:30:10 +01:00
Remove last goog.dom dependency.
This commit is contained in:
@@ -972,6 +972,24 @@ Blockly.utils.containsNode = function(parent, descendant) {
|
||||
Node.DOCUMENT_POSITION_CONTAINED_BY);
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets the document scroll distance as a coordinate object.
|
||||
* Copied from Closure's goog.dom.getDocumentScroll.
|
||||
* @return {!goog.math.Coordinate} Object with values 'x' and 'y'.
|
||||
*/
|
||||
Blockly.utils.getDocumentScroll = function() {
|
||||
var el = document.documentElement;
|
||||
var win = window;
|
||||
if (Blockly.userAgent.IE && win.pageYOffset != el.scrollTop) {
|
||||
// The keyboard on IE10 touch devices shifts the page using the pageYOffset
|
||||
// without modifying scrollTop. For this case, we want the body scroll
|
||||
// offsets.
|
||||
return new goog.math.Coordinate(el.scrollLeft, el.scrollTop);
|
||||
}
|
||||
return new goog.math.Coordinate(
|
||||
win.pageXOffset || el.scrollLeft, win.pageYOffset || el.scrollTop);
|
||||
};
|
||||
|
||||
/**
|
||||
* Get a map of all the block's descendants mapping their type to the number of
|
||||
* children with that type.
|
||||
|
||||
@@ -51,7 +51,6 @@ goog.require('Blockly.WorkspaceDragSurfaceSvg');
|
||||
goog.require('Blockly.Xml');
|
||||
goog.require('Blockly.ZoomControls');
|
||||
|
||||
goog.require('goog.dom');
|
||||
goog.require('goog.math.Coordinate');
|
||||
|
||||
|
||||
@@ -774,7 +773,7 @@ Blockly.WorkspaceSvg.prototype.resize = function() {
|
||||
Blockly.WorkspaceSvg.prototype.updateScreenCalculationsIfScrolled =
|
||||
function() {
|
||||
/* eslint-disable indent */
|
||||
var currScroll = goog.dom.getDocumentScroll();
|
||||
var currScroll = Blockly.utils.getDocumentScroll();
|
||||
if (!goog.math.Coordinate.equals(this.lastRecordedPageScroll_, currScroll)) {
|
||||
this.lastRecordedPageScroll_ = currScroll;
|
||||
this.updateScreenCalculations_();
|
||||
|
||||
Reference in New Issue
Block a user