Skip to content

Commit f240a5d

Browse files
authored
separate save button accent color, implement flash animation in css (#11292)
1 parent 841c167 commit f240a5d

File tree

3 files changed

+19
-7
lines changed

3 files changed

+19
-7
lines changed

css/80_app.css

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -622,6 +622,9 @@ button.bar-button.dragging.removing {
622622
cursor: url(img/cursor-select-remove.png), pointer;
623623
}
624624

625+
button.save {
626+
background-image: linear-gradient(0, var(--accent-color), var(--accent-color));
627+
}
625628
button.save .count {
626629
display: inline-block;
627630
min-width: 32px;
@@ -1254,6 +1257,14 @@ a.hide-toggle {
12541257
font-style: italic;
12551258
}
12561259

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+
12571268
.preset-list-button .label-inner {
12581269
width: 100%;
12591270
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
}

modules/ui/tools/save.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ export function uiToolSave(context) {
4242
return null;
4343
} else if (numChanges <= 50) {
4444
step = numChanges / 50;
45-
return d3_interpolateRgb('#fff', '#ff8')(step); // white -> yellow
45+
return d3_interpolateRgb('#fff0', '#ff08')(step); // transparent -> yellow
4646
} else {
4747
step = Math.min((numChanges - 50) / 50, 1.0);
48-
return d3_interpolateRgb('#ff8', '#f88')(step); // yellow -> red
48+
return d3_interpolateRgb('#ff08', '#f008')(step); // yellow -> red
4949
}
5050
}
5151

@@ -64,7 +64,7 @@ export function uiToolSave(context) {
6464
if (button) {
6565
button
6666
.classed('disabled', isDisabled())
67-
.style('background', bgColor(_numChanges));
67+
.style('--accent-color', bgColor(_numChanges));
6868

6969
button.select('span.count')
7070
.text(_numChanges);

0 commit comments

Comments
 (0)