Fix references to conn

This commit is contained in:
Tom MacWright
2012-10-19 14:36:35 -04:00
parent 4c3945b985
commit 9c3bba4a5e
5 changed files with 28 additions and 27 deletions
+2 -2
View File
@@ -42,10 +42,10 @@ declare("iD.controller.ControllerState", null, {
return this.__proto__.declaredClass.split('.').slice(2);
},
getConnection:function() {
getConnection: function() {
// summary: Shorthand to return the Connection associated with this Controller (via its Map object).
// return: iD.Connection
return this.controller.map.conn;
return this.controller.map.connection;
},
undoAdder:function() {
+8 -6
View File
@@ -52,7 +52,8 @@ declare("iD.controller.shape.DrawWay", [iD.controller.ControllerState], {
var map = this.controller.map;
var ways, undo, action;
if (event.type=='mouseover' && entityType=='way' &&
if (event.type === 'mouseover' &&
entityType === 'way' &&
entityUI !== this.wayUI) {
// Mouse over way, show hover highlight
@@ -144,7 +145,7 @@ declare("iD.controller.shape.DrawWay", [iD.controller.ControllerState], {
},
updateElastic:function(event) {
var map=this.controller.map;
var map = this.controller.map;
map.drawElastic(
map.lon2coord(this.getDrawingNode().lon),
map.lat2coord(this.getDrawingNode().lat),
@@ -153,11 +154,13 @@ declare("iD.controller.shape.DrawWay", [iD.controller.ControllerState], {
},
getDrawingNode:function() {
return (this.editEnd ? this.way.nodes[this.way.nodes.length - 1] : this.way.nodes[0]);
return this.editEnd ?
this.way.nodes[this.way.nodes.length - 1] : this.way.nodes[0];
},
getStartNode:function() {
return (this.editEnd ? this.way.nodes[0] : this.way.nodes[this.way.nodes.length - 1]);
return this.editEnd ?
this.way.nodes[0] : this.way.nodes[this.way.nodes.length - 1];
},
appendNode:function(node, performAction) {
@@ -170,8 +173,7 @@ declare("iD.controller.shape.DrawWay", [iD.controller.ControllerState], {
appendNewNode:function(event, undo) {
var map=this.controller.map;
var node=this.getConnection().doCreateNode(
{},
var node=this.getConnection().doCreateNode({},
map.coord2lat(map.mouseY(event)),
map.coord2lon(map.mouseX(event)), lang.hitch(undo,undo.push) );
this.appendNode(node, lang.hitch(undo,undo.push));
+4 -4
View File
@@ -13,13 +13,13 @@
*/
define(['dojo/_base/declare','dojo/_base/lang',
define(['dojo/_base/declare',
'iD/actions/UndoableAction',
'iD/controller/ControllerState',
'iD/controller/shape/DrawWay',
'iD/controller/shape/SelectedWay',
'iD/controller/shape/SelectedPOINode'
], function(declare,lang){
], function(declare) {
// ----------------------------------------------------------------------
// ControllerState base class
@@ -68,8 +68,8 @@ declare("iD.controller.shape.NoSelection", [iD.controller.ControllerState], {
var undo = new iD.actions.CompositeUndoableAction();
var startNode = this.getConnection().doCreateNode({},
map.coord2lat(map.mouseY(event)),
map.coord2lon(map.mouseX(event)), lang.hitch(undo,undo.push) );
var way = this.getConnection().doCreateWay({}, [startNode], lang.hitch(undo,undo.push) );
map.coord2lon(map.mouseX(event)), _.bind(undo.push, undo) );
var way = this.getConnection().doCreateWay({}, [startNode], _.bind(undo.push, undo) );
this.controller.undoStack.addAction(undo);
this.controller.map.createUI(way);
return new iD.controller.shape.DrawWay(way);
+6 -7
View File
@@ -278,26 +278,25 @@ declare("iD.renderer.Map", null, {
zoomIn: function() {
// summary: Zoom in by one level (unless maximum reached).
if (this.zoom !== this.MAXSCALE) {
this.changeScale(this.zoom + 1);
}
return this.changeScale(this.zoom + 1);
},
zoomOut: function() {
// summary: Zoom out by one level (unless minimum reached).
if (this.zoom !== this.MINSCALE) {
this.changeScale(this.zoom - 1);
}
this.changeScale(this.zoom - 1);
this.download();
return this;
},
changeScale: function(zoom) {
if (zoom < this.MINSCALE || zoom > this.MAXSCALE) return this;
// summary: Redraw the map at a new zoom level.
this.zoom = zoom;
this._setScaleFactor();
this._blankTiles();
this.updateCoordsFromLatLon(this.centrelat, this.centrelon); // recentre
this.updateUIs(true, true);
return this;
},
_setScaleFactor: function() {
@@ -386,7 +385,7 @@ declare("iD.renderer.Map", null, {
var mask = 1 << (zoom - 1);
if ((coord.x & mask) !== 0) byte++;
if ((coord.y & mask) !== 0) byte += 2;
u = u + byte.toString();
u += byte.toString();
}
return this.tilebaseURL
.replace('$z', coord.z)
+8 -8
View File
@@ -12,17 +12,17 @@ declare("iD.styleparser.RuleSet", null, {
choosers: [], // list of StyleChoosers
callback: null,
constructor:function() {
constructor: function() {
// summary: An entire stylesheet in parsed form.
this.choosers=[];
this.choosers = [];
},
registerCallback:function(callback) {
registerCallback: function(callback) {
// summary: Set a callback function to be called when the CSS is loaded and parsed.
this.callback=callback;
this.callback = callback;
},
getStyles:function(entity, tags, zoom) {
getStyles: function(entity, tags, zoom) {
// summary: Find the styles for a given entity.
var sl=new iD.styleparser.StyleList();
for (var i in this.choosers) {
@@ -39,11 +39,11 @@ declare("iD.styleparser.RuleSet", null, {
parseCSS:function(css) {
// summary: Parse a CSS document into a set of StyleChoosers.
var previous=0; // what was the previous CSS word?
var sc=new iD.styleparser.StyleChooser(); // currently being assembled
this.choosers=[];
var sc = new iD.styleparser.StyleChooser(); // currently being assembled
this.choosers = [];
css = css.replace(/[\r\n]/g,""); // strip linebreaks because JavaScript doesn't have the /s modifier
var o={};
var o = {};
while (css.length>0) {
// CSS comment