Replace goog.events.Event/EventTarget system with our own
This also removes goog.events.listen, goog.events.unlisten, goog.events.unlistenByKey and goog.events.BrowserEvent.
This commit is contained in:
+27
-11
@@ -26,10 +26,10 @@ ol.events.ConditionType;
|
||||
* @api stable
|
||||
*/
|
||||
ol.events.condition.altKeyOnly = function(mapBrowserEvent) {
|
||||
var browserEvent = mapBrowserEvent.browserEvent;
|
||||
var browserEvent = mapBrowserEvent.originalEvent;
|
||||
return (
|
||||
browserEvent.altKey &&
|
||||
!browserEvent.platformModifierKey &&
|
||||
!(browserEvent.metaKey || browserEvent.ctrlKey) &&
|
||||
!browserEvent.shiftKey);
|
||||
};
|
||||
|
||||
@@ -43,10 +43,10 @@ ol.events.condition.altKeyOnly = function(mapBrowserEvent) {
|
||||
* @api stable
|
||||
*/
|
||||
ol.events.condition.altShiftKeysOnly = function(mapBrowserEvent) {
|
||||
var browserEvent = mapBrowserEvent.browserEvent;
|
||||
var browserEvent = mapBrowserEvent.originalEvent;
|
||||
return (
|
||||
browserEvent.altKey &&
|
||||
!browserEvent.platformModifierKey &&
|
||||
!(browserEvent.metaKey || browserEvent.ctrlKey) &&
|
||||
browserEvent.shiftKey);
|
||||
};
|
||||
|
||||
@@ -74,6 +74,22 @@ ol.events.condition.click = function(mapBrowserEvent) {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Return `true` if the event has an "action"-producing mouse button.
|
||||
*
|
||||
* By definition, this includes left-click on windows/linux, and left-click
|
||||
* without the ctrl key on Macs.
|
||||
*
|
||||
* @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event.
|
||||
* @return {boolean} The result.
|
||||
*/
|
||||
ol.events.condition.mouseActionButton = function(mapBrowserEvent) {
|
||||
var browserEvent = mapBrowserEvent.originalEvent;
|
||||
return browserEvent.button == 0 &&
|
||||
!(goog.userAgent.WEBKIT && goog.userAgent.MAC && browserEvent.ctrlKey);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Return always false.
|
||||
*
|
||||
@@ -131,10 +147,10 @@ ol.events.condition.doubleClick = function(mapBrowserEvent) {
|
||||
* @api stable
|
||||
*/
|
||||
ol.events.condition.noModifierKeys = function(mapBrowserEvent) {
|
||||
var browserEvent = mapBrowserEvent.browserEvent;
|
||||
var browserEvent = mapBrowserEvent.originalEvent;
|
||||
return (
|
||||
!browserEvent.altKey &&
|
||||
!browserEvent.platformModifierKey &&
|
||||
!(browserEvent.metaKey || browserEvent.ctrlKey) &&
|
||||
!browserEvent.shiftKey);
|
||||
};
|
||||
|
||||
@@ -149,10 +165,10 @@ ol.events.condition.noModifierKeys = function(mapBrowserEvent) {
|
||||
* @api stable
|
||||
*/
|
||||
ol.events.condition.platformModifierKeyOnly = function(mapBrowserEvent) {
|
||||
var browserEvent = mapBrowserEvent.browserEvent;
|
||||
var browserEvent = mapBrowserEvent.originalEvent;
|
||||
return (
|
||||
!browserEvent.altKey &&
|
||||
browserEvent.platformModifierKey &&
|
||||
(goog.userAgent.MAC ? browserEvent.metaKey : browserEvent.ctrlKey) &&
|
||||
!browserEvent.shiftKey);
|
||||
};
|
||||
|
||||
@@ -166,10 +182,10 @@ ol.events.condition.platformModifierKeyOnly = function(mapBrowserEvent) {
|
||||
* @api stable
|
||||
*/
|
||||
ol.events.condition.shiftKeyOnly = function(mapBrowserEvent) {
|
||||
var browserEvent = mapBrowserEvent.browserEvent;
|
||||
var browserEvent = mapBrowserEvent.originalEvent;
|
||||
return (
|
||||
!browserEvent.altKey &&
|
||||
!browserEvent.platformModifierKey &&
|
||||
!(browserEvent.metaKey || browserEvent.ctrlKey) &&
|
||||
browserEvent.shiftKey);
|
||||
};
|
||||
|
||||
@@ -183,7 +199,7 @@ ol.events.condition.shiftKeyOnly = function(mapBrowserEvent) {
|
||||
* @api
|
||||
*/
|
||||
ol.events.condition.targetNotEditable = function(mapBrowserEvent) {
|
||||
var target = mapBrowserEvent.browserEvent.target;
|
||||
var target = mapBrowserEvent.originalEvent.target;
|
||||
goog.asserts.assertInstanceof(target, Element,
|
||||
'target should be an Element');
|
||||
var tagName = target.tagName;
|
||||
|
||||
Reference in New Issue
Block a user