Merge remote-tracking branch 'origin/sub_laptop_5' into main_laptop_1
design_page.ts import 충돌 = 424 의 좌우 이동 import 지움 + 428 pipelineDetail 살림 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01C6BNBFXFndbqYxu6sZuknK
This commit is contained in:
@@ -107,8 +107,9 @@ export function placeOnLine<S extends FollowingStructure & { id?: string | null
|
||||
}
|
||||
|
||||
/** 노선을 저장한 [저장] — 세션 관 초안(목록 한 벌)을 서버가 따라 옮긴 관(`after`) 위에 얹은 목록(누가거리 순).
|
||||
* 초안 관이 노선 저장 전 정본(`before`) 자리 그대로면(따라감 전 값) 서버 자리로(구간 끝 · 좌표도) · 사용자가
|
||||
* 옮긴 · 새로 놓은 관은 그대로 · 서버가 새로 놓은 관(옛 정본에 없던 id)은 붙임 · 짝은 id. */
|
||||
* 초안 관이 노선 저장 전 정본(`before`) 자리 그대로면(따라감 전 값) · 따라가기만 했으면(땅 위 자리 = 정본 x · y ·
|
||||
* 누가거리만 화면 계산 · 428) 서버 자리로(구간 끝 · 좌표도) · 사용자가 옮긴 · 새로 놓은 관은 그대로 · 서버가 새로
|
||||
* 놓은 관(옛 정본에 없던 id)은 붙임 · 짝은 id. */
|
||||
export function rebasePipeDraft<P extends FollowingPoint & { id?: string | null }>(
|
||||
draft: ReadonlyArray<P>,
|
||||
before: ReadonlyArray<FollowingPoint & { id?: string | null }>,
|
||||
@@ -120,7 +121,14 @@ export function rebasePipeDraft<P extends FollowingPoint & { id?: string | null
|
||||
const kept = draft.map((pipe) => {
|
||||
const was = pipe.id ? old.get(pipe.id) : undefined;
|
||||
const now = pipe.id ? moved.get(pipe.id) : undefined;
|
||||
if (!was || !now || Math.abs(pipe.chainage_m - was.chainage_m) > SAME_STATION_M) return pipe;
|
||||
const followed =
|
||||
pipe.x != null &&
|
||||
pipe.y != null &&
|
||||
was?.x != null &&
|
||||
was.y != null &&
|
||||
Math.hypot(pipe.x - was.x, pipe.y - was.y) <= FOLLOW_SAME_XY_M;
|
||||
if (!was || !now || (!followed && Math.abs(pipe.chainage_m - was.chainage_m) > SAME_STATION_M))
|
||||
return pipe;
|
||||
const shift = now.chainage_m - pipe.chainage_m;
|
||||
return {
|
||||
...pipe,
|
||||
@@ -134,6 +142,9 @@ export function rebasePipeDraft<P extends FollowingPoint & { id?: string | null
|
||||
return [...kept, ...added].sort((a, b) => a.chainage_m - b.chainage_m);
|
||||
}
|
||||
|
||||
/** 따라가기만 한 관 = 정본과 같은 땅 위 자리(m) — 서버 좌표가 mm 3자리라 그 반올림 폭. */
|
||||
const FOLLOW_SAME_XY_M = 0.001;
|
||||
|
||||
export interface FollowingPoint {
|
||||
chainage_m: number;
|
||||
x?: number | null;
|
||||
|
||||
Reference in New Issue
Block a user