hold space to pan
This commit is contained in:
parent
e26fddd936
commit
c81fc0ecfc
@ -25,6 +25,7 @@ function App() {
|
|||||||
<></>
|
<></>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
{file ? (
|
||||||
<Button
|
<Button
|
||||||
icon={
|
icon={
|
||||||
<svg
|
<svg
|
||||||
@ -50,10 +51,10 @@ function App() {
|
|||||||
</g>
|
</g>
|
||||||
</svg>
|
</svg>
|
||||||
}
|
}
|
||||||
onClick={() => {
|
|
||||||
setFile(undefined)
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
|
) : (
|
||||||
|
<></>
|
||||||
|
)}
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<main
|
<main
|
||||||
|
@ -266,7 +266,13 @@ export default function Editor(props: EditorProps) {
|
|||||||
{
|
{
|
||||||
event: 'keydown',
|
event: 'keydown',
|
||||||
},
|
},
|
||||||
[isDraging, isMultiStrokeKeyPressed]
|
[
|
||||||
|
isDraging,
|
||||||
|
isInpaintingLoading,
|
||||||
|
isMultiStrokeKeyPressed,
|
||||||
|
resetZoom,
|
||||||
|
clearDrawing,
|
||||||
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
const onPaint = (px: number, py: number) => {
|
const onPaint = (px: number, py: number) => {
|
||||||
@ -439,18 +445,20 @@ export default function Editor(props: EditorProps) {
|
|||||||
}, [showBrush, isPanning])
|
}, [showBrush, isPanning])
|
||||||
|
|
||||||
// Toggle clean/zoom tool on spacebar.
|
// Toggle clean/zoom tool on spacebar.
|
||||||
useKey(
|
useKeyPressEvent(
|
||||||
' ',
|
' ',
|
||||||
ev => {
|
ev => {
|
||||||
ev?.preventDefault()
|
ev?.preventDefault()
|
||||||
ev?.stopPropagation()
|
ev?.stopPropagation()
|
||||||
setShowBrush(!showBrush)
|
setShowBrush(false)
|
||||||
setIsPanning(!isPanning)
|
setIsPanning(true)
|
||||||
},
|
},
|
||||||
{
|
ev => {
|
||||||
event: 'keydown',
|
ev?.preventDefault()
|
||||||
},
|
ev?.stopPropagation()
|
||||||
[isPanning, showBrush]
|
setShowBrush(true)
|
||||||
|
setIsPanning(false)
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
if (!original || !scale || !minScale) {
|
if (!original || !scale || !minScale) {
|
||||||
|
Loading…
Reference in New Issue
Block a user