2021-10-18 14:01:15 +02:00
|
|
|
<!--
|
|
|
|
Copyright: Ankitects Pty Ltd and contributors
|
|
|
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|
|
|
-->
|
2021-10-26 00:43:02 +02:00
|
|
|
<script lang="ts">
|
2022-05-13 04:57:07 +02:00
|
|
|
import { createEventDispatcher, getContext } from "svelte";
|
2022-02-04 09:36:34 +01:00
|
|
|
import type { Readable } from "svelte/store";
|
2021-10-18 14:01:15 +02:00
|
|
|
|
|
|
|
import ButtonGroup from "../../components/ButtonGroup.svelte";
|
|
|
|
import IconButton from "../../components/IconButton.svelte";
|
2022-02-04 09:36:34 +01:00
|
|
|
import { directionKey } from "../../lib/context-keys";
|
|
|
|
import * as tr from "../../lib/ftl";
|
2022-05-13 04:57:07 +02:00
|
|
|
import { sizeActual, sizeClear, sizeMinimized } from "./icons";
|
2021-10-18 14:01:15 +02:00
|
|
|
|
2022-05-13 04:57:07 +02:00
|
|
|
export let isSizeConstrained: boolean;
|
|
|
|
export let shrinkingDisabled: boolean;
|
|
|
|
export let restoringDisabled: boolean;
|
2021-10-18 14:01:15 +02:00
|
|
|
|
2022-05-13 04:57:07 +02:00
|
|
|
$: icon = isSizeConstrained ? sizeMinimized : sizeActual;
|
2021-10-18 14:01:15 +02:00
|
|
|
|
|
|
|
const direction = getContext<Readable<"ltr" | "rtl">>(directionKey);
|
2022-05-13 04:57:07 +02:00
|
|
|
const dispatch = createEventDispatcher();
|
2021-10-18 14:01:15 +02:00
|
|
|
</script>
|
|
|
|
|
2022-11-23 07:50:15 +01:00
|
|
|
<ButtonGroup size={1.6}>
|
2022-02-03 05:52:11 +01:00
|
|
|
<IconButton
|
2022-05-13 04:57:07 +02:00
|
|
|
disabled={shrinkingDisabled}
|
2022-02-03 05:52:11 +01:00
|
|
|
flipX={$direction === "rtl"}
|
2022-03-24 10:53:57 +01:00
|
|
|
tooltip="{tr.editingActualSize()} ({tr.editingDoubleClickImage()})"
|
2022-05-13 04:57:07 +02:00
|
|
|
on:click={() => dispatch("imagetoggle")}
|
|
|
|
--border-left-radius="5px">{@html icon}</IconButton
|
|
|
|
>
|
|
|
|
|
|
|
|
<IconButton
|
|
|
|
disabled={restoringDisabled}
|
|
|
|
tooltip={tr.editingRestoreOriginalSize()}
|
|
|
|
on:click={() => dispatch("imageclear")}
|
|
|
|
--border-right-radius="5px">{@html sizeClear}</IconButton
|
2022-02-03 05:52:11 +01:00
|
|
|
>
|
2021-10-18 14:01:15 +02:00
|
|
|
</ButtonGroup>
|