mirror of
https://github.com/google/blockly.git
synced 2026-01-11 10:57:07 +01:00
Remove goog.events.BrowserFeature dependency.
This commit is contained in:
@@ -27,9 +27,9 @@
|
||||
goog.provide('Blockly.Scrollbar');
|
||||
goog.provide('Blockly.ScrollbarPair');
|
||||
|
||||
goog.require('Blockly.Touch');
|
||||
goog.require('Blockly.utils');
|
||||
|
||||
goog.require('goog.events.BrowserFeature');
|
||||
goog.require('goog.math.Coordinate');
|
||||
|
||||
|
||||
@@ -303,7 +303,7 @@ Blockly.Scrollbar.prototype.containerVisible_ = true;
|
||||
* Scrollbars should be larger on touch devices.
|
||||
*/
|
||||
Blockly.Scrollbar.scrollbarThickness = 15;
|
||||
if (goog.events.BrowserFeature.TOUCH_ENABLED) {
|
||||
if (Blockly.Touch.TOUCH_ENABLED) {
|
||||
Blockly.Scrollbar.scrollbarThickness = 25;
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,6 @@ goog.require('Blockly.utils');
|
||||
goog.require('Blockly.VerticalFlyout');
|
||||
|
||||
goog.require('goog.events');
|
||||
goog.require('goog.events.BrowserFeature');
|
||||
goog.require('goog.events.EventType');
|
||||
goog.require('goog.html.SafeHtml');
|
||||
goog.require('goog.math.Rect');
|
||||
@@ -600,7 +599,7 @@ Blockly.Toolbox.TreeControl.prototype.enterDocument = function() {
|
||||
Blockly.Toolbox.TreeControl.superClass_.enterDocument.call(this);
|
||||
|
||||
// Add touch handler.
|
||||
if (goog.events.BrowserFeature.TOUCH_ENABLED) {
|
||||
if (Blockly.Touch.TOUCH_ENABLED) {
|
||||
var el = this.getElement();
|
||||
Blockly.bindEventWithChecks_(el, goog.events.EventType.TOUCHEND, this,
|
||||
this.handleTouchEvent_);
|
||||
|
||||
@@ -32,8 +32,19 @@ goog.provide('Blockly.Touch');
|
||||
|
||||
goog.require('Blockly.utils');
|
||||
|
||||
goog.require('goog.events.BrowserFeature');
|
||||
|
||||
/**
|
||||
* Whether touch is enabled in the browser.
|
||||
* Copied from Closure's goog.events.BrowserFeature.TOUCH_ENABLED
|
||||
*/
|
||||
Blockly.Touch.TOUCH_ENABLED =
|
||||
('ontouchstart' in Blockly.utils.global ||
|
||||
!!(Blockly.utils.global['document'] && document.documentElement &&
|
||||
'ontouchstart' in document.documentElement) ||
|
||||
// IE10 uses non-standard touch events, so it has a different check.
|
||||
!!(Blockly.utils.global['navigator'] &&
|
||||
(Blockly.utils.global['navigator']['maxTouchPoints'] ||
|
||||
Blockly.utils.global['navigator']['msMaxTouchPoints'])))
|
||||
|
||||
/**
|
||||
* Which touch events are we currently paying attention to?
|
||||
@@ -60,7 +71,7 @@ if (Blockly.utils.global['PointerEvent']) {
|
||||
'touchend': ['pointerup'],
|
||||
'touchcancel': ['pointercancel']
|
||||
};
|
||||
} else if (goog.events.BrowserFeature.TOUCH_ENABLED) {
|
||||
} else if (Blockly.Touch.TOUCH_ENABLED) {
|
||||
Blockly.Touch.TOUCH_MAP = {
|
||||
'mousedown': ['touchstart'],
|
||||
'mousemove': ['touchmove'],
|
||||
|
||||
Reference in New Issue
Block a user