mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
Fixes (?) spacebar issues
This commit is contained in:
parent
c7ef41af54
commit
1114ac97e2
@ -141,8 +141,12 @@ const IAICanvas = () => {
|
|||||||
<div className="inpainting-canvas-container">
|
<div className="inpainting-canvas-container">
|
||||||
<div className="inpainting-canvas-wrapper">
|
<div className="inpainting-canvas-wrapper">
|
||||||
<Stage
|
<Stage
|
||||||
|
tabIndex={-1}
|
||||||
ref={stageRef}
|
ref={stageRef}
|
||||||
style={{ ...(stageCursor ? { cursor: stageCursor } : {}) }}
|
style={{
|
||||||
|
outline: 'none',
|
||||||
|
...(stageCursor ? { cursor: stageCursor } : {}),
|
||||||
|
}}
|
||||||
className="inpainting-canvas-stage checkerboard"
|
className="inpainting-canvas-stage checkerboard"
|
||||||
x={stageCoordinates.x}
|
x={stageCoordinates.x}
|
||||||
y={stageCoordinates.y}
|
y={stageCoordinates.y}
|
||||||
@ -180,26 +184,6 @@ const IAICanvas = () => {
|
|||||||
<Layer id={'mask'} visible={isMaskEnabled} listening={false}>
|
<Layer id={'mask'} visible={isMaskEnabled} listening={false}>
|
||||||
<IAICanvasMaskLines visible={true} listening={false} />
|
<IAICanvasMaskLines visible={true} listening={false} />
|
||||||
<IAICanvasMaskCompositer listening={false} />
|
<IAICanvasMaskCompositer listening={false} />
|
||||||
|
|
||||||
{/* {canvasBgImage && (
|
|
||||||
<>
|
|
||||||
<KonvaImage
|
|
||||||
image={canvasBgImage}
|
|
||||||
listening={false}
|
|
||||||
globalCompositeOperation="source-in"
|
|
||||||
visible={shouldPreserveMaskedArea}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<KonvaImage
|
|
||||||
image={canvasBgImage}
|
|
||||||
listening={false}
|
|
||||||
globalCompositeOperation="source-out"
|
|
||||||
visible={
|
|
||||||
!shouldPreserveMaskedArea && shouldShowCheckboardTransparency
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
</>
|
|
||||||
)} */}
|
|
||||||
</Layer>
|
</Layer>
|
||||||
<Layer id={'tool'}>
|
<Layer id={'tool'}>
|
||||||
<IAICanvasBoundingBox visible={shouldShowBoundingBox} />
|
<IAICanvasBoundingBox visible={shouldShowBoundingBox} />
|
||||||
|
@ -58,6 +58,7 @@ const boundingBoxPreviewSelector = createSelector(
|
|||||||
tool,
|
tool,
|
||||||
stageCoordinates,
|
stageCoordinates,
|
||||||
boundingBoxStrokeWidth: (isMouseOverBoundingBox ? 8 : 1) / stageScale,
|
boundingBoxStrokeWidth: (isMouseOverBoundingBox ? 8 : 1) / stageScale,
|
||||||
|
hitStrokeWidth: 20 / stageScale,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -89,6 +90,7 @@ const IAICanvasBoundingBox = (props: IAICanvasBoundingBoxPreviewProps) => {
|
|||||||
shouldSnapToGrid,
|
shouldSnapToGrid,
|
||||||
tool,
|
tool,
|
||||||
boundingBoxStrokeWidth,
|
boundingBoxStrokeWidth,
|
||||||
|
hitStrokeWidth,
|
||||||
} = useAppSelector(boundingBoxPreviewSelector);
|
} = useAppSelector(boundingBoxPreviewSelector);
|
||||||
|
|
||||||
const transformerRef = useRef<Konva.Transformer>(null);
|
const transformerRef = useRef<Konva.Transformer>(null);
|
||||||
@ -336,7 +338,7 @@ const IAICanvasBoundingBox = (props: IAICanvasBoundingBoxPreviewProps) => {
|
|||||||
}
|
}
|
||||||
listening={!isDrawing && tool === 'move'}
|
listening={!isDrawing && tool === 'move'}
|
||||||
draggable={true}
|
draggable={true}
|
||||||
fillEnabled={tool === 'move'}
|
fillEnabled={false}
|
||||||
height={boundingBoxDimensions.height}
|
height={boundingBoxDimensions.height}
|
||||||
onDragEnd={handleEndedModifying}
|
onDragEnd={handleEndedModifying}
|
||||||
onDragMove={handleOnDragMove}
|
onDragMove={handleOnDragMove}
|
||||||
@ -352,6 +354,7 @@ const IAICanvasBoundingBox = (props: IAICanvasBoundingBoxPreviewProps) => {
|
|||||||
width={boundingBoxDimensions.width}
|
width={boundingBoxDimensions.width}
|
||||||
x={boundingBoxCoordinates.x}
|
x={boundingBoxCoordinates.x}
|
||||||
y={boundingBoxCoordinates.y}
|
y={boundingBoxCoordinates.y}
|
||||||
|
hitStrokeWidth={hitStrokeWidth}
|
||||||
/>
|
/>
|
||||||
<Transformer
|
<Transformer
|
||||||
anchorCornerRadius={3}
|
anchorCornerRadius={3}
|
||||||
|
@ -11,6 +11,7 @@ import {
|
|||||||
import { useAppDispatch, useAppSelector } from 'app/store';
|
import { useAppDispatch, useAppSelector } from 'app/store';
|
||||||
import { currentCanvasSelector } from '../canvasSlice';
|
import { currentCanvasSelector } from '../canvasSlice';
|
||||||
import { useRef } from 'react';
|
import { useRef } from 'react';
|
||||||
|
import { stageRef } from '../IAICanvas';
|
||||||
|
|
||||||
const inpaintingCanvasHotkeysSelector = createSelector(
|
const inpaintingCanvasHotkeysSelector = createSelector(
|
||||||
[currentCanvasSelector, activeTabNameSelector],
|
[currentCanvasSelector, activeTabNameSelector],
|
||||||
@ -52,7 +53,7 @@ const useInpaintingCanvasHotkeys = () => {
|
|||||||
dispatch(toggleShouldLockBoundingBox());
|
dispatch(toggleShouldLockBoundingBox());
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
enabled: true,
|
scopes: ['inpainting', 'outpainting'],
|
||||||
},
|
},
|
||||||
[activeTabName]
|
[activeTabName]
|
||||||
);
|
);
|
||||||
@ -64,7 +65,7 @@ const useInpaintingCanvasHotkeys = () => {
|
|||||||
dispatch(setShouldShowBoundingBox(!shouldShowBoundingBox));
|
dispatch(setShouldShowBoundingBox(!shouldShowBoundingBox));
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
enabled: true,
|
scopes: ['inpainting', 'outpainting'],
|
||||||
},
|
},
|
||||||
[activeTabName, shouldShowBoundingBox]
|
[activeTabName, shouldShowBoundingBox]
|
||||||
);
|
);
|
||||||
@ -74,19 +75,12 @@ const useInpaintingCanvasHotkeys = () => {
|
|||||||
(e: KeyboardEvent) => {
|
(e: KeyboardEvent) => {
|
||||||
if (e.repeat) return;
|
if (e.repeat) return;
|
||||||
|
|
||||||
|
stageRef.current?.container().focus();
|
||||||
|
|
||||||
if (tool !== 'move') {
|
if (tool !== 'move') {
|
||||||
previousToolRef.current = tool;
|
previousToolRef.current = tool;
|
||||||
dispatch(setTool('move'));
|
dispatch(setTool('move'));
|
||||||
}
|
}
|
||||||
},
|
|
||||||
{ keyup: false, keydown: true },
|
|
||||||
[tool, previousToolRef]
|
|
||||||
);
|
|
||||||
|
|
||||||
useHotkeys(
|
|
||||||
['space'],
|
|
||||||
(e: KeyboardEvent) => {
|
|
||||||
if (e.repeat) return;
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
tool === 'move' &&
|
tool === 'move' &&
|
||||||
@ -97,7 +91,11 @@ const useInpaintingCanvasHotkeys = () => {
|
|||||||
previousToolRef.current = 'move';
|
previousToolRef.current = 'move';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ keyup: true, keydown: false },
|
{
|
||||||
|
keyup: true,
|
||||||
|
keydown: true,
|
||||||
|
scopes: ['inpainting', 'outpainting'],
|
||||||
|
},
|
||||||
[tool, previousToolRef]
|
[tool, previousToolRef]
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -32,6 +32,7 @@ const useCanvasMouseDown = (stageRef: MutableRefObject<Konva.Stage | null>) => {
|
|||||||
return useCallback(
|
return useCallback(
|
||||||
(e: KonvaEventObject<MouseEvent>) => {
|
(e: KonvaEventObject<MouseEvent>) => {
|
||||||
if (!stageRef.current) return;
|
if (!stageRef.current) return;
|
||||||
|
stageRef.current.container().focus();
|
||||||
|
|
||||||
if (tool === 'move') {
|
if (tool === 'move') {
|
||||||
dispatch(setIsMovingStage(true));
|
dispatch(setIsMovingStage(true));
|
||||||
|
Loading…
Reference in New Issue
Block a user