오브젝트 배치 피치 추가

This commit is contained in:
yjnoh 2024-10-23 09:21:22 +09:00
parent 0ce703a392
commit bbd0e365be
4 changed files with 20 additions and 5 deletions

View File

@ -307,15 +307,21 @@ export default function CanvasMenu(props) {
// const angle = calculateAngle({ x: p1CenterX, y: p1CenterY }, { x: p2CenterX, y: p2CenterY })
//
const arrow1 = createArrow(p1CenterX + 7.5, p1CenterY + 1, lineDirection === 'horizontal' ? -90 : 0) //
const arrow2 = createArrow(p2CenterX - 6.5, p2CenterY + 1, lineDirection === 'horizontal' ? 90 : 180) //
const paddingX = lineDirection === 'horizontal' ? p1CenterX + 7.5 : p1CenterX + 1
const paddingX2 = lineDirection === 'horizontal' ? p2CenterX - 6.5 : p2CenterX + 1
const paddingY = lineDirection === 'horizontal' ? p1CenterY + 1 : p1CenterY + 8
const paddingY2 = lineDirection === 'horizontal' ? p2CenterY + 1 : p2CenterY - 8
const arrow1 = createArrow(paddingX, paddingY, lineDirection === 'horizontal' ? -90 : 0) //
const arrow2 = createArrow(paddingX2, paddingY2, lineDirection === 'horizontal' ? 90 : 180) //
canvas.add(arrow1)
canvas.add(arrow2)
//
// ,
distanceText = new fabric.Text(`${distance}`, {
distanceText = new fabric.Text(`${distance * 10}`, {
left: (p1CenterX + p2CenterX) / 2 + (lineDirection === 'horizontal' ? 0 : -15),
top: (p1CenterY + p2CenterY) / 2 + (lineDirection === 'horizontal' ? +15 : 0),
fill: 'black',
@ -325,6 +331,7 @@ export default function CanvasMenu(props) {
originX: 'center',
originY: 'center',
angle: lineDirection === 'horizontal' ? 0 : 270,
name: 'lengthText',
// lockMovementX: false,
// lockMovementY: false,
})

View File

View File

@ -4,17 +4,17 @@ import { useRecoilValue } from 'recoil'
import { canvasState } from '@/store/canvasAtom'
import { BATCH_TYPE, INPUT_TYPE } from '@/common/common'
import { useEvent } from '@/hooks/useEvent'
import { pointsToTurfPolygon, polygonToTurfPolygon, rectToPolygon } from '@/util/canvas-util'
import { pointsToTurfPolygon, polygonToTurfPolygon, rectToPolygon, triangleToPolygon, setSurfaceShapePattern } from '@/util/canvas-util'
import { useSwal } from '@/hooks/useSwal'
import * as turf from '@turf/turf'
import { usePolygon } from '@/hooks/usePolygon'
import { QPolygon } from '@/components/fabric/QPolygon'
export function useObjectBatch() {
const { getMessage } = useMessage()
const canvas = useRecoilValue(canvasState)
const { addCanvasMouseEventListener, initEvent } = useEvent()
const { swalFire } = useSwal()
const { drawDirectionArrow } = usePolygon()
const applyOpeningAndShadow = (objectPlacement, buttonAct, surfaceShapePolygons) => {
@ -367,6 +367,7 @@ export function useObjectBatch() {
originX: 'center',
originY: 'center',
name: dormerName,
pitch: pitch,
})
const rightTriangle = new QPolygon(splitedTriangle[1], {
@ -383,6 +384,7 @@ export function useObjectBatch() {
originX: 'center',
originY: 'center',
name: dormerName,
pitch: pitch,
})
canvas?.add(leftTriangle)
@ -540,6 +542,7 @@ export function useObjectBatch() {
originX: 'center',
originY: 'center',
name: dormerName,
pitch: pitch,
})
const rightPentagon = new QPolygon(splitedPentagon[1], {
@ -556,6 +559,7 @@ export function useObjectBatch() {
originX: 'center',
originY: 'center',
name: dormerName,
pitch: pitch,
})
canvas?.add(leftPentagon)

View File

@ -11,9 +11,11 @@ import { useMessage } from '@/hooks/useMessage'
import { useEvent } from '@/hooks/useEvent'
import { usePopup } from '@/hooks/usePopup'
import { roofDisplaySelector } from '@/store/settingAtom'
import { usePolygon } from '@/hooks/usePolygon'
export function useSurfaceShapeBatch() {
const { getMessage } = useMessage()
const { drawDirectionArrow } = usePolygon()
const canvas = useRecoilValue(canvasState)
const globalPitch = useRecoilValue(globalPitchState)
@ -125,6 +127,8 @@ export function useSurfaceShapeBatch() {
initEvent()
setSurfaceShapePattern(obj, roofDisplay.column)
closePopup(id)
drawDirectionArrow(obj)
setShowPlacementSurfaceSettingModal(true)
})
}
}