prevent right click on canvas work
This commit is contained in:
parent
3580d4281f
commit
390933f0eb
@ -21,7 +21,7 @@ import inpaint from '../../adapters/inpainting'
|
|||||||
import Button from '../shared/Button'
|
import Button from '../shared/Button'
|
||||||
import Slider from './Slider'
|
import Slider from './Slider'
|
||||||
import SizeSelector from './SizeSelector'
|
import SizeSelector from './SizeSelector'
|
||||||
import { downloadImage, loadImage, useImage } from '../../utils'
|
import { downloadImage, isRightClick, loadImage, useImage } from '../../utils'
|
||||||
import { settingState } from '../../store/Atoms'
|
import { settingState } from '../../store/Atoms'
|
||||||
|
|
||||||
const TOOLBAR_SIZE = 200
|
const TOOLBAR_SIZE = 200
|
||||||
@ -385,6 +385,10 @@ export default function Editor(props: EditorProps) {
|
|||||||
if (isInpaintingLoading) {
|
if (isInpaintingLoading) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isRightClick(ev)) {
|
||||||
|
return
|
||||||
|
}
|
||||||
setIsDraging(true)
|
setIsDraging(true)
|
||||||
|
|
||||||
let lineGroup: LineGroup = []
|
let lineGroup: LineGroup = []
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { useEffect, useState } from 'react'
|
import { SyntheticEvent, useEffect, useState } from 'react'
|
||||||
|
|
||||||
export function dataURItoBlob(dataURI: string) {
|
export function dataURItoBlob(dataURI: string) {
|
||||||
const mime = dataURI.split(',')[0].split(':')[1].split(';')[0]
|
const mime = dataURI.split(',')[0].split(':')[1].split(';')[0]
|
||||||
@ -182,3 +182,8 @@ export function keepGUIAlive() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function isRightClick(ev: SyntheticEvent) {
|
||||||
|
const mouseEvent = ev.nativeEvent as MouseEvent
|
||||||
|
return mouseEvent.button === 2
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user