colorpicker 추가
This commit is contained in:
parent
76f4ed1cf9
commit
53555c3568
@ -34,6 +34,7 @@
|
|||||||
"postcss": "^8",
|
"postcss": "^8",
|
||||||
"prettier": "^3.3.3",
|
"prettier": "^3.3.3",
|
||||||
"prisma": "^5.18.0",
|
"prisma": "^5.18.0",
|
||||||
|
"react-color-palette": "^7.2.2",
|
||||||
"sass": "^1.77.8",
|
"sass": "^1.77.8",
|
||||||
"tailwindcss": "^3.4.1"
|
"tailwindcss": "^3.4.1"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,6 +4,9 @@ import { useRecoilState, useRecoilValue } from 'recoil'
|
|||||||
import { modalContent, modalState } from '@/store/modalAtom'
|
import { modalContent, modalState } from '@/store/modalAtom'
|
||||||
import { guideLineState } from '@/store/canvasAtom'
|
import { guideLineState } from '@/store/canvasAtom'
|
||||||
import { fabric } from 'fabric'
|
import { fabric } from 'fabric'
|
||||||
|
import { ColorPicker, useColor } from 'react-color-palette'
|
||||||
|
import 'react-color-palette/css'
|
||||||
|
import { withRouter } from 'next/router'
|
||||||
|
|
||||||
export default function SettingsModal(props) {
|
export default function SettingsModal(props) {
|
||||||
const { canvasProps } = props
|
const { canvasProps } = props
|
||||||
@ -19,6 +22,15 @@ export default function SettingsModal(props) {
|
|||||||
|
|
||||||
const gridSettingArray = []
|
const gridSettingArray = []
|
||||||
|
|
||||||
|
const [guideColor, setGuideColor] = useColor('rgb(200, 15, 15)')
|
||||||
|
const [colorPickerShow, setColorPickerShow] = useState(false)
|
||||||
|
|
||||||
|
const boxStyle = {
|
||||||
|
width: '50px',
|
||||||
|
height: '30px',
|
||||||
|
border: '1px solid black',
|
||||||
|
backgroundColor: guideColor.hex,
|
||||||
|
}
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
moduleLength.current.value = 90
|
moduleLength.current.value = 90
|
||||||
customModuleHoriLength.current.value = 90
|
customModuleHoriLength.current.value = 90
|
||||||
@ -54,7 +66,7 @@ export default function SettingsModal(props) {
|
|||||||
const horizontalLine = new fabric.Line(
|
const horizontalLine = new fabric.Line(
|
||||||
[0, i * moduleVertLength - moduleVertLength / 2, canvasProps.width, i * moduleVertLength - moduleVertLength / 2],
|
[0, i * moduleVertLength - moduleVertLength / 2, canvasProps.width, i * moduleVertLength - moduleVertLength / 2],
|
||||||
{
|
{
|
||||||
stroke: 'gray',
|
stroke: guideColor.hex,
|
||||||
strokeWidth: 1,
|
strokeWidth: 1,
|
||||||
selectable: true,
|
selectable: true,
|
||||||
lockMovementX: true,
|
lockMovementX: true,
|
||||||
@ -63,6 +75,8 @@ export default function SettingsModal(props) {
|
|||||||
lockScalingX: true,
|
lockScalingX: true,
|
||||||
lockScalingY: true,
|
lockScalingY: true,
|
||||||
name: 'guideLine',
|
name: 'guideLine',
|
||||||
|
strokeDashArray: [5, 2],
|
||||||
|
opacity: 0.3,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
canvasProps.add(horizontalLine)
|
canvasProps.add(horizontalLine)
|
||||||
@ -73,7 +87,7 @@ export default function SettingsModal(props) {
|
|||||||
const verticalLine = new fabric.Line(
|
const verticalLine = new fabric.Line(
|
||||||
[i * moduleHoriLength - moduleHoriLength / 2, 0, i * moduleHoriLength - moduleHoriLength / 2, canvasProps.height],
|
[i * moduleHoriLength - moduleHoriLength / 2, 0, i * moduleHoriLength - moduleHoriLength / 2, canvasProps.height],
|
||||||
{
|
{
|
||||||
stroke: 'gray',
|
stroke: guideColor.hex,
|
||||||
strokeWidth: 1,
|
strokeWidth: 1,
|
||||||
selectable: true,
|
selectable: true,
|
||||||
lockMovementX: true,
|
lockMovementX: true,
|
||||||
@ -82,6 +96,8 @@ export default function SettingsModal(props) {
|
|||||||
lockScalingX: true,
|
lockScalingX: true,
|
||||||
lockScalingY: true,
|
lockScalingY: true,
|
||||||
name: 'guideLine',
|
name: 'guideLine',
|
||||||
|
strokeDashArray: [5, 2],
|
||||||
|
opacity: 0.3,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
canvasProps.add(verticalLine)
|
canvasProps.add(verticalLine)
|
||||||
@ -104,7 +120,9 @@ export default function SettingsModal(props) {
|
|||||||
if (gridCheckedValue.includes('dot')) {
|
if (gridCheckedValue.includes('dot')) {
|
||||||
const circle = new fabric.Circle({
|
const circle = new fabric.Circle({
|
||||||
radius: 2,
|
radius: 2,
|
||||||
fill: 'red',
|
fill: 'white',
|
||||||
|
stroke: guideColor.hex,
|
||||||
|
strokeWidth: 0.7,
|
||||||
originX: 'center',
|
originX: 'center',
|
||||||
originY: 'center',
|
originY: 'center',
|
||||||
selectable: false,
|
selectable: false,
|
||||||
@ -200,10 +218,18 @@ export default function SettingsModal(props) {
|
|||||||
<Radio value="custom">임의간격</Radio>
|
<Radio value="custom">임의간격</Radio>
|
||||||
</RadioGroup>
|
</RadioGroup>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex w-full flex-wrap md:flex-nowrap gap-4"></div>
|
<div className="flex w-full flex-wrap md:flex-nowrap gap-4">
|
||||||
<Checkbox value="linked" isDisabled={isCustomGridSetting}>
|
가이드컬러 <div style={boxStyle} onClick={() => setColorPickerShow(!colorPickerShow)}></div>
|
||||||
종횡연동
|
</div>
|
||||||
</Checkbox>
|
{colorPickerShow && (
|
||||||
|
<ColorPicker color={guideColor} onChange={setGuideColor} hideInput={['hsv', 'rgb', 'hex']} height={100} hideAlpha={true} />
|
||||||
|
)}
|
||||||
|
|
||||||
|
<div className="flex w-full flex-wrap md:flex-nowrap gap-4">
|
||||||
|
<Checkbox value="linked" isDisabled={isCustomGridSetting}>
|
||||||
|
종횡연동
|
||||||
|
</Checkbox>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex w-full flex-wrap md:flex-nowrap gap-4">
|
<div className="flex w-full flex-wrap md:flex-nowrap gap-4">
|
||||||
<Input type="number" label="가로간격" ref={customModuleHoriLength} min={0} isDisabled={isCustomGridSetting} />
|
<Input type="number" label="가로간격" ref={customModuleHoriLength} min={0} isDisabled={isCustomGridSetting} />
|
||||||
@ -213,6 +239,7 @@ export default function SettingsModal(props) {
|
|||||||
<Input type="number" label="세로간격" ref={customModuleVertLength} min={0} isDisabled={isCustomGridSetting} />
|
<Input type="number" label="세로간격" ref={customModuleVertLength} min={0} isDisabled={isCustomGridSetting} />
|
||||||
mm
|
mm
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex gap-4 items-center">
|
<div className="flex gap-4 items-center">
|
||||||
<Button size="sm">초기화</Button>
|
<Button size="sm">초기화</Button>
|
||||||
<Button size="sm" color="secondary" onClick={drawGridSettings} isDisabled={gridCheckedValue.length === 0}>
|
<Button size="sm" color="secondary" onClick={drawGridSettings} isDisabled={gridCheckedValue.length === 0}>
|
||||||
|
|||||||
@ -19,7 +19,7 @@ function ThumbnailList(props) {
|
|||||||
<div className="flex justify-center m-4 w-full">
|
<div className="flex justify-center m-4 w-full">
|
||||||
{thumbnails.length > 0 &&
|
{thumbnails.length > 0 &&
|
||||||
thumbnails.map((thumbnail, index) => (
|
thumbnails.map((thumbnail, index) => (
|
||||||
<Card isFooterBlurred radius="lg" className="border-none m-2">
|
<Card isFooterBlurred radius="lg" key={index} className="border-none m-2">
|
||||||
<Image
|
<Image
|
||||||
alt="Woman listing to music"
|
alt="Woman listing to music"
|
||||||
className="object-cover"
|
className="object-cover"
|
||||||
|
|||||||
@ -5465,6 +5465,11 @@ rbush@^3.0.1:
|
|||||||
dependencies:
|
dependencies:
|
||||||
quickselect "^2.0.0"
|
quickselect "^2.0.0"
|
||||||
|
|
||||||
|
react-color-palette@^7.2.2:
|
||||||
|
version "7.2.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/react-color-palette/-/react-color-palette-7.2.2.tgz#84d209a425887dce9955466682db353144ab1bb1"
|
||||||
|
integrity sha512-SHLPS3JO+xECRtWB14dAgUPranQMDiGWqn2QVPppAzqWhbUtsg2uVTUd3cpiK3OEa66j7xIDGa/RPjCw98D61g==
|
||||||
|
|
||||||
react-datepicker@^7.3.0:
|
react-datepicker@^7.3.0:
|
||||||
version "7.3.0"
|
version "7.3.0"
|
||||||
resolved "https://registry.npmjs.org/react-datepicker/-/react-datepicker-7.3.0.tgz"
|
resolved "https://registry.npmjs.org/react-datepicker/-/react-datepicker-7.3.0.tgz"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user