removes not needed WeakMap struct
This commit is contained in:
@@ -43,7 +43,6 @@ goog.require('ol.pointer.MsSource');
|
|||||||
goog.require('ol.pointer.NativeSource');
|
goog.require('ol.pointer.NativeSource');
|
||||||
goog.require('ol.pointer.PointerEvent');
|
goog.require('ol.pointer.PointerEvent');
|
||||||
goog.require('ol.pointer.TouchSource');
|
goog.require('ol.pointer.TouchSource');
|
||||||
goog.require('ol.structs.WeakMap');
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -69,18 +68,6 @@ ol.pointer.PointerEventHandler = function(element) {
|
|||||||
this.pointerMap = new goog.structs.Map();
|
this.pointerMap = new goog.structs.Map();
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @const
|
|
||||||
* @type {ol.structs.WeakMap}
|
|
||||||
*/
|
|
||||||
this.targets = new ol.structs.WeakMap();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @const
|
|
||||||
* @type {ol.structs.WeakMap}
|
|
||||||
*/
|
|
||||||
this.handledEvents = new ol.structs.WeakMap();
|
|
||||||
|
|
||||||
this.eventMap = {};
|
this.eventMap = {};
|
||||||
|
|
||||||
// Scope objects for native events.
|
// Scope objects for native events.
|
||||||
@@ -215,19 +202,11 @@ ol.pointer.PointerEventHandler.prototype.unregister_ = function() {
|
|||||||
* @param {goog.events.BrowserEvent} inEvent Browser event.
|
* @param {goog.events.BrowserEvent} inEvent Browser event.
|
||||||
*/
|
*/
|
||||||
ol.pointer.PointerEventHandler.prototype.eventHandler_ = function(inEvent) {
|
ol.pointer.PointerEventHandler.prototype.eventHandler_ = function(inEvent) {
|
||||||
// This is used to prevent multiple dispatch of pointerevents from
|
|
||||||
// platform events. This can happen when two elements in different scopes
|
|
||||||
// are set up to create pointer events, which is relevant to Shadow DOM.
|
|
||||||
if (this.handledEvents['get'](inEvent)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var type = inEvent.type;
|
var type = inEvent.type;
|
||||||
var handler = this.eventMap[type];
|
var handler = this.eventMap[type];
|
||||||
if (handler) {
|
if (handler) {
|
||||||
handler(inEvent);
|
handler(inEvent);
|
||||||
}
|
}
|
||||||
this.handledEvents['set'](inEvent, true);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -503,7 +482,6 @@ ol.pointer.PointerEventHandler.prototype.makeEvent = function(inType, inEvent) {
|
|||||||
if (inEvent.preventDefault) {
|
if (inEvent.preventDefault) {
|
||||||
e.preventDefault = inEvent.preventDefault;
|
e.preventDefault = inEvent.preventDefault;
|
||||||
}
|
}
|
||||||
this.targets['set'](e, this.targets['get'](inEvent) || inEvent.target);
|
|
||||||
|
|
||||||
return e;
|
return e;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,101 +0,0 @@
|
|||||||
// Based on https://github.com/Polymer/WeakMap
|
|
||||||
|
|
||||||
// Copyright (c) 2013 The Polymer Authors. All rights reserved.
|
|
||||||
//
|
|
||||||
// Redistribution and use in source and binary forms, with or without
|
|
||||||
// modification, are permitted provided that the following conditions are
|
|
||||||
// met:
|
|
||||||
//
|
|
||||||
// * Redistributions of source code must retain the above copyright
|
|
||||||
// notice, this list of conditions and the following disclaimer.
|
|
||||||
// * Redistributions in binary form must reproduce the above
|
|
||||||
// copyright notice, this list of conditions and the following disclaimer
|
|
||||||
// in the documentation and/or other materials provided with the
|
|
||||||
// distribution.
|
|
||||||
// * Neither the name of Google Inc. nor the names of its
|
|
||||||
// contributors may be used to endorse or promote products derived from
|
|
||||||
// this software without specific prior written permission.
|
|
||||||
//
|
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
||||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
|
|
||||||
goog.provide('ol.structs.WeakMap');
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @suppress {undefinedVars}
|
|
||||||
* @return {boolean} Is `WeakMap` already defined?
|
|
||||||
*/
|
|
||||||
ol.structs.isWeakMapUndefined = function() {
|
|
||||||
return typeof WeakMap === 'undefined';
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
if (ol.structs.isWeakMapUndefined()) {
|
|
||||||
/**
|
|
||||||
* @constructor
|
|
||||||
*/
|
|
||||||
ol.structs.WeakMap = function() {
|
|
||||||
this.name = '__st' + (Math.random() * 1e9 >>> 0) +
|
|
||||||
(ol.structs.WeakMap.counter++ + '__');
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @this {ol.structs.WeakMap}
|
|
||||||
* @param {*} key
|
|
||||||
* @param {*} value
|
|
||||||
*/
|
|
||||||
ol.structs.WeakMap.prototype['set'] = function(key, value) {
|
|
||||||
var entry = key[this.name];
|
|
||||||
if (entry && entry[0] === key)
|
|
||||||
entry[1] = value;
|
|
||||||
else
|
|
||||||
ol.structs.WeakMap.defineProperty(key, this.name,
|
|
||||||
{value: [key, value], writable: true});
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @this {ol.structs.WeakMap}
|
|
||||||
* @param {*} key
|
|
||||||
* @return {*}
|
|
||||||
*/
|
|
||||||
ol.structs.WeakMap.prototype['get'] = function(key) {
|
|
||||||
var entry;
|
|
||||||
return (entry = key[this.name]) && entry[0] === key ?
|
|
||||||
entry[1] : undefined;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @this {ol.structs.WeakMap}
|
|
||||||
* @param {*} key
|
|
||||||
*/
|
|
||||||
ol.structs.WeakMap.prototype['delete'] = function(key) {
|
|
||||||
this['set'](key, undefined);
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
ol.structs.WeakMap = WeakMap;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @type {function(...)}
|
|
||||||
*/
|
|
||||||
ol.structs.WeakMap.defineProperty = Object.defineProperty;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @type {number}
|
|
||||||
*/
|
|
||||||
ol.structs.WeakMap.counter = Date.now() % 1e9;
|
|
||||||
Reference in New Issue
Block a user