mirror of
https://github.com/ankitects/anki.git
synced 2025-09-21 15:32:23 -04:00
show saved custom colours as possible options in colour picker
this is primarily for mobile clients, as qt currently ignores this
This commit is contained in:
parent
7b347cf5ac
commit
42afefb3e3
1 changed files with 16 additions and 1 deletions
|
@ -55,6 +55,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||
onWheelDragX,
|
||||
} from "./tools/tool-zoom";
|
||||
import { fillMask } from "./tools/tool-fill";
|
||||
import { getCustomColours } from "@generated/backend";
|
||||
|
||||
export let canvas;
|
||||
export let iconSize;
|
||||
|
@ -76,6 +77,16 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||
let colourRef: HTMLInputElement | undefined;
|
||||
const colour = writable(SHAPE_MASK_COLOR);
|
||||
|
||||
const customColorPickerPalette = writable<string[]>([]);
|
||||
|
||||
async function loadCustomColours() {
|
||||
customColorPickerPalette.set(
|
||||
(await getCustomColours({})).colours.filter(
|
||||
(hex) => !hex.startsWith("#ffffff"),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
function onClick(event: MouseEvent) {
|
||||
const upperCanvas = document.querySelector(".upper-canvas");
|
||||
if (event.target == upperCanvas) {
|
||||
|
@ -233,6 +244,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||
on(document, "touchstart", onTouchstart),
|
||||
on(document, "mousemove", onMousemoveDocument),
|
||||
);
|
||||
loadCustomColours();
|
||||
});
|
||||
|
||||
onDestroy(() => {
|
||||
|
@ -241,7 +253,10 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||
</script>
|
||||
|
||||
<datalist id="colour-palette">
|
||||
<option value={SHAPE_MASK_COLOR}></option>
|
||||
<option>{SHAPE_MASK_COLOR}</option>
|
||||
{#each $customColorPickerPalette as colour}
|
||||
<option>{colour}</option>
|
||||
{/each}
|
||||
</datalist>
|
||||
|
||||
<input
|
||||
|
|
Loading…
Reference in a new issue