Revert "Consistent mouse event propagation in Marker and Path"

This reverts commit 4015f49615.
This commit is contained in:
John Firebaugh 2013-06-28 16:22:20 -04:00
parent 3f85f7c86e
commit 475e736346
5 changed files with 5 additions and 38 deletions

View File

@ -67,7 +67,6 @@
<!-- /layer/vector/ -->
<script type="text/javascript" src="suites/layer/vector/CircleSpec.js"></script>
<script type="text/javascript" src="suites/layer/vector/CircleMarkerSpec.js"></script>
<script type="text/javascript" src="suites/layer/vector/PathSpec.js"></script>
<script type="text/javascript" src="suites/layer/vector/PolygonSpec.js"></script>
<script type="text/javascript" src="suites/layer/vector/PolylineSpec.js"></script>
<script type="text/javascript" src="suites/layer/vector/PolylineGeometrySpec.js"></script>

View File

@ -1,22 +1,10 @@
describe("Marker", function () {
var map;
var map,
spy;
beforeEach(function () {
map = L.map(document.createElement('div')).setView([0, 0], 0);
});
it("propagates events from the icon", function() {
var events = ['mousedown', 'mouseup', 'mouseover', 'mouseout',
'mousemove', 'dblclick'];
for (var i = 0; i < events.length; i++) {
var marker = new L.Marker([0, 0]).addTo(map),
spy = sinon.spy();
marker.on(events[i], spy);
happen[events[i]](marker._icon);
expect(spy.called).to.be.ok();
}
});
describe("#setIcon", function () {
it("changes the icon to another image", function () {
var marker = new L.Marker([0, 0], {icon: new L.Icon({iconUrl: 'icon1.png' }) });

View File

@ -1,19 +0,0 @@
describe("Path", function() {
var map;
beforeEach(function () {
map = L.map(document.createElement('div')).setView([0, 0], 0);
});
it("propagates events from the container", function() {
var events = ['mousedown', 'mouseup', 'mouseover', 'mouseout',
'mousemove', 'dblclick'];
for (var i = 0; i < events.length; i++) {
var path = new L.Path().addTo(map),
spy = sinon.spy();
path.on(events[i], spy);
happen[events[i]](path._container);
expect(spy.called).to.be.ok();
}
});
});

View File

@ -214,8 +214,7 @@ L.Marker = L.Class.extend({
// TODO refactor into something shared with Map/Path/etc. to DRY it up
var icon = this._icon,
events = ['mousedown', 'mouseup', 'mouseover', 'mouseout',
'mousemove', 'dblclick', 'contextmenu'];
events = ['dblclick', 'mousedown', 'mouseover', 'mouseout', 'contextmenu'];
L.DomUtil.addClass(icon, 'leaflet-clickable');
L.DomEvent.on(icon, 'click', this._onMouseClick, this);

View File

@ -109,8 +109,8 @@ L.Path = L.Path.extend({
L.DomEvent.on(this._container, 'click', this._onMouseClick, this);
var events = ['mousedown', 'mouseup', 'mouseover', 'mouseout',
'mousemove', 'dblclick', 'contextmenu'];
var events = ['dblclick', 'mousedown', 'mouseover',
'mouseout', 'mousemove', 'contextmenu'];
for (var i = 0; i < events.length; i++) {
L.DomEvent.on(this._container, events[i], this._fireMouseEvent, this);
}