Skip to content

Commit 1a0ed4f

Browse files
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
1 parent 96a1b12 commit 1a0ed4f

1 file changed

Lines changed: 15 additions & 9 deletions

File tree

frontend/src/components/panels/Document.svelte

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -533,16 +533,18 @@
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 class:viewport={!$appWindow.viewportHolePunch} class:viewport-transparent={$appWindow.viewportHolePunch} on:pointerdown={(e) => canvasPointerDown(e)} bind:this={viewport} data-viewport>
537+
{#if !$appWindow.viewportHolePunch}
538538
<svg class="artboards" style:width={canvasWidthCSS} style:height={canvasHeightCSS}>
539539
{@html artworkSvg}
540540
</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>
541+
{/if}
542+
<div class="text-input" style:width={canvasWidthCSS} style:height={canvasHeightCSS} style:pointer-events={showTextInput ? "auto" : ""}>
543+
{#if showTextInput}
544+
<div bind:this={textInput} style:transform="matrix({textInputMatrix})" on:scroll={preventTextEditingScroll} />
545+
{/if}
546+
</div>
547+
{#if !$appWindow.viewportHolePunch}
546548
<canvas
547549
class="overlays"
548550
width={canvasWidthScaledRoundedToEven}
@@ -552,8 +554,9 @@
552554
data-overlays-canvas
553555
>
554556
</canvas>
555-
</div>
556-
{/if}
557+
{/if}
558+
</div>
559+
557560
<div class="graph-view" class:open={$document.graphViewOverlayOpen} style:--fade-artwork={`${$document.fadeArtwork}%`} data-graph>
558561
<Graph />
559562
</div>
@@ -757,6 +760,9 @@
757760
758761
.viewport {
759762
background: var(--color-2-mildblack);
763+
}
764+
765+
.viewport, .viewport-transparent {
760766
width: 100%;
761767
height: 100%;
762768
// 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)