color picker behavior update

This commit is contained in:
Azgaar 2021-05-05 01:36:23 +03:00 committed by Peter
parent 295344b56d
commit 000d9ca2a2
3 changed files with 27 additions and 10 deletions

View file

@ -469,7 +469,8 @@ function clearLegend() {
}
// draw color (fill) picker
function createPicker() {
function createPicker(hatching) {
const COLORS_IN_ROW = 14;
const pos = () => tip("Drag to change the picker position");
const cl = () => tip("Click to close the picker");
const closePicker = () => container.style("display", "none");
@ -672,10 +673,8 @@ function updatePickerColors() {
});
}
function openPicker(fill, callback) {
const picker = d3.select("#picker");
if (!picker.size()) createPicker();
d3.select("#pickerContainer").style("display", "block");
function openPicker(fill, callback, options = {allowHatching: true}) {
createPicker(options.allowHatching);
if (fill[0] === "#") {
const hsl = d3.hsl(fill);