mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-16 05:49:16 +02:00
Fix dragging ways, add way method to connection
This commit is contained in:
+1
-1
@@ -111,7 +111,7 @@
|
||||
d3.select('#redo').on('click', map.redo);
|
||||
|
||||
d3.select(document).on('keydown', function() {
|
||||
console.log(d3.event);
|
||||
// console.log(d3.event);
|
||||
// cmd-z
|
||||
if (d3.event.which === 90 && d3.event.metaKey) {
|
||||
map.undo();
|
||||
|
||||
+11
-3
@@ -4,11 +4,16 @@ iD.Connection = function(graph) {
|
||||
var connection = {};
|
||||
|
||||
// Request data within the bbox from an external OSM server.
|
||||
function loadFromAPI(box, callback) {
|
||||
function bboxFromAPI(box, callback) {
|
||||
loadFromURL(apiURL + 'map?bbox=' +
|
||||
[box[0][0], box[1][1], box[1][0], box[0][1]], callback);
|
||||
}
|
||||
|
||||
// Request data within the bbox from an external OSM server.
|
||||
function wayFromAPI(id, callback) {
|
||||
loadFromURL(apiURL + 'way/' + id + '/full', callback);
|
||||
}
|
||||
|
||||
function loadFromURL(url, callback) {
|
||||
d3.xml(url, parse(callback));
|
||||
}
|
||||
@@ -87,9 +92,12 @@ iD.Connection = function(graph) {
|
||||
}
|
||||
|
||||
connection.graph = graph;
|
||||
connection.loadFromAPI = loadFromAPI;
|
||||
connection.objectData = objectData;
|
||||
|
||||
connection.bboxFromAPI = bboxFromAPI;
|
||||
connection.wayFromAPI = wayFromAPI;
|
||||
connection.loadFromURL = loadFromURL;
|
||||
|
||||
connection.objectData = objectData;
|
||||
connection.apiURL = apiURL;
|
||||
|
||||
return connection;
|
||||
|
||||
@@ -4,12 +4,12 @@ iD.Graph.prototype = {
|
||||
|
||||
// a pointer to the top of the stack.
|
||||
head: {},
|
||||
// a pointer to the latest annotation
|
||||
annotation: null,
|
||||
|
||||
// stack of previous versions of this datastructure
|
||||
prev: [],
|
||||
|
||||
// messages
|
||||
// stack of previous annotations
|
||||
annotations: [],
|
||||
|
||||
// get all points that are not part of a way. this is an expensive
|
||||
|
||||
@@ -38,7 +38,7 @@ iD.Map = function(elem) {
|
||||
// this is used with handles
|
||||
dragbehavior = d3.behavior.drag()
|
||||
.origin(function(d) {
|
||||
var data = (typeof d === 'number') ? graph.head[d] : d;
|
||||
var data = (typeof d === 'string') ? graph.head[d] : d;
|
||||
graph.modify(function(o) {
|
||||
var c = {};
|
||||
c[data.id] = pdata.object(data).set({ modified: true }).get();
|
||||
@@ -57,7 +57,7 @@ iD.Map = function(elem) {
|
||||
drawVector();
|
||||
})
|
||||
.on('dragend', function(d) {
|
||||
var data = (typeof d === 'number') ? graph.head[d] : d;
|
||||
var data = (typeof d === 'string') ? graph.head[d] : d;
|
||||
graph.modify(function(o) {
|
||||
var c = {};
|
||||
c[data.id] = pdata.object(c[data.id]).get();
|
||||
@@ -205,7 +205,7 @@ iD.Map = function(elem) {
|
||||
}
|
||||
|
||||
var download = _.debounce(function() {
|
||||
connection.loadFromAPI(getExtent(), drawVector);
|
||||
connection.bboxFromAPI(getExtent(), drawVector);
|
||||
}, 1000);
|
||||
|
||||
function deselectClick() {
|
||||
|
||||
@@ -17,7 +17,7 @@ iD.Inspector = function(graph) {
|
||||
head.append('a')
|
||||
.attr('class', 'permalink')
|
||||
.attr('href', 'http://www.openstreetmap.org/browse/' +
|
||||
d.type + '/' + d.id)
|
||||
d.type + '/' + d.id.slice(1))
|
||||
.text('OSM');
|
||||
|
||||
head.append('a')
|
||||
|
||||
Reference in New Issue
Block a user