From 361549368c8c8d014a3681c43277e34e3546e2ae Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Thu, 18 Oct 2012 15:42:17 -0400 Subject: [PATCH] Preventdefault to prevent hash links from changing the url --- js/iD/Way.js | 8 ++++---- js/iD/controller/edit/EditBaseState.js | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/js/iD/Way.js b/js/iD/Way.js index 240970467..eec676970 100644 --- a/js/iD/Way.js +++ b/js/iD/Way.js @@ -21,12 +21,12 @@ iD.Way = function(conn, id, nodes, tags, loaded) { iD.Way.prototype = { isClosed: function() { - // summary: Is this a closed way (first and last nodes the same)? - return this.nodes[this.nodes.length - 1] === this.nodes[0]; // Boolean + // summary: Is this a closed way (first and last nodes the same)? + return this.nodes[this.nodes.length - 1] === this.nodes[0]; }, isType: function(type) { - // summary: Is this a 'way' (always true), an 'area' (closed) or a 'line' (unclosed)? + // summary: Is this a 'way' (always true), an 'area' (closed) or a 'line' (unclosed)? if (type === 'way') return true; if (type === 'area') return this.isClosed(); if (type === 'line') return !(this.isClosed()); @@ -134,7 +134,7 @@ iD.Way.prototype = { _pythagoras:function(node1, node2) { return (Math.sqrt(Math.pow(node1.lon-node2.lon,2) + - Math.pow(node1.latp-node2.latp,2))); + Math.pow(node1.latp-node2.latp,2))); }, _calculateSnappedPoint:function(node1, node2, newNode) { diff --git a/js/iD/controller/edit/EditBaseState.js b/js/iD/controller/edit/EditBaseState.js index 5dcab9a08..db9b4ec2a 100644 --- a/js/iD/controller/edit/EditBaseState.js +++ b/js/iD/controller/edit/EditBaseState.js @@ -32,6 +32,7 @@ declare("iD.controller.edit.EditBaseState", [iD.controller.ControllerState], { .attr('href').split('#').pop(); $('.edit-pane .hud').hide(); $('.edit-pane .' + hud).show(); + return e.preventDefault(); }); $('.edit-pane a.tab:first').click(); $('.edit-pane .tags tbody').empty();