diff --git a/__test__/EdgeSealing/__snapshots__/EdgeSealing.test.ts.snap b/__test__/EdgeSealing/__snapshots__/EdgeSealing.test.ts.snap index 43088d4a8..2b434c4c6 100644 --- a/__test__/EdgeSealing/__snapshots__/EdgeSealing.test.ts.snap +++ b/__test__/EdgeSealing/__snapshots__/EdgeSealing.test.ts.snap @@ -34,4 +34,4 @@ exports[`异型板件,非相切圆弧 1`] = `635612.2751433642`; exports[`异型板件,非相切圆弧 2`] = `626242.2196800549`; -exports[`椭圆弧封边 1`] = `23838.801571523727`; +exports[`椭圆弧封边 1`] = `23816.280001572693`; diff --git a/src/Add-on/Save.ts b/src/Add-on/Save.ts index 2be24328c..a2ed46141 100644 --- a/src/Add-on/Save.ts +++ b/src/Add-on/Save.ts @@ -14,12 +14,23 @@ import { SaveAsModal } from "../UI/Components/Modal/SavaAsModal"; import { AppToaster } from "../UI/Components/Toaster"; import { Purge } from './Purge'; import { userConfig } from '../Editor/UserConfig'; +import { TempEditor } from '../Editor/TempEditor'; export class Save implements Command { NoHistory = true; async exec() { + if (TempEditor.EditorIng) + { + AppToaster.show({ + message: "请先退出编辑模式在保存", + timeout: 3000, + intent: Intent.WARNING + }, "warning"); + return; + } + if (app.Saved) { app.Editor.Prompt("文件已保存!"); diff --git a/src/Add-on/SetSmoothEdge/SetSmoothEdgeFace.ts b/src/Add-on/SetSmoothEdge/SetSmoothEdgeFace.ts index a192c1b99..fd7e9742f 100644 --- a/src/Add-on/SetSmoothEdge/SetSmoothEdgeFace.ts +++ b/src/Add-on/SetSmoothEdge/SetSmoothEdgeFace.ts @@ -66,11 +66,8 @@ class SetSmoothEdgeFaces extends BoardGetFace { for (let f1 of this.Faces) { - if (this.SmoothFace.has(f1)) continue; for (let f2 of bg.Faces) { - if (bg.SmoothFace.has(f2)) continue; - //都是正面,或者不允许侧面同侧面并且2板件类型不一样就跳过 if (f1.type === f2.type && (f1.type === BoardFaceType.NoSide || bg.Board.BoardType !== this.Board.BoardType) @@ -99,17 +96,25 @@ class SetSmoothEdgeFaces extends BoardGetFace continue; } - if (f1.IsIntersect(f2, scale)) + if (f1.type === f2.type) { - if (f1.type === BoardFaceType.Side) - { + if (f1.IsIntersect(f2, scale)) this.SmoothFace.add(f1); - } - if (f2.type === BoardFaceType.Side) - { + if (f2.IsIntersect(f1, scale)) bg.SmoothFace.add(f2); - } } + else + if (f1.IsIntersect(f2, scale)) + { + if (f1.type === BoardFaceType.Side) + { + this.SmoothFace.add(f1); + } + if (f2.type === BoardFaceType.Side) + { + bg.SmoothFace.add(f2); + } + } } } } diff --git a/src/Common/InterfereUtil.ts b/src/Common/InterfereUtil.ts index 8b6428a7e..78b24cc18 100644 --- a/src/Common/InterfereUtil.ts +++ b/src/Common/InterfereUtil.ts @@ -72,9 +72,10 @@ export class CheckInterfereTool let RelativeHardware: Set; if (e1 instanceof Board) { - RelevanceMeats = new Set(e1.RelevanceMeats); - RelevanceKnifs = new Set(e1.RelevanceKnifs); - RelativeHardware = new Set(e1.RelativeHardware); + let tempEn = e1.__OriginalEnt__ ?? e1; + RelevanceMeats = new Set(tempEn.RelevanceMeats); + RelevanceKnifs = new Set(tempEn.RelevanceKnifs); + RelativeHardware = new Set(tempEn.RelativeHardware); } let RelevanceBoards: Set; diff --git a/src/Geometry/DrillParse/Face.ts b/src/Geometry/DrillParse/Face.ts index b69eece2c..be9f74bb6 100644 --- a/src/Geometry/DrillParse/Face.ts +++ b/src/Geometry/DrillParse/Face.ts @@ -85,7 +85,7 @@ export class Face //如果不是矩形,用布尔运算,如果 if (!noSideFace.IsRect || !canUseBoxCalc) { - let sideReg = sideFace.Region; + let sideReg = sideFace.Region.Clone(); if (!sideReg || !noSideFace.Region) return []; let toReg = noSideFace.Region.Clone().ApplyMatrix(diffMtx); @@ -171,7 +171,7 @@ export class Face return false; let pts = c1.IntersectWith(c2, 0); - if (pts.length <= 1) return false; + if (pts.length <= 1) return true; new Box3Ext().setFromPoints(pts).getSize(size); diff --git a/src/GraphicsSystem/CalcEdgeSealing.ts b/src/GraphicsSystem/CalcEdgeSealing.ts index 809d92e57..b9d6c709d 100644 --- a/src/GraphicsSystem/CalcEdgeSealing.ts +++ b/src/GraphicsSystem/CalcEdgeSealing.ts @@ -195,11 +195,11 @@ export function GetBoardHighSeal(br: Board, sealcus: Curve[]) { let derv = c.GetFistDeriv(0).multiplyScalar(dir); let an = angle(derv); - if (an > -1e-6 && an < Math.PI / 2) + if (equaln(an, 0) || (an < Math.PI / 4 + 1e-8 && an > Math.PI * 7 / 4)) highSeals.push({ size: sealDown }); - else if (an > Math.PI / 2 - 1e-6 && an < Math.PI) + else if (an > Math.PI / 4 && an < Math.PI * 3 / 4 + 1e-8) highSeals.push({ size: sealRight }); - else if (an > Math.PI - 1e-6 && an < Math.PI * 3 / 2) + else if (an > Math.PI * 3 / 4 && an < Math.PI * 5 / 4 + 1e-8) highSeals.push({ size: sealUp }); else highSeals.push({ size: sealLeft }); diff --git a/src/IndexedDb/IndexedDbStore.ts b/src/IndexedDb/IndexedDbStore.ts index 26e3c2489..af1298881 100644 --- a/src/IndexedDb/IndexedDbStore.ts +++ b/src/IndexedDb/IndexedDbStore.ts @@ -84,6 +84,12 @@ export class IndexedDbStore this.dbRequest.onsuccess = (event) => { this.db = this.dbRequest.result; + this.db.onclose = (ev) => + { + console.error("数据库已经关闭关闭"); + this.db = null; + this.opening = false; + }; this.resFunctionList.forEach(res => res(true)); };