mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
Bind to style properties instead of events
This commit is contained in:
parent
8429d00081
commit
b3c921b86c
2 changed files with 28 additions and 31 deletions
|
@ -89,6 +89,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
const nightMode = getContext(nightModeKey);
|
const nightMode = getContext(nightModeKey);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
{#if image}
|
||||||
<div
|
<div
|
||||||
style="--top: {top}px; --left: {left}px; --width: {width}px; --height: {height}px;"
|
style="--top: {top}px; --left: {left}px; --width: {width}px; --height: {height}px;"
|
||||||
class="image-handle-selection"
|
class="image-handle-selection"
|
||||||
|
@ -96,11 +97,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
>
|
>
|
||||||
<div class="image-handle-bg" />
|
<div class="image-handle-bg" />
|
||||||
<div class="image-handle-buttons">
|
<div class="image-handle-buttons">
|
||||||
<ImageHandleButtons
|
<ImageHandleButtons bind:float={image.style.float} />
|
||||||
on:floatleft={floatLeft}
|
|
||||||
on:floatright={floatRight}
|
|
||||||
on:floatreset={floatReset}
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="image-handle-dimensions">
|
<div class="image-handle-dimensions">
|
||||||
{width}×{height} (Original: {naturalWidth}×{naturalHeight})
|
{width}×{height} (Original: {naturalWidth}×{naturalHeight})
|
||||||
|
@ -115,6 +112,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
on:pointermove={resize}
|
on:pointermove={resize}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
{/if}
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
div {
|
div {
|
||||||
|
|
|
@ -3,8 +3,6 @@ Copyright: Ankitects Pty Ltd and contributors
|
||||||
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
-->
|
-->
|
||||||
<script lang="typescript">
|
<script lang="typescript">
|
||||||
import { createEventDispatcher } from "svelte";
|
|
||||||
|
|
||||||
import ButtonToolbar from "components/ButtonToolbar.svelte";
|
import ButtonToolbar from "components/ButtonToolbar.svelte";
|
||||||
import ButtonGroup from "components/ButtonGroup.svelte";
|
import ButtonGroup from "components/ButtonGroup.svelte";
|
||||||
import ButtonGroupItem from "components/ButtonGroupItem.svelte";
|
import ButtonGroupItem from "components/ButtonGroupItem.svelte";
|
||||||
|
@ -12,26 +10,27 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
import { floatLeftIcon, floatRightIcon, resetIcon } from "./icons";
|
import { floatLeftIcon, floatRightIcon, resetIcon } from "./icons";
|
||||||
|
|
||||||
const dispatch = createEventDispatcher();
|
export let float: string;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<ButtonToolbar size={1.6} wrap={false}>
|
<ButtonToolbar size={1.6} wrap={false}>
|
||||||
<ButtonGroup>
|
<ButtonGroup>
|
||||||
<ButtonGroupItem>
|
<ButtonGroupItem>
|
||||||
<IconButton on:click={() => dispatch("floatleft")}
|
<IconButton active={float === "left"} on:click={() => (float = "left")}
|
||||||
>{@html floatLeftIcon}</IconButton
|
>{@html floatLeftIcon}</IconButton
|
||||||
>
|
>
|
||||||
</ButtonGroupItem>
|
</ButtonGroupItem>
|
||||||
|
|
||||||
<ButtonGroupItem>
|
<ButtonGroupItem>
|
||||||
<IconButton on:click={() => dispatch("floatright")}
|
<IconButton active={float === "right"} on:click={() => (float = "right")}
|
||||||
>{@html floatRightIcon}</IconButton
|
>{@html floatRightIcon}</IconButton
|
||||||
>
|
>
|
||||||
</ButtonGroupItem>
|
</ButtonGroupItem>
|
||||||
|
|
||||||
<ButtonGroupItem>
|
<ButtonGroupItem>
|
||||||
<IconButton on:click={() => dispatch("floatreset")}
|
<IconButton
|
||||||
>{@html resetIcon}</IconButton
|
active={float === "" || float === "none"}
|
||||||
|
on:click={() => (float = "")}>{@html resetIcon}</IconButton
|
||||||
>
|
>
|
||||||
</ButtonGroupItem>
|
</ButtonGroupItem>
|
||||||
</ButtonGroup>
|
</ButtonGroup>
|
||||||
|
|
Loading…
Reference in a new issue