Skip to content

Commit 7fa314b

Browse files
committed
Move preset change flash to CSS
1 parent 8ecf061 commit 7fa314b

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

css/80_app.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1257,6 +1257,14 @@ a.hide-toggle {
12571257
font-style: italic;
12581258
}
12591259

1260+
button.preset-reset .label.flash-bg {
1261+
animation: flash-bg 750ms;
1262+
}
1263+
@keyframes flash-bg {
1264+
0% { background-color: #fff; }
1265+
100% { background-color: #f6f6f6; }
1266+
}
1267+
12601268
.preset-list-button .label-inner {
12611269
width: 100%;
12621270
line-height: 1.35em;

modules/ui/entity_editor.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { dispatch as d3_dispatch } from 'd3-dispatch';
2+
import { select as d3_select } from 'd3-selection';
23
import deepEqual from 'fast-deep-equal';
34

45
import { presetManager } from '../presets';
@@ -142,10 +143,10 @@ export function uiEntityEditor(context) {
142143
if (priorActivePreset && _activePresets.length === 1 && priorActivePreset !== _activePresets[0]) {
143144
// flash the button to indicate the preset changed
144145
context.container().selectAll('.entity-editor button.preset-reset .label')
145-
.style('background-color', '#fff')
146-
.transition()
147-
.duration(750)
148-
.style('background-color', null);
146+
.classed('flash-bg', true)
147+
.on('animationend', function() {
148+
d3_select(this).classed('flash-bg', false);
149+
});
149150
}
150151
}
151152
}

0 commit comments

Comments
 (0)