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
Add workspace editor tools
This commit is contained in:
@@ -0,0 +1,97 @@
|
||||
import { canonicalizeShape } from "@/lib/workplaneShapes";
|
||||
import { createLocalId } from "@/lib/localIds";
|
||||
import type { ShapeAsset, WorkplaneShape } from "@/types/sketchforge";
|
||||
|
||||
export type ToolbarShapeAsset = ShapeAsset & { menuIcon: string };
|
||||
|
||||
export const toolbarShapeAssets: ToolbarShapeAsset[] = [
|
||||
{ id: "box", name: "Box", src: "assets/sketchforge/shape-icons-gray/box.png", menuIcon: "assets/sketchforge/shape-icons-gray/box.png", kind: "box", color: "#d41721" },
|
||||
{ id: "cylinder", name: "Cylinder", src: "assets/sketchforge/shape-icons-gray/cylinder.png", menuIcon: "assets/sketchforge/shape-icons-gray/cylinder.png", kind: "cylinder", color: "#d97813" },
|
||||
{ id: "sphere", name: "Sphere", src: "assets/sketchforge/shape-icons-gray/sphere.png", menuIcon: "assets/sketchforge/shape-icons-gray/sphere.png", kind: "sphere", color: "#0098c7" },
|
||||
{ id: "cone", name: "Cone", src: "assets/sketchforge/shape-icons-gray/cone.png", menuIcon: "assets/sketchforge/shape-icons-gray/cone.png", kind: "cone", color: "#6e2786" },
|
||||
{ id: "pyramid", name: "Pyramid", src: "assets/sketchforge/shape-icons-gray/pyramid.png", menuIcon: "assets/sketchforge/shape-icons-gray/pyramid.png", kind: "pyramid", color: "#f2cf10" },
|
||||
{ id: "wedge", name: "Wedge", src: "assets/sketchforge/shape-icons-gray/wedge.png", menuIcon: "assets/sketchforge/shape-icons-gray/wedge.png", kind: "wedge", color: "#33983d" },
|
||||
{ id: "text", name: "Text", src: "assets/sketchforge/shape-icons-gray/text.png", menuIcon: "assets/sketchforge/shape-icons-gray/text.png", kind: "text", color: "#cf101b" },
|
||||
{ id: "round-roof", name: "Round Roof", src: "assets/sketchforge/shape-icons-gray/round-roof.png", menuIcon: "assets/sketchforge/shape-icons-gray/round-roof.png", kind: "roundRoof", color: "#67c4ce" },
|
||||
{ id: "half-sphere", name: "Half Sphere", src: "assets/sketchforge/shape-icons-gray/half-sphere.png", menuIcon: "assets/sketchforge/shape-icons-gray/half-sphere.png", kind: "halfSphere", color: "#c9009a" },
|
||||
{ id: "torus", name: "Torus", src: "assets/sketchforge/shape-icons-gray/torus.png", menuIcon: "assets/sketchforge/shape-icons-gray/torus.png", kind: "torus", color: "#0098c7" },
|
||||
{ id: "tube", name: "Tube", src: "assets/sketchforge/shape-icons-gray/tube.png", menuIcon: "assets/sketchforge/shape-icons-gray/tube.png", kind: "tube", color: "#ce7013" },
|
||||
];
|
||||
|
||||
export function sceneShape(shape: Partial<WorkplaneShape> & Pick<WorkplaneShape, "name" | "kind" | "color">): WorkplaneShape {
|
||||
const width = shape.width ?? shape.size ?? 20;
|
||||
const depth = shape.depth ?? shape.size ?? 20;
|
||||
const height = shape.height ?? 20;
|
||||
return canonicalizeShape({
|
||||
id: shape.id ?? createLocalId("shape"),
|
||||
name: shape.name,
|
||||
kind: shape.kind,
|
||||
color: shape.color,
|
||||
hole: shape.hole,
|
||||
x: shape.x ?? 0,
|
||||
z: shape.z ?? 0,
|
||||
elevation: shape.elevation ?? 0,
|
||||
size: shape.size ?? Math.max(width, depth),
|
||||
width,
|
||||
depth,
|
||||
height,
|
||||
rotation: shape.rotation ?? 0,
|
||||
rotationX: shape.rotationX ?? 0,
|
||||
rotationZ: shape.rotationZ ?? 0,
|
||||
radius: shape.radius,
|
||||
steps: shape.steps,
|
||||
sides: shape.sides,
|
||||
bevel: shape.bevel,
|
||||
segments: shape.segments,
|
||||
topRadius: shape.topRadius,
|
||||
baseRadius: shape.baseRadius,
|
||||
text: shape.text,
|
||||
font: shape.font,
|
||||
importedMesh: shape.importedMesh,
|
||||
imagePlate: shape.imagePlate,
|
||||
groupedShapes: shape.groupedShapes,
|
||||
groupedBaseWidth: shape.groupedBaseWidth,
|
||||
groupedBaseDepth: shape.groupedBaseDepth,
|
||||
groupedBaseHeight: shape.groupedBaseHeight,
|
||||
locked: shape.locked ?? false,
|
||||
hidden: shape.hidden ?? false,
|
||||
});
|
||||
}
|
||||
|
||||
export function makeShapeFromAsset(asset: ShapeAsset, point?: { x: number; z: number; elevation?: number }): WorkplaneShape {
|
||||
const roundProfile = asset.kind === "sphere" || asset.kind === "torus" || asset.kind === "ring" || asset.kind === "halfSphere";
|
||||
const flatProfile = asset.kind === "torus" || asset.kind === "ring" || asset.kind === "text";
|
||||
const size = roundProfile ? 22 : 20;
|
||||
const height = asset.kind === "text" ? 10 : asset.kind === "roundRoof" ? 10 : asset.kind === "halfSphere" ? 11 : flatProfile ? 5 : 20;
|
||||
const width = asset.kind === "text" ? 86 : size;
|
||||
const depth = asset.kind === "text" ? 28 : size;
|
||||
|
||||
return {
|
||||
id: createLocalId(asset.id),
|
||||
name: asset.name,
|
||||
kind: asset.kind,
|
||||
color: asset.color,
|
||||
hole: asset.hole,
|
||||
x: point?.x ?? 0,
|
||||
z: point?.z ?? 0,
|
||||
elevation: point?.elevation ?? 0,
|
||||
size,
|
||||
width,
|
||||
depth,
|
||||
height,
|
||||
rotation: 0,
|
||||
rotationX: 0,
|
||||
rotationZ: 0,
|
||||
radius: asset.kind === "box" ? 0 : undefined,
|
||||
text: asset.kind === "text" ? "TEXT" : undefined,
|
||||
font: asset.kind === "text" ? "Multilanguage" : undefined,
|
||||
steps: asset.kind === "box" ? 10 : asset.kind === "sphere" ? 24 : asset.kind === "halfSphere" ? 32 : undefined,
|
||||
sides: asset.kind === "cylinder" || asset.kind === "cone" ? 96 : asset.kind === "roundRoof" ? 64 : asset.kind === "pyramid" ? 4 : undefined,
|
||||
bevel: asset.kind === "cylinder" ? 0 : asset.kind === "tube" || asset.kind === "ring" ? 4 : undefined,
|
||||
segments: asset.kind === "cylinder" ? 1 : undefined,
|
||||
topRadius: asset.kind === "cone" ? 0 : undefined,
|
||||
baseRadius: asset.kind === "cone" ? size / 2 : undefined,
|
||||
locked: false,
|
||||
hidden: false,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user