From e2f7111f812295715960733c14897f889cff6c51 Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Sun, 10 Jan 2016 23:22:45 -0500 Subject: [PATCH] Compare graphs instead of using expensive iD.Difference calls --- js/id/ui/entity_editor.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/js/id/ui/entity_editor.js b/js/id/ui/entity_editor.js index 32db20988..1bca3a383 100644 --- a/js/id/ui/entity_editor.js +++ b/js/id/ui/entity_editor.js @@ -126,14 +126,12 @@ iD.ui.EntityEditor = function(context) { function historyChanged() { if (state === 'hide') return; - var entity = context.hasEntity(id); + var entity = context.hasEntity(id), + graph = context.graph(); if (!entity) return; - entityEditor.preset(context.presets().match(entity, context.graph())); - - var head = context.history().difference(); - entityEditor.modified(base && !_.isEqual(base.changes(), head.changes())); - + entityEditor.preset(context.presets().match(entity, graph)); + entityEditor.modified(base !== graph); entityEditor(selection); } @@ -219,9 +217,9 @@ iD.ui.EntityEditor = function(context) { entityEditor.entityID = function(_) { if (!arguments.length) return id; id = _; - entityEditor.preset(context.presets().match(context.entity(id), context.graph())); + base = context.graph(); + entityEditor.preset(context.presets().match(context.entity(id), base)); entityEditor.modified(false); - base = context.history().difference(); coalesceChanges = false; return entityEditor; };