mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-14 01:33:03 +00:00
Update favorite preset button state automatically
This commit is contained in:
@@ -31,24 +31,24 @@ export function uiPresetFavorite(preset, geom, context, klass) {
|
||||
.merge(_button);
|
||||
|
||||
_button
|
||||
.classed('active', function() {
|
||||
return context.isFavoritePreset(preset, geom);
|
||||
})
|
||||
.on('click', function () {
|
||||
d3_event.stopPropagation();
|
||||
d3_event.preventDefault();
|
||||
|
||||
//update state of favorite icon
|
||||
d3_select(this)
|
||||
.classed('active', function() {
|
||||
return !d3_select(this).classed('active');
|
||||
});
|
||||
|
||||
context.favoritePreset(preset, geom);
|
||||
context.favoritePreset(preset, geom);
|
||||
|
||||
update();
|
||||
});
|
||||
|
||||
update();
|
||||
};
|
||||
|
||||
function update() {
|
||||
_button
|
||||
.classed('active', context.isFavoritePreset(preset, geom));
|
||||
}
|
||||
|
||||
context.on('favoritePreset.button-' + preset.id.replace(/[^a-zA-Z\d:]/g, '-') + '-' + geom, update);
|
||||
|
||||
return presetFavorite;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user