Skip to content

Commit

Permalink
this commit fixes Leaflet#2499
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreyGeonya committed Aug 5, 2014
1 parent a321406 commit 9445c2f
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion debug/tests/click_on_canvas.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
opacity: 1,
smoothFactor: 1,
color: 'red',
clickable:true
interactive:true
}));

polygons.on('click', function(m) {
Expand Down
2 changes: 1 addition & 1 deletion debug/tests/svg_clicks.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
[51, 7.000],
[51.002, 7.004]
],
{ clickable:false,color:'#f00' }
{ interactive:false,color:'#f00' }
).addTo(map);

// when the mouse hovers over the red route2, you cannot click through the blue route1 beneath
Expand Down
6 changes: 3 additions & 3 deletions dist/leaflet.css
Original file line number Diff line number Diff line change
Expand Up @@ -171,23 +171,23 @@

/* cursors */

.leaflet-clickable {
.leaflet-interactive {
cursor: pointer;
}
.leaflet-container {
cursor: -webkit-grab;
cursor: -moz-grab;
}
.leaflet-crosshair,
.leaflet-crosshair .leaflet-clickable {
.leaflet-crosshair .leaflet-interactive {
cursor: crosshair;
}
.leaflet-popup-pane,
.leaflet-control {
cursor: auto;
}
.leaflet-dragging .leaflet-container,
.leaflet-dragging .leaflet-clickable {
.leaflet-dragging .leaflet-interactive {
cursor: move;
cursor: -webkit-grabbing;
cursor: -moz-grabbing;
Expand Down
6 changes: 3 additions & 3 deletions src/layer/marker/Marker.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ L.Marker = L.Layer.extend({
icon: new L.Icon.Default(),
// title: '',
// alt: '',
clickable: true,
interactive: true,
// draggable: false,
keyboard: true,
zIndexOffset: 0,
Expand Down Expand Up @@ -201,9 +201,9 @@ L.Marker = L.Layer.extend({

_initInteraction: function () {

if (!this.options.clickable) { return; }
if (!this.options.interactive) { return; }

L.DomUtil.addClass(this._icon, 'leaflet-clickable');
L.DomUtil.addClass(this._icon, 'leaflet-interactive');

L.DomEvent.on(this._icon, 'click dblclick mousedown mouseup mouseover mousemove mouseout contextmenu keypress',
this._fireMouseEvent, this);
Expand Down
6 changes: 3 additions & 3 deletions src/layer/vector/Canvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,12 +207,12 @@ L.Canvas = L.Renderer.extend({
},

_handleHover: function (layer, e, point) {
if (!layer.options.clickable) { return; }
if (!layer.options.interactive) { return; }

if (layer._containsPoint(point)) {
// if we just got inside the layer, fire mouseover
if (!layer._mouseInside) {
L.DomUtil.addClass(this._container, 'leaflet-clickable'); // change cursor
L.DomUtil.addClass(this._container, 'leaflet-interactive'); // change cursor
layer._fireMouseEvent(e, 'mouseover');
layer._mouseInside = true;
}
Expand All @@ -221,7 +221,7 @@ L.Canvas = L.Renderer.extend({

} else if (layer._mouseInside) {
// if we're leaving the layer, fire mouseout
L.DomUtil.removeClass(this._container, 'leaflet-clickable');
L.DomUtil.removeClass(this._container, 'leaflet-interactive');
layer._fireMouseEvent(e, 'mouseout');
layer._mouseInside = false;
}
Expand Down
2 changes: 1 addition & 1 deletion src/layer/vector/Path.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ L.Path = L.Layer.extend({
fillOpacity: 0.2,

// className: ''
clickable: true
interactive: true
},

onAdd: function () {
Expand Down
6 changes: 3 additions & 3 deletions src/layer/vector/SVG.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ L.SVG = L.Renderer.extend({
L.DomUtil.addClass(path, layer.options.className);
}

if (layer.options.clickable) {
L.DomUtil.addClass(path, 'leaflet-clickable');
if (layer.options.interactive) {
L.DomUtil.addClass(path, 'leaflet-interactive');
}

this._updateStyle(layer);
Expand Down Expand Up @@ -116,7 +116,7 @@ L.SVG = L.Renderer.extend({
path.setAttribute('fill', 'none');
}

path.setAttribute('pointer-events', options.pointerEvents || (options.clickable ? 'visiblePainted' : 'none'));
path.setAttribute('pointer-events', options.pointerEvents || (options.interactive ? 'visiblePainted' : 'none'));
},

_updatePoly: function (layer, closed) {
Expand Down

0 comments on commit 9445c2f

Please sign in to comment.