Skip to content

Commit

Permalink
🐛 partially applying gradio-app#3277
Browse files Browse the repository at this point in the history
  • Loading branch information
gitadmin0608 committed Mar 6, 2023
1 parent 3aca614 commit 49d1126
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions ui/packages/image/src/Image.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts">
// @ts-nocheck
import { createEventDispatcher, tick } from "svelte";
import { createEventDispatcher, tick, onMount } from "svelte";
import { BlockLabel } from "@gradio/atoms";
import { Image, Sketch as SketchIcon } from "@gradio/icons";
Expand Down Expand Up @@ -100,7 +100,7 @@
$: dispatch("drag", dragging);
function handle_image_load(event: Event) {
const element = event.composedPath()[0] as HTMLImageElement;
const element = event.currentTarget as HTMLImageElement;
img_width = element.naturalWidth;
img_height = element.naturalHeight;
container_height = element.getBoundingClientRect().height;
Expand Down Expand Up @@ -149,6 +149,15 @@
static_image = undefined;
}
}
onMount(async () => {
if (tool === "color-sketch" && value && typeof value === "string") {
static_image = value;
await tick();
handle_image_load({ currentTarget: value_img });
}
});
</script>

<BlockLabel
Expand Down

0 comments on commit 49d1126

Please sign in to comment.