mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00

* Add sveltekit-svg plugin to fix svg icon styling Closes #3127. * Unify svg icon usage Moves all icons into ts/lib/components/icons.ts and uses a single component to render them both with eslint and svelte-kit. * Fix spinning revert icon not being centered * Use svg earth icon for global label * Add tooltip to global label icon * Remove eslint-plugin-simple-import-sort Imports are already sorted by dprint with conflicting rules.
71 lines
2.2 KiB
Svelte
71 lines
2.2 KiB
Svelte
<!--
|
|
Copyright: Ankitects Pty Ltd and contributors
|
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|
-->
|
|
<script lang="ts">
|
|
import * as tr from "@generated/ftl";
|
|
|
|
import ButtonGroup from "$lib/components/ButtonGroup.svelte";
|
|
import ButtonGroupItem, {
|
|
createProps,
|
|
setSlotHostContext,
|
|
updatePropsList,
|
|
} from "$lib/components/ButtonGroupItem.svelte";
|
|
import DynamicallySlottable from "$lib/components/DynamicallySlottable.svelte";
|
|
import Icon from "$lib/components/Icon.svelte";
|
|
import IconButton from "$lib/components/IconButton.svelte";
|
|
import { mdiTableRefresh, mdiViewDashboard } from "$lib/components/icons";
|
|
|
|
import {
|
|
ioImageLoadedStore,
|
|
ioMaskEditorVisible,
|
|
} from "../../routes/image-occlusion/store";
|
|
|
|
export let api = {};
|
|
</script>
|
|
|
|
<ButtonGroup>
|
|
<DynamicallySlottable
|
|
slotHost={ButtonGroupItem}
|
|
{createProps}
|
|
{updatePropsList}
|
|
{setSlotHostContext}
|
|
{api}
|
|
>
|
|
<ButtonGroupItem>
|
|
<IconButton
|
|
id="io-mask-btn"
|
|
class={$ioMaskEditorVisible ? "active-io-btn" : ""}
|
|
on:click={() => {
|
|
$ioMaskEditorVisible = !$ioMaskEditorVisible;
|
|
}}
|
|
tooltip={tr.editingImageOcclusionToggleMaskEditor()}
|
|
>
|
|
<Icon icon={mdiViewDashboard} />
|
|
</IconButton>
|
|
</ButtonGroupItem>
|
|
<ButtonGroupItem>
|
|
<IconButton
|
|
id="io-reset-btn"
|
|
disabled={!$ioImageLoadedStore}
|
|
on:click={() => {
|
|
if (confirm(tr.editingImageOcclusionConfirmReset())) {
|
|
globalThis.resetIOImageLoaded();
|
|
} else {
|
|
return;
|
|
}
|
|
}}
|
|
tooltip={tr.editingImageOcclusionReset()}
|
|
>
|
|
<Icon icon={mdiTableRefresh} />
|
|
</IconButton>
|
|
</ButtonGroupItem>
|
|
</DynamicallySlottable>
|
|
</ButtonGroup>
|
|
|
|
<style>
|
|
:global(.active-io-btn) {
|
|
background: var(--button-primary-bg) !important;
|
|
color: white !important;
|
|
}
|
|
</style>
|