|
|
@ -13,7 +13,6 @@ import { BasketCourt } from "../components/editor/BasketCourt"
|
|
|
|
import plainCourt from "../assets/court/full_court.svg"
|
|
|
|
import plainCourt from "../assets/court/full_court.svg"
|
|
|
|
import halfCourt from "../assets/court/half_court.svg"
|
|
|
|
import halfCourt from "../assets/court/half_court.svg"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import { BallPiece } from "../components/editor/BallPiece"
|
|
|
|
import { BallPiece } from "../components/editor/BallPiece"
|
|
|
|
|
|
|
|
|
|
|
|
import { Rack } from "../components/Rack"
|
|
|
|
import { Rack } from "../components/Rack"
|
|
|
@ -30,8 +29,7 @@ import SavingState, {
|
|
|
|
SaveStates,
|
|
|
|
SaveStates,
|
|
|
|
} from "../components/editor/SavingState"
|
|
|
|
} from "../components/editor/SavingState"
|
|
|
|
|
|
|
|
|
|
|
|
import {CourtObject} from "../tactic/CourtObjects";
|
|
|
|
import { CourtObject } from "../tactic/CourtObjects"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const ERROR_STYLE: CSSProperties = {
|
|
|
|
const ERROR_STYLE: CSSProperties = {
|
|
|
|
borderColor: "red",
|
|
|
|
borderColor: "red",
|
|
|
@ -64,14 +62,7 @@ interface RackedPlayer {
|
|
|
|
|
|
|
|
|
|
|
|
type RackedCourtObject = { key: "ball" }
|
|
|
|
type RackedCourtObject = { key: "ball" }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export default function Editor({ id, name, courtType, content }: EditorProps) {
|
|
|
|
export default function Editor({
|
|
|
|
|
|
|
|
id,
|
|
|
|
|
|
|
|
name,
|
|
|
|
|
|
|
|
courtType,
|
|
|
|
|
|
|
|
content,
|
|
|
|
|
|
|
|
}: EditorProps) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const isInGuestMode = id == -1
|
|
|
|
const isInGuestMode = id == -1
|
|
|
|
|
|
|
|
|
|
|
|
const storage_content = localStorage.getItem(GUEST_MODE_CONTENT_STORAGE_KEY)
|
|
|
|
const storage_content = localStorage.getItem(GUEST_MODE_CONTENT_STORAGE_KEY)
|
|
|
@ -143,7 +134,6 @@ function EditorView({
|
|
|
|
|
|
|
|
|
|
|
|
const courtDivContentRef = useRef<HTMLDivElement>(null)
|
|
|
|
const courtDivContentRef = useRef<HTMLDivElement>(null)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const isBoundsOnCourt = (bounds: DOMRect) => {
|
|
|
|
const isBoundsOnCourt = (bounds: DOMRect) => {
|
|
|
|
const courtBounds = courtDivContentRef.current!.getBoundingClientRect()
|
|
|
|
const courtBounds = courtDivContentRef.current!.getBoundingClientRect()
|
|
|
|
|
|
|
|
|
|
|
@ -209,13 +199,13 @@ function EditorView({
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
return
|
|
|
|
return
|
|
|
|
} else {
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
courtObject = {
|
|
|
|
courtObject = {
|
|
|
|
type: "ball",
|
|
|
|
type: "ball",
|
|
|
|
rightRatio: x,
|
|
|
|
rightRatio: x,
|
|
|
|
bottomRatio: y,
|
|
|
|
bottomRatio: y,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break
|
|
|
|
break
|
|
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
default:
|
|
|
@ -359,9 +349,7 @@ function EditorView({
|
|
|
|
<div id="main-div">
|
|
|
|
<div id="main-div">
|
|
|
|
<div id="topbar-div">
|
|
|
|
<div id="topbar-div">
|
|
|
|
<div id="topbar-left">
|
|
|
|
<div id="topbar-left">
|
|
|
|
|
|
|
|
|
|
|
|
<SavingState state={saveState} />
|
|
|
|
<SavingState state={saveState} />
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div id="title-input-div">
|
|
|
|
<div id="title-input-div">
|
|
|
|
<TitleInput
|
|
|
|
<TitleInput
|
|
|
|