Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Sanster committed Dec 22, 2023
1 parent 141936a commit eb97641
Show file tree
Hide file tree
Showing 20 changed files with 738 additions and 255 deletions.
33 changes: 33 additions & 0 deletions web_app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions web_app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"@radix-ui/react-icons": "^1.3.0",
"@radix-ui/react-label": "^2.0.2",
"@radix-ui/react-popover": "^1.0.7",
"@radix-ui/react-radio-group": "^1.1.3",
"@radix-ui/react-scroll-area": "^1.0.5",
"@radix-ui/react-select": "^2.0.0",
"@radix-ui/react-separator": "^1.0.3",
Expand Down
33 changes: 11 additions & 22 deletions web_app/src/components/Editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import { useStore } from "@/lib/states"
import Cropper from "./Cropper"
import { InteractiveSegPoints } from "./InteractiveSeg"
import useHotKey from "@/hooks/useHotkey"
import Extender from "./Expender"
import Extender from "./Extender"

const TOOLBAR_HEIGHT = 200
const MIN_BRUSH_SIZE = 10
Expand Down Expand Up @@ -221,7 +221,9 @@ export default function Editor(props: EditorProps) {
}

const [width, height] = getCurrentWidthHeight()
setImageSize(width, height)
if (width !== imageWidth || height !== imageHeight) {
setImageSize(width, height)
}

const rW = windowSize.width / width
const rH = (windowSize.height - TOOLBAR_HEIGHT) / height
Expand Down Expand Up @@ -255,6 +257,8 @@ export default function Editor(props: EditorProps) {
}
}, [
viewportRef,
imageHeight,
imageWidth,
original,
isOriginalLoaded,
windowSize,
Expand Down Expand Up @@ -619,19 +623,6 @@ export default function Editor(props: EditorProps) {
}
)

useKeyPressEvent(
"Alt",
(ev) => {
ev?.preventDefault()
ev?.stopPropagation()
// TODO: mouse scroll increase/decrease brush size
},
(ev) => {
ev?.preventDefault()
ev?.stopPropagation()
}
)

const getCurScale = (): number => {
let s = minScale
if (viewportRef.current?.instance?.transformState.scale !== undefined) {
Expand Down Expand Up @@ -782,19 +773,17 @@ export default function Editor(props: EditorProps) {
<Cropper
maxHeight={imageHeight}
maxWidth={imageWidth}
minHeight={Math.min(256, imageHeight)}
minWidth={Math.min(256, imageWidth)}
minHeight={Math.min(512, imageHeight)}
minWidth={Math.min(512, imageWidth)}
scale={getCurScale()}
show={settings.showCropper}
/>

<Extender
maxHeight={imageHeight}
maxWidth={imageWidth}
minHeight={Math.min(256, imageHeight)}
minWidth={Math.min(256, imageWidth)}
minHeight={Math.min(512, imageHeight)}
minWidth={Math.min(512, imageWidth)}
scale={getCurScale()}
show={settings.showExpender}
show={settings.showExtender}
/>

{interactiveSegState.isInteractiveSeg ? (
Expand Down
Loading

0 comments on commit eb97641

Please sign in to comment.