diff --git a/src/components/ColorScatterPlot.svelte b/src/components/ColorScatterPlot.svelte index 855d5585..2ff153de 100644 --- a/src/components/ColorScatterPlot.svelte +++ b/src/components/ColorScatterPlot.svelte @@ -248,7 +248,7 @@ } } - let CircleProps = (color: Color) => ({ + let CircleProps = (color: Color, i: number) => ({ cx: x(color), cy: y(color), r: 10, @@ -289,6 +289,12 @@ function selectionStart() {} function selectionUpdate() {} function selectionEnd() {} + const clickPoint = (i: number) => (e: any) => { + const isMeta = e.metaKey || e.shiftKey; + const newElements = isMeta ? toggleElement(focusedColors, i) : [i]; + + onFocusedColorsChange(newElements); + }; @@ -300,14 +306,7 @@
- + {#if config.isPolar} @@ -318,12 +317,6 @@ {#if scatterPlotMode === "moving"} startDrag(true, i)(e)} - on:touchstart|preventDefault={startDrag(true, i)} - on:touchend|preventDefault={() => onFocusedColorsChange([i])} - on:mouseenter={() => hoverPoint(color)} - pointer-events={!focusSet.has(i) ? "all" : "none"} + {...CircleProps(color, i)} r={10 + (focusSet.has(i) ? 5 : 0)} - stroke={focusedColors.length === 1 && - focusedColors[0] === i && - dragging - ? axisColor - : color.toDisplay()} - on:click={(e) => clickResponse(e, i)} + on:click={clickPoint(i)} /> {/if} {#if scatterPlotMode === "looking"} hoverPoint(color)} /> {/if} @@ -388,16 +371,11 @@ {#each blindColors as blindColor, i} onFocusedColorsChange([i])} - pointer-events={!focusSet.has(i) ? "all" : "none"} - on:click={(e) => clickResponse(e, i)} /> {/each}