Git Komut Rehberi & Terminal Asistanı
Sıfırdan Yeni Bir Depo Başlatın:
Mevcut Bir Git Deposu veya Klasörü Gönderin:
Hataları Geri Alma, İptal & Temizlik:
Son commit'i geri al (yapılan değişiklikleri korur):
git reset --soft HEAD~1
Yapılan yerel değişiklikleri iptal et (çalışma ağacını temizler):
git restore .
Takip edilmeyen gereksiz dosyaları sil:
git clean -fd
Değişiklikleri geçici sakla ve geri getir (stash):
git stash git stash pop
Dal (Branch) ve Sürüm Etiketleri:
Yeni dal aç ve geçiş yap:
git checkout -b yeni-ozellik git push -u origin yeni-ozellik
Sürüm etiketi (tag) oluştur ve gönder:
git tag -a v1.0.0 -m "Sürüm 1.0.0" git push origin --tags
fix: import dense STL meshes
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { appendEditorHistorySnapshot, boundedEditorHistory, editorHistoryEntry, editorHistoryForExport, hydrateEditorHistoryState, projectShapesFingerprint } from "@/lib/editorHistory";
|
||||
import { appendEditorHistorySnapshot, boundedEditorHistory, editorHistoryEntry, editorHistoryForExport, hydrateEditorHistoryState, immutableResourceFingerprint, projectShapesFingerprint } from "@/lib/editorHistory";
|
||||
import type { WorkplaneShape } from "@/types/sketchforge";
|
||||
|
||||
function box(overrides: Partial<WorkplaneShape> = {}): WorkplaneShape {
|
||||
@@ -93,6 +93,37 @@ describe("editor history snapshots", () => {
|
||||
}])).toBe(baseline);
|
||||
});
|
||||
|
||||
it("stream-hashes large mesh arrays and detects changes at the end", () => {
|
||||
const positions = Array.from({ length: 10_001 }, (_, index) => Math.fround(Math.sin(index) * 100));
|
||||
const resource = {
|
||||
positions,
|
||||
normals: positions.map((value) => Math.fround(value / 100)),
|
||||
baseWidth: 200,
|
||||
baseDepth: 150,
|
||||
baseHeight: 80,
|
||||
triangleCount: Math.floor(positions.length / 9),
|
||||
sourceFormat: "stl",
|
||||
};
|
||||
const changedPositions = [...positions];
|
||||
changedPositions[changedPositions.length - 1] += 1;
|
||||
|
||||
expect(immutableResourceFingerprint({ ...resource, positions: [...positions], normals: [...resource.normals] }))
|
||||
.toBe(immutableResourceFingerprint(resource));
|
||||
expect(immutableResourceFingerprint({ ...resource, positions: changedPositions }))
|
||||
.not.toBe(immutableResourceFingerprint(resource));
|
||||
});
|
||||
|
||||
it("falls back to direct field hashing when serialization exceeds the string limit", () => {
|
||||
const resource = {
|
||||
positions: [0, 0, 0, 1, 0, 0, 0, 1, 0],
|
||||
toJSON() {
|
||||
throw new RangeError("Invalid string length");
|
||||
},
|
||||
};
|
||||
|
||||
expect(immutableResourceFingerprint(resource)).toMatch(/^stream-v1:/);
|
||||
});
|
||||
|
||||
it("keeps unlimited history and applies preset or custom action limits", () => {
|
||||
const entries = Array.from({ length: 140 }, (_, index) => ({
|
||||
...editorHistoryEntry([box({ id: `box-${index}`, x: index })], []),
|
||||
|
||||
Reference in New Issue
Block a user