mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-22 12:01:23 +01:00
color picker behavior update
This commit is contained in:
parent
df1ee1b5a3
commit
d0500f19d6
3 changed files with 24 additions and 7 deletions
|
|
@ -451,6 +451,22 @@ function editResources() {
|
|||
confirmationDialog({title: 'Restore default resources', message, confirm: 'Restore', onConfirm});
|
||||
}
|
||||
|
||||
function resourceChangeColor() {
|
||||
const circle = this.querySelector("circle");
|
||||
const resource = Resources.get(+this.parentNode.dataset.id);
|
||||
|
||||
const callback = function(fill) {
|
||||
const stroke = Resources.getStroke(fill);
|
||||
circle.setAttribute("fill", fill);
|
||||
circle.setAttribute("stroke", stroke);
|
||||
resource.color = fill;
|
||||
resource.stroke = stroke;
|
||||
goods.selectAll(`circle[data-i='${resource.i}']`).attr("fill", fill).attr("stroke", stroke);
|
||||
}
|
||||
|
||||
openPicker(resource.color, callback, {allowHatching: false});
|
||||
}
|
||||
|
||||
function toggleLegend() {
|
||||
if (legend.selectAll('*').size()) {
|
||||
clearLegend();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue