평면도와 상부평면도 모델을 하나로 통합
This commit is contained in:
1 parent
9d11b4ed62
commit
e473a7caff
10 files changed
+54
-8799
No files matched your search
+7
-9
@@ -37,16 +37,16 @@ function inPolygon(point, polygon) {
|
||||
return inside
|
||||
}
|
||||
|
||||
export default function ModelViewer({ units, hidden, hiddenUnits, selected, onSelect, view, renderMode, resetToken }) {
|
||||
export default function ModelViewer({ units, hidden, selected, onSelect, view, renderMode, resetToken }) {
|
||||
const canvasRef = useRef(null)
|
||||
const cameraRef = useRef({ ...DEFAULT_CAMERA })
|
||||
const sceneRef = useRef({ units, hidden, hiddenUnits, selected, view, renderMode, onSelect })
|
||||
const sceneRef = useRef({ units, hidden, selected, view, renderMode, onSelect })
|
||||
const drawRef = useRef(() => {})
|
||||
|
||||
useEffect(() => {
|
||||
sceneRef.current = { units, hidden, hiddenUnits, selected, view, renderMode, onSelect }
|
||||
sceneRef.current = { units, hidden, selected, view, renderMode, onSelect }
|
||||
drawRef.current()
|
||||
}, [units, hidden, hiddenUnits, selected, view, renderMode, onSelect])
|
||||
}, [units, hidden, selected, view, renderMode, onSelect])
|
||||
|
||||
useEffect(() => {
|
||||
const canvas = canvasRef.current
|
||||
@@ -74,7 +74,7 @@ export default function ModelViewer({ units, hidden, hiddenUnits, selected, onSe
|
||||
canvas.width = Math.round(width * dpr); canvas.height = Math.round(height * dpr)
|
||||
}
|
||||
ctx.setTransform(dpr, 0, 0, dpr, 0, 0)
|
||||
const { units, hidden, hiddenUnits, selected, renderMode } = sceneRef.current
|
||||
const { units, hidden, selected, renderMode } = sceneRef.current
|
||||
const background = ctx.createLinearGradient(0, 0, 0, height)
|
||||
background.addColorStop(0, renderMode ? '#e8efea' : '#f8faf8')
|
||||
background.addColorStop(1, renderMode ? '#cbd8cf' : '#e9efea')
|
||||
@@ -91,7 +91,6 @@ export default function ModelViewer({ units, hidden, hiddenUnits, selected, onSe
|
||||
const faces = []
|
||||
const longitudinalSteps = 8
|
||||
for (const unit of units) {
|
||||
if (hiddenUnits.has(unit.id)) continue
|
||||
for (const part of unit.parts) {
|
||||
if (hidden.has(part.id) || part.a.length !== part.b.length) continue
|
||||
const color = COLORS[part.group] || COLORS.major
|
||||
@@ -129,11 +128,10 @@ export default function ModelViewer({ units, hidden, hiddenUnits, selected, onSe
|
||||
ctx.font = '11px sans-serif'
|
||||
ctx.textAlign = 'left'
|
||||
ctx.fillStyle = '#68806d'
|
||||
units.forEach((unit, index) => {
|
||||
if (hiddenUnits.has(unit.id)) return
|
||||
units.forEach(unit => {
|
||||
const start = project(worldPoint(unit, [[0, 104]], [[0, 104]], 0, 0), width, height)
|
||||
const end = project(worldPoint(unit, [[0, 104]], [[0, 104]], 0, 1), width, height)
|
||||
ctx.fillText(`중심선 ${index + 1} · STA 319.010`, start[0] - 5, start[1] - 16)
|
||||
ctx.fillText('BLOCK8 중심선 · STA 319.010', start[0] - 5, start[1] - 16)
|
||||
ctx.fillText(`STA 338.990`, end[0] - 8, end[1] - 14)
|
||||
})
|
||||
ctx.fillStyle = '#6f8275'
|
||||
|
||||
Reference in new issue
Block a user