fix: 修复 3D NaN 崩溃/样品图不刷新/画布点选失效
- replayShape 段过滤补 Y 轴有限值校验(此前仅校验 X) - inferSashGlyphs bdRect 增加有限值守卫 - WindoorThreed 逐网格有限值防护 + maxDim 守卫, 杜绝 NaN 网格 - CombineCanvas shapePts 过滤非有限点, 修复包围盒污染导致的点选失效 - 组合画布引入 rev 版本号: 原地变异几何后强制 3D 预览重建 (修复尺寸编辑后样品图不变化)
This commit is contained in:
@@ -143,7 +143,9 @@ export function replayShape(shape: FrameShape): {
|
||||
} {
|
||||
const base = (shape.polygon?.polygon ?? [])
|
||||
.map(r => r
|
||||
.filter(s => s && typeof s === 'object' && s.ps && s.pe && Number.isFinite(s.ps.x) && Number.isFinite(s.pe.x))
|
||||
.filter(s => s && typeof s === 'object' && s.ps && s.pe
|
||||
&& Number.isFinite(s.ps.x) && Number.isFinite(s.ps.y)
|
||||
&& Number.isFinite(s.pe.x) && Number.isFinite(s.pe.y))
|
||||
.map(s => ({ ps: { ...s.ps }, pe: { ...s.pe } })))
|
||||
.filter(r => r.length >= 3)
|
||||
const regions: Segment[][] = base.map(r => r)
|
||||
@@ -237,11 +239,13 @@ export function inferSashGlyphs(shape: FrameShape, replayed?: Segment[][]): {
|
||||
const regionBBs = regions.map(r => bboxOf(regionPoints(r)))
|
||||
const glyphs: SashGlyph[] = []
|
||||
const bdRect = (bd: NonNullable<SashShape['bd']>) => {
|
||||
if (!bd.from || !bd.to) return null
|
||||
const r = {
|
||||
x0: Math.min(bd.from.x, bd.to.x), y0: Math.min(bd.from.y, bd.to.y),
|
||||
x1: Math.max(bd.from.x, bd.to.x), y1: Math.max(bd.from.y, bd.to.y),
|
||||
}
|
||||
return !bd.hidden && r.x1 - r.x0 > 10 && r.y1 - r.y0 > 10 ? r : null
|
||||
const ok = [r.x0, r.y0, r.x1, r.y1].every(v => Number.isFinite(v))
|
||||
return ok && !bd.hidden && r.x1 - r.x0 > 10 && r.y1 - r.y0 > 10 ? r : null
|
||||
}
|
||||
const kindOf = (sub: SashShape) => (sub.type === 'DoubleSash' ? 'sliding' : 'casement') as 'sliding' | 'casement'
|
||||
const pushGlyphs = (r: { x0: number; y0: number; x1: number; y1: number }, entries: any[], sub: SashShape) => {
|
||||
|
||||
Reference in New Issue
Block a user