fix interactiveSeg offset
This commit is contained in:
parent
f5247c89b2
commit
934289c476
@ -1060,11 +1060,13 @@ export default function Editor() {
|
|||||||
const onCanvasMouseUp = (ev: SyntheticEvent) => {
|
const onCanvasMouseUp = (ev: SyntheticEvent) => {
|
||||||
if (isInteractiveSeg) {
|
if (isInteractiveSeg) {
|
||||||
const xy = mouseXY(ev)
|
const xy = mouseXY(ev)
|
||||||
|
const isX = xy.x
|
||||||
|
const isY = xy.y
|
||||||
const newClicks: number[][] = [...clicks]
|
const newClicks: number[][] = [...clicks]
|
||||||
if (isRightClick(ev)) {
|
if (isRightClick(ev)) {
|
||||||
newClicks.push([xy.x, xy.y, 0, newClicks.length])
|
newClicks.push([isX, isY, 0, newClicks.length])
|
||||||
} else {
|
} else {
|
||||||
newClicks.push([xy.x, xy.y, 1, newClicks.length])
|
newClicks.push([isX, isY, 1, newClicks.length])
|
||||||
}
|
}
|
||||||
runInteractiveSeg(newClicks)
|
runInteractiveSeg(newClicks)
|
||||||
setClicks(newClicks)
|
setClicks(newClicks)
|
||||||
@ -1525,7 +1527,7 @@ export default function Editor() {
|
|||||||
style={{
|
style={{
|
||||||
left: `${x}px`,
|
left: `${x}px`,
|
||||||
top: `${y}px`,
|
top: `${y}px`,
|
||||||
// transform: 'translate(-50%, -50%)',
|
transform: 'translate(-50%, -50%)',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<CursorArrowRaysIcon />
|
<CursorArrowRaysIcon />
|
||||||
|
@ -12,7 +12,16 @@ interface ItemProps {
|
|||||||
const Item = (props: ItemProps) => {
|
const Item = (props: ItemProps) => {
|
||||||
const { x, y, positive } = props
|
const { x, y, positive } = props
|
||||||
const name = positive ? 'click-item-positive' : 'click-item-negative'
|
const name = positive ? 'click-item-positive' : 'click-item-negative'
|
||||||
return <div className={`click-item ${name}`} style={{ left: x, top: y }} />
|
return (
|
||||||
|
<div
|
||||||
|
className={`click-item ${name}`}
|
||||||
|
style={{
|
||||||
|
left: x,
|
||||||
|
top: y,
|
||||||
|
transform: 'translate(-50%, -50%)',
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
const InteractiveSeg = () => {
|
const InteractiveSeg = () => {
|
||||||
|
Loading…
Reference in New Issue
Block a user