Fix Inpainting Canvas Rendering

This commit is contained in:
blessedcoolant 2022-11-11 21:26:35 +13:00
parent 6adebf065f
commit 82a53782d0
2 changed files with 25 additions and 24 deletions

View File

@ -1,7 +1,7 @@
// lib
import { MutableRefObject, useEffect, useRef, useState } from 'react';
import Konva from 'konva';
import { Layer, Stage } from 'react-konva';
import { Group, Layer, Stage } from 'react-konva';
import { Image as KonvaImage } from 'react-konva';
import { Stage as StageType } from 'konva/lib/Stage';
@ -233,30 +233,31 @@ const IAICanvas = () => {
<IAICanvasOutpaintingObjects />
<IAICanvasIntermediateImage />
</Layer>
<Layer id={'mask-layer'} visible={isMaskEnabled} listening={false}>
<IAICanvasMaskLines visible={true} listening={false} />
<Layer id={'mask-layer'} listening={false}>
<IAICanvasMaskLines visible={isMaskEnabled} listening={false} />
<IAICanvasMaskCompositer listening={false} />
<IAICanvasMaskCompositer
listening={false}
globalCompositeOperation="source-in"
/>
{canvasBgImage && (
<>
<KonvaImage
image={canvasBgImage}
listening={false}
globalCompositeOperation="source-in"
visible={shouldInvertMask}
/>
<KonvaImage
image={canvasBgImage}
listening={false}
globalCompositeOperation="source-out"
visible={
!shouldInvertMask && shouldShowCheckboardTransparency
}
/>
</>
)}
<Group globalCompositeOperation="destination-over">
{canvasBgImage && (
<>
<KonvaImage
image={canvasBgImage}
listening={false}
visible={!shouldInvertMask}
/>
<KonvaImage
image={canvasBgImage}
listening={false}
globalCompositeOperation="source-in"
visible={shouldInvertMask}
/>
</>
)}
</Group>
</Layer>
<Layer id={'preview-layer'}>
<IAICanvasBoundingBoxPreview visible={shouldShowBoundingBox} />

View File

@ -39,7 +39,7 @@ const IAICanvasMaskCompositer = (props: IAICanvasMaskCompositerProps) => {
height={stageDimensions.height / stageScale}
width={stageDimensions.width / stageScale}
fill={maskColorString}
globalCompositeOperation={'source-in'}
globalCompositeOperation={'source-over'}
listening={false}
{...rest}
/>