Skip to content

Commit

Permalink
Prevent the default image dragging behavior in IE < 9
Browse files Browse the repository at this point in the history
  • Loading branch information
austinhyde committed Jan 24, 2014
1 parent a4901e6 commit faef6a3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions css/ol.css
Expand Up @@ -159,6 +159,11 @@ a.ol-full-screen-true:after {
-ms-user-select: none;
user-select: none;
-webkit-tap-highlight-color: rgba(0,0,0,0);

cursor: default;
}
.ol-viewport .ol-unselectable:not([ie8andbelow]) {
cursor: auto;
}
.ol-zoom {
position: absolute;
Expand Down
10 changes: 10 additions & 0 deletions src/ol/renderer/dom/dommaprenderer.js
Expand Up @@ -3,7 +3,9 @@ goog.provide('ol.renderer.dom.Map');
goog.require('goog.asserts');
goog.require('goog.dom');
goog.require('goog.dom.TagName');
goog.require('goog.functions');
goog.require('goog.style');
goog.require('goog.userAgent');
goog.require('ol.css');
goog.require('ol.layer.Image');
goog.require('ol.layer.Tile');
Expand Down Expand Up @@ -36,6 +38,14 @@ ol.renderer.dom.Map = function(container, map) {
style.width = '100%';
style.height = '100%';

// in IE < 9, we need to return false from ondragstart to cancel the default
// behavior of dragging images, which is interfering with the custom handler
// in the Drag interaction subclasses
if (goog.userAgent.IE && !goog.userAgent.isVersionOrHigher('9.0')) {
this.layersPane_.ondragstart = goog.functions.FALSE;
this.layersPane_.onselectstart = goog.functions.FALSE;
}

goog.dom.insertChildAt(container, this.layersPane_, 0);

/**
Expand Down

0 comments on commit faef6a3

Please sign in to comment.