Namespace all events

This commit is contained in:
Tom MacWright
2012-12-11 12:02:01 -05:00
parent c8b79dd4a0
commit 435b7f46fc
8 changed files with 13 additions and 12 deletions

View File

@@ -4,6 +4,7 @@ iD.modes.DrawRoad = function(wayId, direction) {
};
mode.enter = function() {
var map = mode.map,
history = mode.history,
controller = mode.controller,

View File

@@ -53,7 +53,7 @@ iD.modes.Select = function (entity) {
mode.enter = function () {
iD.modes._dragFeatures(mode);
target = mode.map.surface.selectAll("*")
target = mode.map.surface.selectAll('*')
.filter(function (d) { return d === entity; });
d3.select('.inspector-wrap')
@@ -88,7 +88,7 @@ iD.modes.Select = function (entity) {
target.call(dragWay);
}
mode.map.surface.on("click.browse", function () {
mode.map.surface.on('click.browse', function () {
var datum = d3.select(d3.event.target).datum();
if (datum instanceof iD.Entity) {
mode.controller.enter(iD.modes.Select(datum));
@@ -116,7 +116,7 @@ iD.modes.Select = function (entity) {
.on('touchstart.drag', null);
}
mode.map.surface.on("click.browse", null);
mode.map.surface.on('click.browse', null);
mode.map.keybinding().on('⌫.browse', null);
mode.map.selection(null);

View File

@@ -33,8 +33,8 @@ iD.Map = function() {
.call(zoom);
surface = supersurface.append('svg')
.on('mouseup', resetTransform)
.on('touchend', resetTransform);
.on('mouseup.reset-transform', resetTransform)
.on('touchend.reset-transform', resetTransform);
defs = surface.append('defs');
defs.append('clipPath')

View File

@@ -40,14 +40,14 @@ iD.commit = function() {
body.append('button').text('Save')
.attr('class', 'save')
.on('click', function() {
.on('click.save', function() {
event.save({
comment: d3.select('textarea.changeset-comment').node().value
});
});
body.append('button').text('Cancel')
.attr('class', 'cancel')
.on('click', function() {
.on('click.cancel', function() {
event.cancel();
});
}

View File

@@ -6,7 +6,7 @@ iD.confirm = function(message) {
modal.select('.content')
.append('button')
.text('OK')
.on('click', function() {
.on('click.confirm', function() {
modal.remove();
});

View File

@@ -72,7 +72,7 @@ iD.layerswitcher = function(map) {
.attr('data-original-title', function(d) {
return d.label + " opacity";
})
.on('click', function(d) {
.on('click.set-opacity', function(d) {
d3.select('#tile-g')
.transition()
.style('opacity', d.level)
@@ -116,7 +116,7 @@ iD.layerswitcher = function(map) {
return d.name;
})
.call(bootstrap.tooltip().placement('right'))
.on('click', function(d) {
.on('click.set-source', function(d) {
d3.event.preventDefault();
map.background.source(d.source);
map.redraw();

View File

@@ -7,7 +7,7 @@ iD.modal = function() {
var shaded = d3.select(document.body)
.append('div').attr('class', 'shaded')
.style('opacity', 0)
.on('click', function() {
.on('click.remove-modal', function() {
if (d3.event.target == this) this.remove();
});

View File

@@ -19,7 +19,7 @@ iD.userpanel = function(connection) {
.attr('class', 'logout')
.attr('href', '#')
.text('logout')
.on('click', function() {
.on('click.logout', function() {
d3.event.preventDefault();
event.logout();
});