Assign ball to a player in the court #40
Merged
maxime.batista
merged 8 commits from editor/ball-assign
into master
1 year ago
After Width: | Height: | Size: 3.7 KiB |
@ -0,0 +1,21 @@
|
|||||||
|
import React, { RefObject } from "react"
|
||||||
|
|
||||||
|
import "../../style/ball.css"
|
||||||
|
|
||||||
|
import Ball from "../../assets/icon/ball.svg?react"
|
||||||
|
import Draggable from "react-draggable"
|
||||||
|
|
||||||
|
export interface BallPieceProps {
|
||||||
|
onDrop: () => void
|
||||||
|
pieceRef: RefObject<HTMLDivElement>
|
||||||
|
}
|
||||||
|
|
||||||
|
export function BallPiece({ onDrop, pieceRef }: BallPieceProps) {
|
||||||
|
return (
|
||||||
|
<Draggable onStop={onDrop} nodeRef={pieceRef} position={{ x: 0, y: 0 }}>
|
||||||
|
<div className={`ball-div`} ref={pieceRef}>
|
||||||
|
<Ball className={"ball"} />
|
||||||
|
</div>
|
||||||
|
</Draggable>
|
||||||
|
)
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
.ball * {
|
||||||
|
fill: #c5520d;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ball-div,
|
||||||
|
.ball {
|
||||||
|
pointer-events: all;
|
||||||
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
:root {
|
||||||
|
--main-color: #ffffff;
|
||||||
|
--second-color: #ccde54;
|
||||||
|
|
||||||
|
--background-color: #d2cdd3;
|
||||||
|
|
||||||
|
--selected-team-primarycolor: #50b63a;
|
||||||
|
--selected-team-secondarycolor: #000000;
|
||||||
|
|
||||||
|
--selection-color: #3f7fc4;
|
||||||
|
|
||||||
|
--player-piece-ball-border-color: #000000;
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
export interface Ball {
|
||||||
|
/**
|
||||||
|
* Percentage of the player's position to the bottom (0 means top, 1 means bottom, 0.5 means middle)
|
||||||
|
*/
|
||||||
|
bottom_percentage: number
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Percentage of the player's position to the right (0 means left, 1 means right, 0.5 means middle)
|
||||||
|
*/
|
||||||
|
right_percentage: number
|
||||||
|
}
|
Loading…
Reference in new issue