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
feat: improve shape tools and project previews
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { rotateSketchPoints, selectedClosedSketchPoints } from "@/lib/sketchRotation";
|
||||
import type { SketchProfile } from "@/types/sketchforge";
|
||||
|
||||
const rectangle: SketchProfile = {
|
||||
points: [
|
||||
{ id: "a", x: 0, z: 0, handleOut: { x: 1, z: 0 } },
|
||||
{ id: "b", x: 4, z: 0 },
|
||||
{ id: "c", x: 4, z: 2 },
|
||||
{ id: "d", x: 0, z: 2 },
|
||||
],
|
||||
segments: [
|
||||
{ id: "ab", startId: "a", endId: "b" },
|
||||
{ id: "bc", startId: "b", endId: "c" },
|
||||
{ id: "cd", startId: "c", endId: "d" },
|
||||
{ id: "da", startId: "d", endId: "a" },
|
||||
],
|
||||
};
|
||||
|
||||
describe("sketch rotation", () => {
|
||||
it("recognizes a complete closed sketch selection", () => {
|
||||
const points = selectedClosedSketchPoints(rectangle, {
|
||||
pointIds: ["a", "b", "c", "d"],
|
||||
segmentIds: ["ab", "bc", "cd", "da"],
|
||||
});
|
||||
expect(points?.map((point) => point.id)).toEqual(["a", "b", "c", "d"]);
|
||||
});
|
||||
|
||||
it("rejects an open, partial, or image-inclusive selection", () => {
|
||||
expect(selectedClosedSketchPoints(rectangle, {
|
||||
pointIds: ["a", "b", "c", "d"],
|
||||
segmentIds: ["ab", "bc", "cd"],
|
||||
})).toBeNull();
|
||||
expect(selectedClosedSketchPoints(rectangle, {
|
||||
pointIds: ["a", "b", "c", "d"],
|
||||
segmentIds: ["ab", "bc", "cd", "da"],
|
||||
imageIds: ["reference-image"],
|
||||
})).toBeNull();
|
||||
});
|
||||
|
||||
it("rotates points and bezier handles around the selection bounds center", () => {
|
||||
const rotated = rotateSketchPoints(rectangle.points, 90);
|
||||
const first = rotated.find((point) => point.id === "a");
|
||||
expect(first?.x).toBeCloseTo(3, 8);
|
||||
expect(first?.z).toBeCloseTo(-1, 8);
|
||||
expect(first?.handleOut?.x).toBeCloseTo(3, 8);
|
||||
expect(first?.handleOut?.z).toBeCloseTo(0, 8);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user