anki/ts/editor/image-overlay/SizeSelect.svelte
Henrik Giesel bf20353b53
Add tooltip that you can double-click image for restoring its size (#1738)
* Add tooltip that you can double-click image for restoring its size

* Update ftl/core/editing.ftl

Lower case label
2022-03-24 19:53:57 +10:00

32 lines
1007 B
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 { getContext } from "svelte";
import type { Readable } from "svelte/store";
import ButtonGroup from "../../components/ButtonGroup.svelte";
import IconButton from "../../components/IconButton.svelte";
import { directionKey } from "../../lib/context-keys";
import * as tr from "../../lib/ftl";
import { sizeActual, sizeMinimized } from "./icons";
export let active: boolean;
$: icon = active ? sizeActual : sizeMinimized;
const direction = getContext<Readable<"ltr" | "rtl">>(directionKey);
</script>
<ButtonGroup size={1.6}>
<IconButton
{active}
flipX={$direction === "rtl"}
tooltip="{tr.editingActualSize()} ({tr.editingDoubleClickImage()})"
on:click
--border-left-radius="5px"
--border-right-radius="5px">{@html icon}</IconButton
>
</ButtonGroup>