Add Boolean Intersection and refresh toolbar icons

This commit is contained in:
Formsmith
2026-06-19 10:37:32 +03:00
parent 648d520422
commit 8174e5560d
18 changed files with 296 additions and 218 deletions
+65 -27
View File
@@ -992,12 +992,60 @@ button {
}
.toolbar-command-icon {
--toolbar-art-offset-y: 0%;
display: block;
object-fit: contain;
opacity: 0.96;
transform: translateY(var(--toolbar-art-offset-y));
transition: filter 120ms ease, opacity 120ms ease;
}
.toolbar-art-toolbar-home,
.toolbar-art-toolbar-delete {
--toolbar-art-offset-y: -5.25%;
}
.toolbar-art-toolbar-copy {
--toolbar-art-offset-y: -6.6%;
}
.toolbar-art-toolbar-paste,
.toolbar-art-toolbar-mirror,
.toolbar-art-toolbar-drop-workplane {
--toolbar-art-offset-y: -2.4%;
}
.toolbar-art-toolbar-duplicate {
--toolbar-art-offset-y: -7.1%;
}
.toolbar-art-toolbar-undo,
.toolbar-art-toolbar-redo {
--toolbar-art-offset-y: -8.95%;
}
.toolbar-art-toolbar-snap-grid {
--toolbar-art-offset-y: -4.2%;
}
.toolbar-art-toolbar-workplane {
--toolbar-art-offset-y: -10%;
}
.toolbar-art-toolbar-import,
.toolbar-art-toolbar-export {
--toolbar-art-offset-y: -0.8%;
}
.toolbar-art-toolbar-settings {
--toolbar-art-offset-y: -3.7%;
}
.toolbar-icon .toolbar-user-art-icon {
width: 40px;
height: 40px;
}
.toolbar-icon.disabled .toolbar-command-icon {
filter: grayscale(1) brightness(1.25);
opacity: 0.22;
@@ -1236,6 +1284,17 @@ button {
height: 32px;
}
.action-buttons .action-icon-button .toolbar-command-icon {
width: 32px;
height: 32px;
object-fit: contain;
}
.action-buttons .action-icon-button .toolbar-user-art-icon {
width: 40px;
height: 40px;
}
.top-dropdown {
position: fixed;
top: 76px;
@@ -1343,9 +1402,11 @@ button {
}
.top-action-body button svg,
.top-action-body button .vector-toolbar-sprite-icon {
.top-action-body button .vector-toolbar-sprite-icon,
.top-action-body button .toolbar-command-icon {
width: 20px;
height: 20px;
object-fit: contain;
}
.top-action-body .import-drop-zone {
@@ -1372,9 +1433,11 @@ button {
color: #244057;
}
.import-drop-zone .vector-toolbar-sprite-icon {
.import-drop-zone .vector-toolbar-sprite-icon,
.import-drop-zone .toolbar-command-icon {
width: 30px;
height: 30px;
object-fit: contain;
}
.import-drop-zone strong {
@@ -2826,31 +2889,6 @@ button {
border-left: 1px solid #eef1f4;
}
.sidebar-tools {
display: grid;
height: 72px;
grid-template-columns: repeat(3, 1fr);
}
.sidebar-tool {
display: grid;
place-items: center;
color: var(--primary);
background: transparent;
cursor: pointer;
}
.sidebar-tool svg,
.sidebar-tool .toolbar-command-icon {
width: 58px;
height: 58px;
object-fit: contain;
}
.sidebar-tool:hover {
background: #eef8fc;
}
.category-row {
position: relative;
display: flex;
+193 -67
View File
@@ -1,10 +1,10 @@
"use client";
import { Download, Home, Menu, Settings, UserRoundPlus, X } from "lucide-react";
import { Download, X } from "lucide-react";
import type manifoldModule from "manifold-3d";
import type { ManifoldToplevel } from "manifold-3d";
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import { ADDITION, Brush, Evaluator, HOLLOW_SUBTRACTION, SUBTRACTION, type CSGOperation } from "three-bvh-csg";
import { ADDITION, Brush, Evaluator, HOLLOW_INTERSECTION, HOLLOW_SUBTRACTION, INTERSECTION, SUBTRACTION, type CSGOperation } from "three-bvh-csg";
import * as THREE from "three";
import { TextGeometry } from "three/examples/jsm/geometries/TextGeometry.js";
import { FontLoader, type Font, type FontData } from "three/examples/jsm/loaders/FontLoader.js";
@@ -18,7 +18,6 @@ import optimerBoldFontJson from "three/examples/fonts/optimer_bold.typeface.json
import { manifoldModuleSource } from "@/generated/manifoldModuleSource";
import { manifoldWasmBase64 } from "@/generated/manifoldWasmBase64";
import {
GridModeIcon,
ToolbarAlignIcon,
ToolbarCaretDownIcon,
ToolbarCopyIcon,
@@ -27,7 +26,9 @@ import {
ToolbarExportIcon,
ToolbarGroupIcon,
ToolbarHideSelectedIcon,
ToolbarHomeIcon,
ToolbarImportIcon,
ToolbarIntersectionIcon,
ToolbarMirrorIcon,
ToolbarPasteIcon,
ToolbarRedoIcon,
@@ -78,6 +79,15 @@ type GroupBuildResult = {
consumed: boolean;
failureNotice: string;
};
type IntersectionAttempt =
| { status: "success"; group: WorkplaneShape }
| { status: "empty" }
| { status: "unsupported" };
type IntersectionBuildResult = {
group: WorkplaneShape | null;
empty: boolean;
failureNotice: string;
};
type BooleanAutomationMode = "before" | "after" | "ungroup";
type BooleanAutomationResult = {
ok: boolean;
@@ -3127,6 +3137,146 @@ async function manifoldUnionMeshShape(selection: WorkplaneShape[]): Promise<Work
}
}
function asIntersectionGroup(group: WorkplaneShape): WorkplaneShape {
return {
...group,
name: "Intersection",
hole: false,
};
}
async function manifoldIntersectionMeshShape(selection: WorkplaneShape[]): Promise<IntersectionAttempt> {
const solids = selection.filter((shape) => !shape.hole && !shape.locked);
const holes = selection.filter((shape) => shape.hole && !shape.locked);
if (solids.length === 0 || holes.length === 0) {
return { status: "unsupported" };
}
const sourceTriangleCount = selection.reduce((total, shape) => total + meshForShape(shape).faces.length, 0);
if (sourceTriangleCount > IMPORTED_EXACT_BOOLEAN_TRIANGLE_LIMIT) {
return { status: "unsupported" };
}
const created: ManifoldSolid[] = [];
try {
const runtime = await getManifoldRuntime();
const solid = shapesToManifoldUnion(runtime, solids, created, true);
const hole = shapesToManifoldUnion(runtime, holes, created, true);
if (!solid || !hole) {
return { status: "unsupported" };
}
const result = solid.intersect(hole);
created.push(result);
if (result.status() !== "NoError") {
return { status: "unsupported" };
}
if (result.numTri() < 1) {
return { status: "empty" };
}
const outputMesh = result.getMesh();
const positions = manifoldMeshToPositions(outputMesh);
const group = meshPositionsToGroupShape(selection, solids, positions, "grouped-manifold-intersection");
return group && isUsableBooleanGroup(group, sourceTriangleCount, false)
? { status: "success", group: asIntersectionGroup(group) }
: { status: "unsupported" };
} catch {
return { status: "unsupported" };
} finally {
Array.from(new Set(created)).forEach(disposeManifold);
}
}
function bvhIntersectionMeshShape(selection: WorkplaneShape[], operation: CSGOperation, idPrefix: string): IntersectionAttempt {
const solids = selection.filter((shape) => !shape.hole && !shape.locked);
const holes = selection.filter((shape) => shape.hole && !shape.locked);
if (solids.length === 0 || holes.length === 0) {
return { status: "unsupported" };
}
try {
const evaluator = new Evaluator();
evaluator.useGroups = false;
evaluator.attributes = ["position", "normal"];
(evaluator as Evaluator & { useCDTClipping: boolean }).useCDTClipping = true;
let solidResult = brushFromShape(solids[0]);
solids.slice(1).forEach((solid) => {
solidResult = evaluator.evaluate(solidResult, brushFromShape(solid), ADDITION);
solidResult.updateMatrixWorld(true);
});
let holeResult = brushFromShape(holes[0]);
holes.slice(1).forEach((hole) => {
holeResult = evaluator.evaluate(holeResult, brushFromShape(hole), ADDITION);
holeResult.updateMatrixWorld(true);
});
const result = evaluator.evaluate(solidResult, holeResult, operation);
result.updateMatrixWorld(true);
if (positionsFromGeometryDrawRange(result.geometry).length < 9) {
return { status: "empty" };
}
const sourceTriangleCount = solids.reduce((total, solid) => total + meshForShape(solid).faces.length, 0);
const group = resultGeometryToMeshShape(selection, solids, result.geometry, idPrefix);
return group && isUsableBooleanGroup(group, sourceTriangleCount, false)
? { status: "success", group: asIntersectionGroup(group) }
: { status: "unsupported" };
} catch {
return { status: "unsupported" };
}
}
async function buildIntersectionShapeFromSelection(groupable: WorkplaneShape[]): Promise<IntersectionBuildResult> {
const booleanSelection = expandGroupsForBoolean(groupable);
const solids = booleanSelection.filter((shape) => !shape.hole && !shape.locked);
const holes = booleanSelection.filter((shape) => shape.hole && !shape.locked);
if (solids.length === 0 || holes.length === 0) {
return {
group: null,
empty: false,
failureNotice: "Select at least one solid and one hole for Intersection",
};
}
if (!hasSolidHoleOverlap(solids, holes)) {
return { group: null, empty: true, failureNotice: "" };
}
const manifoldAttempt = await manifoldIntersectionMeshShape(booleanSelection);
if (manifoldAttempt.status === "success") {
return { group: manifoldAttempt.group, empty: false, failureNotice: "" };
}
if (manifoldAttempt.status === "empty") {
return { group: null, empty: true, failureNotice: "" };
}
const exactAttempt = bvhIntersectionMeshShape(booleanSelection, INTERSECTION, "grouped-intersection");
if (exactAttempt.status === "success") {
return { group: exactAttempt.group, empty: false, failureNotice: "" };
}
const hasImportedMesh = booleanSelection.some((shape) => Boolean(shape.importedMesh));
if (exactAttempt.status === "empty" && !hasImportedMesh) {
return { group: null, empty: true, failureNotice: "" };
}
const hollowAttempt = bvhIntersectionMeshShape(booleanSelection, HOLLOW_INTERSECTION, "grouped-hollow-intersection");
if (hollowAttempt.status === "success") {
return { group: hollowAttempt.group, empty: false, failureNotice: "" };
}
if (hollowAttempt.status === "empty" || exactAttempt.status === "empty") {
return { group: null, empty: true, failureNotice: "" };
}
return {
group: null,
empty: false,
failureNotice: "Could not calculate this Intersection cleanly",
};
}
function cutterInteriorTriangleCount(mesh: MeshData, cutters: WorkplaneShape[]) {
return mesh.faces.reduce((total, [ai, bi, ci]) => {
const centroid = triangleCentroid([mesh.vertices[ai], mesh.vertices[bi], mesh.vertices[ci]]);
@@ -4585,6 +4735,35 @@ export function SketchForgeEditor({
commitShapes([...shapes.filter((shape) => !selected.has(shape.id)), group], group.id, `Grouped ${selectedShapes.length} shapes`);
}, [commitShapes, selectedIds, selectedShapes, shapes]);
const intersectSelected = useCallback(async () => {
const groupable = selectedShapes.filter((shape) => !shape.locked);
const hasSolid = groupable.some((shape) => !shape.hole);
const hasHole = groupable.some((shape) => shape.hole);
if (!hasSolid || !hasHole) {
setNotice("Select at least one solid and one hole for Intersection");
return;
}
const result = await buildIntersectionShapeFromSelection(groupable);
if (!result.group && !result.empty) {
setNotice(result.failureNotice);
return;
}
const operandIds = new Set(groupable.map((shape) => shape.id));
const remainingShapes = shapes.filter((shape) => !operandIds.has(shape.id));
if (result.empty) {
commitShapes(remainingShapes, null, "Intersection is empty");
return;
}
const intersection = result.group;
if (!intersection) {
return;
}
commitShapes([...remainingShapes, intersection], intersection.id, `Intersected ${groupable.length} shapes`);
}, [commitShapes, selectedShapes, shapes]);
const ungroupSelected = useCallback(() => {
const groups = selectedShapes.filter((shape) => shape.groupedShapes?.length);
if (groups.length === 0) {
@@ -5065,6 +5244,7 @@ export function SketchForgeEditor({
canUndo={historyIndex > 0}
canRedo={historyIndex < history.length - 1}
canGroup={selectedShapes.length > 1}
canIntersect={selectedShapes.some((shape) => !shape.locked && !shape.hole) && selectedShapes.some((shape) => !shape.locked && Boolean(shape.hole))}
canUngroup={selectedShapes.some((shape) => Boolean(shape.groupedShapes?.length))}
hasClipboard={clipboard.length > 0}
hasSelection={hasSelection}
@@ -5078,6 +5258,7 @@ export function SketchForgeEditor({
onDuplicate={duplicateSelected}
onDropToWorkplane={dropSelectedToWorkplane}
onGroup={groupSelected}
onIntersect={intersectSelected}
onMirror={toggleMirrorMode}
onPaste={pasteShape}
onRedo={redo}
@@ -5169,70 +5350,11 @@ export function SketchForgeEditor({
);
}
function TopNavigation({
activeMode,
menuOpen,
onMakeCopy,
onMenuToggle,
onModeChange,
onNewDesign,
onProfile,
onSave,
onSettings,
}: {
activeMode: string;
menuOpen: boolean;
onMakeCopy: () => void;
onMenuToggle: () => void;
onModeChange: (mode: string) => void;
onNewDesign: () => void;
onProfile: () => void;
onSave: () => void;
onSettings: () => void;
}) {
const modes = [
{ name: "3D Design", icon: GridModeIcon },
];
return (
<nav className="top-nav">
<a className="sf-logo" aria-label="SketchForge dashboard">
<img src="assets/sketchforge/sketchforge-logo.png" alt="" />
</a>
<button className="nav-icon menu-button" aria-label="Menu" onClick={onMenuToggle}>
<Menu size={27} strokeWidth={2.2} />
</button>
{menuOpen ? (
<div className="top-dropdown app-menu">
<button onClick={onNewDesign}>New design</button>
<button onClick={onSave}>Save</button>
<button onClick={onMakeCopy}>Make a copy</button>
<button onClick={onSettings}>
<Settings size={16} />
Settings
</button>
</div>
) : null}
<div className="nav-spacer" />
<div className="mode-tabs">
{modes.map(({ name, icon: Icon }) => (
<button key={name} className={`mode-tab ${activeMode === name ? "active" : ""}`} aria-label={name} onClick={() => onModeChange(name)}>
<Icon />
</button>
))}
</div>
<button className="nav-icon collaborator" aria-label="Invite" onClick={onSettings}>
<UserRoundPlus size={34} strokeWidth={1.8} />
</button>
<button className="avatar" aria-label="Profile" onClick={onProfile} />
</nav>
);
}
function SecondaryToolbar({
alignMode,
canAlign,
canGroup,
canIntersect,
canRedo,
canUngroup,
canUndo,
@@ -5246,6 +5368,7 @@ function SecondaryToolbar({
onDuplicate,
onDropToWorkplane,
onGroup,
onIntersect,
onMirror,
onPaste,
onRedo,
@@ -5262,6 +5385,7 @@ function SecondaryToolbar({
alignMode: boolean;
canAlign: boolean;
canGroup: boolean;
canIntersect: boolean;
canRedo: boolean;
canUngroup: boolean;
canUndo: boolean;
@@ -5275,6 +5399,7 @@ function SecondaryToolbar({
onDuplicate: () => void;
onDropToWorkplane: () => void;
onGroup: () => void;
onIntersect: () => void;
onMirror: () => void;
onPaste: () => void;
onRedo: () => void;
@@ -5308,6 +5433,7 @@ function SecondaryToolbar({
{ label: "Visibility options", icon: ToolbarCaretDownIcon, action: onTips, enabled: hasSelection },
{ label: "Group", icon: ToolbarGroupIcon, action: onGroup, enabled: canGroup },
{ label: "Ungroup", icon: ToolbarUngroupIcon, action: onUngroup, enabled: canUngroup },
{ label: "Boolean Intersection", icon: ToolbarIntersectionIcon, action: onIntersect, enabled: canIntersect },
{ label: "Align", icon: ToolbarAlignIcon, action: onAlign, enabled: canAlign, active: alignMode },
{ label: "Mirror", icon: ToolbarMirrorIcon, action: onMirror, enabled: hasSelection, active: mirrorMode },
{ label: "Snap to grid", icon: ToolbarSnapGridIcon, action: onSnap, enabled: hasSelection },
@@ -5332,7 +5458,7 @@ function SecondaryToolbar({
<div className="toolbar-section-label">Home</div>
<div className="toolbar-section-tools">
<button className="toolbar-icon editor-home-control" aria-label="Home dashboard" title="Home dashboard" onClick={onHome}>
<Home size={25} strokeWidth={2.4} />
<ToolbarHomeIcon />
</button>
</div>
</div>
@@ -5439,15 +5565,15 @@ function SecondaryToolbar({
</div>
<div className="toolbar-section">
<div className="toolbar-section-label">Combine</div>
<div className="toolbar-section-tools">{rightTools.slice(2, 4).map(renderToolButton)}</div>
<div className="toolbar-section-tools">{rightTools.slice(2, 5).map(renderToolButton)}</div>
</div>
<div className="toolbar-section">
<div className="toolbar-section-label">Modify</div>
<div className="toolbar-section-tools">{rightTools.slice(4, 7).map(renderToolButton)}</div>
<div className="toolbar-section-tools">{rightTools.slice(5, 8).map(renderToolButton)}</div>
</div>
<div className="toolbar-section">
<div className="toolbar-section-label">Arrange</div>
<div className="toolbar-section-tools">{rightTools.slice(7).map(renderToolButton)}</div>
<div className="toolbar-section-tools">{rightTools.slice(8).map(renderToolButton)}</div>
</div>
</div>
<div className="toolbar-section toolbar-actions-section">
+37 -124
View File
@@ -59,125 +59,51 @@ function VectorToolbarSpriteIcon({ rect, className, style }: IconProps & { rect:
);
}
export function GridModeIcon(props: IconProps) {
return (
<svg viewBox="0 0 48 48" aria-hidden="true" {...props}>
<g fill="currentColor">
{[7, 20, 33].map((x) =>
[7, 20, 33].map((y) => <rect key={`${x}-${y}`} x={x} y={y} width="10" height="10" />),
)}
</g>
</svg>
);
}
export function PickaxeModeIcon(props: IconProps) {
return (
<svg viewBox="0 0 48 48" aria-hidden="true" {...props}>
<path d="M12 13c9-5 20-4 29 4l-5 5c-6-5-13-7-21-4z" fill="currentColor" />
<path d="m27 23 10 10c1.5 1.5 1.5 4 0 5.5s-4 1.5-5.5 0l-10-10z" fill="currentColor" />
<path d="m17 27 4-4 4 4-4 4z" fill="currentColor" opacity=".82" />
</svg>
);
}
export function SimLabIcon(props: IconProps) {
return (
<svg viewBox="0 0 48 48" aria-hidden="true" {...props}>
<path
d="M17 22V11a3 3 0 0 1 6 0v10M23 20V9a3 3 0 0 1 6 0v12M29 21v-8a3 3 0 0 1 6 0v13M17 23l-3-3a3 3 0 0 0-4 4l10 13c2 3 5 4 9 4h2c7 0 11-5 11-12v-8"
fill="none"
stroke="currentColor"
strokeWidth="3.5"
strokeLinecap="round"
strokeLinejoin="round"
/>
<path d="M36 8c2 1 4 3 5 5M39 4c3 2 5 5 6 9" fill="none" stroke="currentColor" strokeWidth="2.4" strokeLinecap="round" />
</svg>
);
}
export function BlocksModeIcon(props: IconProps) {
return (
<svg viewBox="0 0 48 48" aria-hidden="true" {...props}>
<path d="M12 17h24v20H12z" fill="currentColor" />
<path d="M17 11h14v6H17z" fill="currentColor" opacity=".92" />
<path d="M16 21h16v4H16zM16 29h16v4H16z" fill="white" opacity=".22" />
</svg>
);
}
type ToolbarCommandImageProps = { file: string; className?: string };
function ToolbarCommandImage({ file, className }: ToolbarCommandImageProps) {
return <img aria-hidden="true" className={["toolbar-command-icon", className].filter(Boolean).join(" ")} src={"/assets/sketchforge/" + file} alt="" draggable={false} />;
const assetClassName = `toolbar-art-${file.replace(/\.png$/i, "")}`;
return <img aria-hidden="true" className={["toolbar-command-icon", assetClassName, className].filter(Boolean).join(" ")} src={"/assets/sketchforge/" + file} alt="" draggable={false} />;
}
export function WorkplaneToolIcon() {
return <ToolbarCommandImage file="toolbar-workplane.png" className="workplane-command-icon" />;
}
export function NotesToolIcon(props: IconProps) {
return (
<svg viewBox="206 0 44 55" aria-hidden="true" {...props}>
<path
fill="currentColor"
d="m228.3 50.6c-1.2 0.8-2.9 0.5-3.3-0.3l-3.3-6.3-0.1-0.1v-0.1l-0.1-0.1v-0.1l-1-2-3.4-0.4c-3-0.1-5.1-2.2-5.1-5.2l-0.5-24.3c0-3 2.4-5.4 5.4-5.6l23.6-1.1c3.2-0.1 5.7 2.3 5.6 5.4l-1.4 27.3c-0.1 3-2.7 5.3-5.6 5l-4.1-0.3-4.6 6.3v0.1h-0.1v0.1l-0.1 0.1-0.9 1.1c-0.2 0.3-0.6 0.3-1 0.5zm0.1-3.6 5.8-7.6 5.1 0.7c1.8 0.2 3.4-1.2 3.5-3.1l1.4-26.7c0.1-2-1.5-3.6-3.6-3.5l-22.9 1.2c-2 0.1-3.5 1.6-3.5 3.5l0.4 23.7c0 1.8 1.4 3.3 3.1 3.4l5.4 0.5 2 4.1v0.1l0.1 0.1v0.1l2.9 5.3 0.3-0.1v-1.7zm-5.8-29.5 13.3-0.2c1 0 1-1.7 0-1.7l-13.3 0.4c-1 0-1 1.6 0 1.5zm0 4.7h12.5c1.1 0 1.1-1.6 0-1.6h-12.5c-1.1 0-1.1 1.6 0 1.6zm0 4.6 13.3 0.5c1.1 0 1.1-1.6 0-1.6l-13.3-0.5c-1.1-0.1-1.1 1.6 0 1.6zm-0.2 4.7 9.1 0.5c1.1 0 1.1-1.6 0-1.7l-9.1-0.5c-1.1 0-1.1 1.7 0 1.7z"
/>
</svg>
);
export function ToolbarHomeIcon() {
return <ToolbarCommandImage file="toolbar-home.png" className="toolbar-user-art-icon" />;
}
export function ToolbarCopyIcon() {
return <ToolbarCommandImage file="toolbar-copy.png" />;
return <ToolbarCommandImage file="toolbar-copy.png" className="toolbar-user-art-icon" />;
}
export function ToolbarPasteIcon(props: IconProps) {
return <ToolbarSpriteIcon rect={{ x: 33.5, y: 6.7, width: 22.9, height: 33.3 }} {...props} />;
export function ToolbarPasteIcon() {
return <ToolbarCommandImage file="toolbar-paste.png" className="toolbar-user-art-icon" />;
}
export function ToolbarDuplicateIcon() {
return <ToolbarCommandImage file="toolbar-duplicate.png" />;
return <ToolbarCommandImage file="toolbar-duplicate.png" className="toolbar-user-art-icon" />;
}
export function ToolbarTrashIcon(props: IconProps) {
return <ToolbarSpriteIcon rect={{ x: 134.2, y: 6.7, width: 21.1, height: 33.3 }} {...props} />;
export function ToolbarTrashIcon() {
return <ToolbarCommandImage file="toolbar-delete.png" className="toolbar-user-art-icon" />;
}
export function ToolbarUndoIcon(props: IconProps) {
return <ToolbarSpriteIcon rect={{ x: 162.9, y: 8, width: 31, height: 30.6 }} {...props} />;
export function ToolbarUndoIcon() {
return <ToolbarCommandImage file="toolbar-undo.png" className="toolbar-user-art-icon" />;
}
export function ToolbarRedoIcon(props: IconProps) {
return <ToolbarSpriteIcon rect={{ x: 196.5, y: 8, width: 31.2, height: 30.6 }} {...props} />;
export function ToolbarRedoIcon() {
return <ToolbarCommandImage file="toolbar-redo.png" className="toolbar-user-art-icon" />;
}
export function ToolbarLightbulbIcon(props: IconProps) {
return (
<svg viewBox="0 0 48 48" aria-hidden="true" {...props}>
<path
d="M17 37h14M19 42h10M16 23c0-5.1 3.8-9 8-9s8 3.9 8 9c0 3.1-1.4 5.3-3.6 7.4-.9.9-1.4 2-1.4 3.3v.3h-6v-.3c0-1.3-.5-2.4-1.4-3.3C17.4 28.3 16 26.1 16 23Z"
fill="none"
stroke="currentColor"
strokeWidth="3.2"
strokeLinecap="round"
strokeLinejoin="round"
/>
<path d="M24 7v3M11 14l2.4 2M37 14l-2.4 2" fill="none" stroke="currentColor" strokeWidth="2.6" strokeLinecap="round" />
</svg>
);
export function ToolbarImportIcon() {
return <ToolbarCommandImage file="toolbar-import.png" className="toolbar-user-art-icon" />;
}
export function ToolbarImportIcon(props: IconProps) {
return <VectorToolbarSpriteIcon rect={{ x: 0, y: 0, width: 24, height: 27 }} {...props} />;
export function ToolbarVectorExportIcon() {
return <ToolbarCommandImage file="toolbar-export.png" className="toolbar-user-art-icon" />;
}
export function ToolbarVectorExportIcon(props: IconProps) {
return <VectorToolbarSpriteIcon rect={{ x: 34, y: 0, width: 25, height: 27 }} {...props} />;
}
export function ToolbarSettingsIcon(props: IconProps) {
return <VectorToolbarSpriteIcon rect={{ x: 66, y: 0, width: 30, height: 27 }} {...props} />;
export function ToolbarSettingsIcon() {
return <ToolbarCommandImage file="toolbar-settings.png" className="toolbar-user-art-icon" />;
}
export function ToolbarShapeAddIcon(props: IconProps) {
@@ -188,14 +114,6 @@ export function ToolbarHideSelectedIcon(props: IconProps) {
return <VectorToolbarSpriteIcon rect={{ x: 138, y: 0, width: 27, height: 27 }} {...props} />;
}
export function ToolbarHoleIcon(props: IconProps) {
return (
<svg viewBox="0 0 48 48" aria-hidden="true" {...props}>
<circle cx="24" cy="24" r="13" fill="none" stroke="currentColor" strokeWidth="3" strokeDasharray="7 5" />
</svg>
);
}
export function ToolbarCaretDownIcon(props: IconProps) {
return (
<svg viewBox="0 0 48 48" aria-hidden="true" {...props}>
@@ -212,41 +130,36 @@ export function ToolbarUngroupIcon() {
return <ToolbarCommandImage file="toolbar-ungroup.png" />;
}
export function ToolbarIntersectionIcon(props: IconProps) {
return (
<svg viewBox="0 0 48 48" aria-hidden="true" {...props}>
<circle cx="19" cy="24" r="13" fill="none" stroke="currentColor" strokeWidth="2.4" />
<circle cx="29" cy="24" r="13" fill="none" stroke="currentColor" strokeWidth="2.4" strokeDasharray="4 3" />
<path d="M24 11.99A13 13 0 0 1 24 36.01A13 13 0 0 1 24 11.99Z" fill="currentColor" opacity="0.82" />
</svg>
);
}
export function ToolbarAlignIcon(props: IconProps) {
return <ToolbarSpriteIcon rect={{ x: 97.3, y: 46.7, width: 29.1, height: 32.5 }} {...props} />;
}
export function ToolbarMirrorIcon(props: IconProps) {
return <ToolbarSpriteIcon rect={{ x: 131.4, y: 46.7, width: 27, height: 32.5 }} {...props} />;
export function ToolbarMirrorIcon() {
return <ToolbarCommandImage file="toolbar-mirror.png" className="toolbar-user-art-icon" />;
}
export function ToolbarSnapGridIcon() {
return <ToolbarCommandImage file="toolbar-snap-grid.png" />;
return <ToolbarCommandImage file="toolbar-snap-grid.png" className="toolbar-user-art-icon" />;
}
export function ToolbarPaintIcon(props: IconProps) {
return (
<svg viewBox="0 0 48 48" aria-hidden="true" {...props}>
<path d="m13 28 16-16 8 8-16 16H13z" fill="currentColor" opacity=".2" />
<path d="m13 28 16-16 8 8-16 16H13zM27 14l7 7M13 36h8" fill="none" stroke="currentColor" strokeWidth="3" strokeLinecap="round" strokeLinejoin="round" />
<path d="M36 31c3 4 4 6 4 8a4 4 0 0 1-8 0c0-2 1-4 4-8Z" fill="currentColor" />
</svg>
);
}
export function ToolbarExportIcon(props: IconProps) {
return (
<svg viewBox="0 0 48 48" aria-hidden="true" {...props}>
<path d="M10 31h28v9H10z" fill="currentColor" opacity=".18" />
<path d="M10 31h28v9H10zM24 8v21M16 21l8 8 8-8M15 35v5M33 35v5" fill="none" stroke="currentColor" strokeWidth="3" strokeLinecap="round" strokeLinejoin="round" />
</svg>
);
export function ToolbarExportIcon() {
return <ToolbarCommandImage file="toolbar-export.png" className="toolbar-user-art-icon" />;
}
export function ToolbarWorkplaneIcon() {
return <ToolbarCommandImage file="toolbar-workplane.png" />;
return <ToolbarCommandImage file="toolbar-workplane.png" className="toolbar-user-art-icon" />;
}
export function ToolbarDropToWorkplaneIcon() {
return <ToolbarCommandImage file="toolbar-drop-workplane.png" />;
return <ToolbarCommandImage file="toolbar-drop-workplane.png" className="toolbar-user-art-icon" />;
}