Reduce drawing during history changes

(closes #6086)
This commit is contained in:
Bryan Housel
2019-04-03 23:26:26 -04:00
parent 86de378de5
commit 87e3b928d0
5 changed files with 21 additions and 15 deletions
+3 -5
View File
@@ -263,7 +263,7 @@ export function rendererMap(context) {
}
function drawVector(difference, extent) {
function drawEditable(difference, extent) {
var mode = context.mode();
var graph = context.graph();
var features = context.features();
@@ -576,15 +576,13 @@ export function rendererMap(context) {
if (!difference) {
supersurface.call(context.background());
wrapper.call(drawLayers);
}
wrapper
.call(drawLayers);
// OSM
if (map.editable()) {
context.loadTiles(projection);
drawVector(difference, extent);
drawEditable(difference, extent);
} else {
editOff();
}
+2 -1
View File
@@ -239,8 +239,9 @@ export function uiEntityEditor(context) {
.on('change.entity-editor', historyChanged);
function historyChanged() {
function historyChanged(difference) {
if (_state === 'hide') return;
if (!difference || !difference.didChange.properties) return;
var entity = context.hasEntity(_entityID);
var graph = context.graph();
+7 -5
View File
@@ -1,7 +1,4 @@
import {
event as d3_event,
select as d3_select
} from 'd3-selection';
import { event as d3_event, select as d3_select } from 'd3-selection';
import { t } from '../util/locale';
import { modeSelect } from '../modes';
@@ -46,7 +43,12 @@ export function uiSelectionList(context, selectedIDs) {
.append('div')
.attr('class', 'feature-list cf');
context.history().on('change.selection-list', drawList);
context.history()
.on('change.selectionList', function(difference) {
if (difference) drawList();
});
drawList();
+6 -3
View File
@@ -16,8 +16,8 @@ export function uiToolSave(context) {
label: t('save.title')
};
var button = null,
tooltipBehavior = null;
var button = null;
var tooltipBehavior = null;
var history = context.history();
var key = uiCmd('⌘S');
var _numChanges = 0;
@@ -102,8 +102,11 @@ export function uiToolSave(context) {
context.keybinding()
.on(key, save, true);
context.history()
.on('change.save', updateCount);
.on('change.save', function(difference) {
if (difference) updateCount();
});
context
.on('enter.save', function() {
+3 -1
View File
@@ -81,7 +81,9 @@ export function uiToolUndoRedo(context) {
.on('drawn.undo_redo', debouncedUpdate);
context.history()
.on('change.undo_redo', update);
.on('change.undo_redo', function(difference) {
if (difference) update();
});
context
.on('enter.undo_redo', update);