Skip to content

Commit b491cfc

Browse files
Desktop: Fix the Text tool not working with the hole punch (#3012)
* Make viewport element transparent when hole punch is enabled Instead of removing the viewport element completely we make it transparent Allows the text tool to work * Fix formatting
1 parent 5d17f5d commit b491cfc

File tree

1 file changed

+22
-9
lines changed

1 file changed

+22
-9
lines changed

frontend/src/components/panels/Document.svelte

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -533,16 +533,24 @@
533533
y={cursorTop}
534534
/>
535535
{/if}
536-
{#if !$appWindow.viewportHolePunch}
537-
<div class="viewport" on:pointerdown={(e) => canvasPointerDown(e)} bind:this={viewport} data-viewport>
536+
<div
537+
class:viewport={!$appWindow.viewportHolePunch}
538+
class:viewport-transparent={$appWindow.viewportHolePunch}
539+
on:pointerdown={(e) => canvasPointerDown(e)}
540+
bind:this={viewport}
541+
data-viewport
542+
>
543+
{#if !$appWindow.viewportHolePunch}
538544
<svg class="artboards" style:width={canvasWidthCSS} style:height={canvasHeightCSS}>
539545
{@html artworkSvg}
540546
</svg>
541-
<div class="text-input" style:width={canvasWidthCSS} style:height={canvasHeightCSS} style:pointer-events={showTextInput ? "auto" : ""}>
542-
{#if showTextInput}
543-
<div bind:this={textInput} style:transform="matrix({textInputMatrix})" on:scroll={preventTextEditingScroll} />
544-
{/if}
545-
</div>
547+
{/if}
548+
<div class="text-input" style:width={canvasWidthCSS} style:height={canvasHeightCSS} style:pointer-events={showTextInput ? "auto" : ""}>
549+
{#if showTextInput}
550+
<div bind:this={textInput} style:transform="matrix({textInputMatrix})" on:scroll={preventTextEditingScroll} />
551+
{/if}
552+
</div>
553+
{#if !$appWindow.viewportHolePunch}
546554
<canvas
547555
class="overlays"
548556
width={canvasWidthScaledRoundedToEven}
@@ -552,8 +560,9 @@
552560
data-overlays-canvas
553561
>
554562
</canvas>
555-
</div>
556-
{/if}
563+
{/if}
564+
</div>
565+
557566
<div class="graph-view" class:open={$document.graphViewOverlayOpen} style:--fade-artwork={`${$document.fadeArtwork}%`} data-graph>
558567
<Graph />
559568
</div>
@@ -757,6 +766,10 @@
757766
758767
.viewport {
759768
background: var(--color-2-mildblack);
769+
}
770+
771+
.viewport,
772+
.viewport-transparent {
760773
width: 100%;
761774
height: 100%;
762775
// Allows the SVG to be placed at explicit integer values of width and height to prevent non-pixel-perfect SVG scaling

0 commit comments

Comments
 (0)