Skip to content

A lightweight Clip Studio Paint alternative with real-time multiplayer collaborative drawing. Built with Tauri and React.

pre 1.0.1

sora868ccb3254b6
diff --git a/.vscode/extensions.json b/.vscode/extensions.json
deleted file mode 100644
index 24d7cc6..0000000
--- a/.vscode/extensions.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "recommendations": ["tauri-apps.tauri-vscode", "rust-lang.rust-analyzer"]
-}
diff --git a/src/App.tsx b/src/App.tsx
index f004034..799debe 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -345,9 +345,11 @@ export function App() {
layers: layerMgr.layers,
activeLayer: layerMgr.activeLayer,
activeLayerId: layerMgr.activeLayerId,
+ selectedLayerIds: layerMgr.selectedLayerIds,
selection: selectionTools.selection,
layerCanvasesRef: layerMgr.layerCanvasesRef,
layerSourceCanvasesRef: layerMgr.layerSourceCanvasesRef,
+ materializeLayerCanvas: layerMgr.materializeLayerCanvas,
isLayerEffectivelyVisible: layerMgr.isLayerEffectivelyVisible,
getEffectiveOpacity: layerMgr.getEffectiveOpacity,
getActiveCanvas: drawing.getActiveCanvas,
@@ -947,6 +949,7 @@ export function App() {
onConfirmBalloon: shapeFillTools.handleConfirmBalloon,
onDeleteBalloon: shapeFillTools.handleDeleteBalloon,
frameDragPreview: shapeFillTools.frameDragPreview,
+ shapeDragPreview: shapeFillTools.shapeDragPreview,
animationTimeline: activeAnimationTimeline,
onUpdateAnimationTimeline: handleUpdateAnimationTimeline,
onAddAnimationCel: handleAddAnimationCel,
@@ -987,6 +990,7 @@ export function App() {
shapeFillTools.handleConfirmBalloon,
shapeFillTools.handleDeleteBalloon,
shapeFillTools.frameDragPreview,
+ shapeFillTools.shapeDragPreview,
shapeFillTools.handleSampleColor,
handleUndo,
drawing.redo,
diff --git a/src/components/AdjustmentModal.tsx b/src/components/AdjustmentModal.tsx
index c3a5e87..b197e63 100644
--- a/src/components/AdjustmentModal.tsx
+++ b/src/components/AdjustmentModal.tsx
@@ -1,5 +1,5 @@
import React, { useState, useEffect, useRef, useMemo } from 'react';
-import { X, RotateCcw, Check, SlidersHorizontal, Trash2 } from 'lucide-react';
+import { X, Trash2 } from 'lucide-react';
import {
AdjustmentLayerData,
CurvesAdjustmentData,
@@ -442,25 +442,22 @@ export const AdjustmentModal: React.FC<AdjustmentModalProps> = ({
return (
<div className="fixed inset-0 z-50 flex items-center justify-center bg-black/70 backdrop-blur-xs select-none">
- <div className="bg-[#1c1c1c] border border-[#383838] rounded-lg shadow-2xl w-[480px] max-w-[95vw] overflow-hidden flex flex-col text-[#cccccc] text-xs">
+ <div className="bg-[#202020] border border-white/[0.1] rounded-lg shadow-2xl w-[480px] max-w-[95vw] overflow-hidden flex flex-col text-[#e5e5e5] text-xs">
{/* Header */}
- <div className="flex items-center justify-between px-4 py-3 border-b border-[#2d2d2d] bg-[#222222]">
- <div className="flex items-center space-x-2">
- <SlidersHorizontal className="w-4 h-4 text-blue-400" />
- <span className="font-semibold text-white text-sm">
- {editingLayerId ? 'Edit Adjustment Layer' : 'New Adjustment Layer'}
- </span>
- </div>
+ <div className="flex items-center justify-between px-4 py-2.5 border-b border-white/[0.06] bg-[#1a1a1a]">
+ <span className="font-medium text-[#e5e5e5] text-xs">
+ {editingLayerId ? 'Edit Adjustment Layer' : 'New Adjustment Layer'}
+ </span>
<button
onClick={onClose}
- className="p-1 text-[#888888] hover:text-white rounded hover:bg-[#333333] transition-colors"
+ className="p-1 text-[#8a8a8a] hover:text-[#e5e5e5] rounded hover:bg-[#2c2c2c] transition-colors cursor-pointer"
>
- <X className="w-4 h-4" />
+ <X className="w-3.5 h-3.5" />
</button>
</div>
{/* Tab Selector */}
- <div className="flex border-b border-[#2d2d2d] bg-[#1e1e1e] p-1 gap-1">
+ <div className="flex border-b border-white/[0.06] bg-[#161616] p-1 gap-1">
<button
onClick={() => setActiveTab('curves')}
className={`flex-1 py-1.5 px-2 rounded font-medium transition-colors ${
@@ -976,21 +973,19 @@ export const AdjustmentModal: React.FC<AdjustmentModalProps> = ({
</div>
{/* Footer */}
- <div className="flex items-center justify-between px-4 py-3 border-t border-[#2d2d2d] bg-[#202020]">
+ <div className="flex items-center justify-between px-4 py-2.5 border-t border-white/[0.06] bg-[#1a1a1a]">
<div className="flex items-center space-x-3">
<button
onClick={handleResetCurrent}
- className="flex items-center space-x-1 px-2.5 py-1 text-[#888888] hover:text-white hover:bg-[#333333] rounded transition-colors"
+ className="px-2.5 py-1 text-[#8a8a8a] hover:text-[#e5e5e5] hover:bg-[#2c2c2c] rounded transition-colors cursor-pointer"
>
- <RotateCcw className="w-3.5 h-3.5" />
- <span>Reset</span>
+ Reset
</button>
- <label className="flex items-center space-x-1.5 text-xs text-[#888888] cursor-pointer">
+ <label className="flex items-center space-x-1.5 text-xs text-[#8a8a8a] cursor-pointer">
<input
type="checkbox"
checked={previewEnabled}
onChange={(e) => setPreviewEnabled(e.target.checked)}
- className="rounded bg-[#222222] border-[#444444] text-blue-500"
/>
<span>Preview</span>
</label>
@@ -999,16 +994,15 @@ export const AdjustmentModal: React.FC<AdjustmentModalProps> = ({
<div className="flex items-center space-x-2">
<button
onClick={onClose}
- className="px-3 py-1.5 text-xs text-[#aaaaaa] hover:text-white hover:bg-[#333333] rounded transition-colors"
+ className="px-3 py-1.5 text-xs text-[#8a8a8a] hover:text-[#e5e5e5] hover:bg-[#2c2c2c] rounded transition-colors cursor-pointer"
>
Cancel
</button>
<button
onClick={handleApply}
- className="flex items-center space-x-1 px-4 py-1.5 text-xs bg-blue-600 hover:bg-blue-500 text-white font-medium rounded shadow-sm transition-colors"
+ className="px-4 py-1.5 text-xs bg-[var(--accent)] text-[var(--accent-contrast)] hover:opacity-90 font-medium rounded transition-opacity cursor-pointer"
>
- <Check className="w-3.5 h-3.5" />
- <span>{editingLayerId ? 'Update' : 'Create Layer'}</span>
+ {editingLayerId ? 'Update' : 'Create Layer'}
</button>
</div>
</div>
diff --git a/src/components/AnimationTimeline.tsx b/src/components/AnimationTimeline.tsx
index ab25901..6ba5452 100644
--- a/src/components/AnimationTimeline.tsx
+++ b/src/components/AnimationTimeline.tsx
@@ -3,16 +3,10 @@ import {
Play,
Pause,
RotateCcw,
- Plus,
Trash2,
- Download,
ChevronLeft,
ChevronRight,
- Repeat,
- Layers,
- Sparkles,
X,
- Film,
} from 'lucide-react';
import { AnimationTimeline as TimelineData, LayerItem, AnimationExportFormat } from '../types/editor';
import {
@@ -229,16 +223,16 @@ export const AnimationTimeline: React.FC<AnimationTimelineProps> = ({
<div
ref={timelineRootRef}
tabIndex={-1}
- className="absolute inset-x-0 bottom-0 z-40 bg-[#17191e]/95 backdrop-blur-md border-t border-[#2e323b] shadow-2xl flex flex-col select-none text-xs text-gray-300 outline-none"
+ className="absolute inset-x-0 bottom-0 z-40 bg-[#202020]/95 backdrop-blur-md border-t border-white/[0.08] shadow-2xl flex flex-col select-none text-xs text-[#e5e5e5] outline-none"
>
{/* 1. Header & Transport Controls Dock */}
- <div className="flex items-center justify-between px-3 py-1.5 border-b border-[#242730] bg-[#1a1d24]">
+ <div className="flex items-center justify-between px-3 py-1.5 border-b border-white/[0.06] bg-[#1a1a1a]">
{/* Playback Transport */}
<div className="flex items-center space-x-1.5">
<button
type="button"
onClick={() => onChangeTimeline({ ...timeline, currentFrame: 0 })}
- className="p-1 hover:bg-white/10 rounded text-gray-400 hover:text-white"
+ className="p-1 hover:bg-[#2c2c2c] rounded text-[#8a8a8a] hover:text-[#e5e5e5] transition-colors cursor-pointer"
title="First Frame (Home)"
>
<RotateCcw className="w-3.5 h-3.5" />
@@ -251,7 +245,7 @@ export const AnimationTimeline: React.FC<AnimationTimelineProps> = ({
currentFrame: Math.max(0, timeline.currentFrame - 1),
})
}
- className="p-1 hover:bg-white/10 rounded text-gray-400 hover:text-white"
+ className="p-1 hover:bg-[#2c2c2c] rounded text-[#8a8a8a] hover:text-[#e5e5e5] transition-colors cursor-pointer"
title="Previous Frame (Left Arrow)"
>
<ChevronLeft className="w-4 h-4" />
@@ -259,15 +253,15 @@ export const AnimationTimeline: React.FC<AnimationTimelineProps> = ({
<button
type="button"
onClick={() => setIsPlaying(!isPlaying)}
- className={`p-1.5 px-3 rounded font-medium flex items-center space-x-1.5 shadow-md transition-colors ${
+ className={`py-1 px-2.5 rounded font-medium flex items-center space-x-1.5 transition-colors cursor-pointer ${
isPlaying
- ? 'bg-amber-600 hover:bg-amber-500 text-white'
- : 'bg-emerald-600 hover:bg-emerald-500 text-white'
+ ? 'bg-[#2c2c2c] text-[var(--accent)] ring-1 ring-[var(--accent-border)]'
+ : 'bg-[var(--accent)] text-[var(--accent-contrast)] hover:opacity-90'
}`}
title="Play / Pause (Alt+Space)"
>
{isPlaying ? <Pause className="w-3.5 h-3.5" /> : <Play className="w-3.5 h-3.5" />}
- <span className="text-[11px] font-semibold">{isPlaying ? 'Pause' : 'Play'}</span>
+ <span className="text-[11px] font-medium">{isPlaying ? 'Pause' : 'Play'}</span>
</button>
<button
type="button"
@@ -277,7 +271,7 @@ export const AnimationTimeline: React.FC<AnimationTimelineProps> = ({
currentFrame: Math.min(timeline.totalFrames - 1, timeline.currentFrame + 1),
})
}
- className="p-1 hover:bg-white/10 rounded text-gray-400 hover:text-white"
+ className="p-1 hover:bg-[#2c2c2c] rounded text-[#8a8a8a] hover:text-[#e5e5e5] transition-colors cursor-pointer"
title="Next Frame (Right Arrow)"
>
<ChevronRight className="w-4 h-4" />
@@ -287,18 +281,19 @@ export const AnimationTimeline: React.FC<AnimationTimelineProps> = ({
<button
type="button"
onClick={() => onChangeTimeline({ ...timeline, loop: !timeline.loop })}
- className={`p-1 px-2 rounded border border-white/5 flex items-center space-x-1 ${
- timeline.loop ? 'bg-sky-600/30 text-sky-300 ring-1 ring-sky-400' : 'text-gray-400 hover:bg-white/10'
+ className={`px-2 py-1 rounded text-[11px] transition-colors cursor-pointer ${
+ timeline.loop
+ ? 'bg-[var(--accent-subtle)] text-[var(--accent)] ring-1 ring-[var(--accent-border)]'
+ : 'bg-[#161616] text-[#8a8a8a] hover:text-[#e5e5e5] hover:bg-[#2c2c2c]'
}`}
title="Loop Playback"
>
- <Repeat className="w-3 h-3" />
- <span className="text-[10px]">Loop</span>
+ Loop
</button>
{/* Frame Rate FPS Selector */}
- <div className="flex items-center space-x-1 bg-[#22252c] rounded px-2 py-0.5 border border-white/5">
- <span className="text-[10px] text-gray-400 font-mono">FPS:</span>
+ <div className="flex items-center space-x-1 bg-[#161616] rounded px-2 py-0.5 border border-white/[0.06]">
+ <span className="text-[10px] text-[#8a8a8a] font-mono">FPS</span>
<select
value={timeline.fps}
onChange={(e) =>
@@ -307,10 +302,10 @@ export const AnimationTimeline: React.FC<AnimationTimelineProps> = ({
fps: parseInt(e.target.value, 10),
})
}
- className="bg-transparent text-white font-mono text-[11px] outline-none cursor-pointer"
+ className="bg-transparent text-[#e5e5e5] font-mono text-[11px] outline-none cursor-pointer"
>
{[6, 8, 12, 16, 24, 30, 60].map((rate) => (
- <option key={rate} value={rate} className="bg-[#1e2129]">
+ <option key={rate} value={rate} className="bg-[#202020] text-[#e5e5e5]">
{rate} fps
</option>
))}
@@ -318,22 +313,21 @@ export const AnimationTimeline: React.FC<AnimationTimelineProps> = ({
</div>
{/* Frame Ticker Counter */}
- <div className="font-mono text-cyan-400 bg-[#14161b] px-2.5 py-0.5 rounded border border-[#2a2d36] text-[11px] tracking-wider">
+ <div className="font-mono text-[#e5e5e5] bg-[#161616] px-2.5 py-0.5 rounded border border-white/[0.06] text-[11px] tracking-wider">
{String(timeline.currentFrame + 1).padStart(3, '0')} / {String(timeline.totalFrames).padStart(3, '0')}
</div>
</div>
{/* Cel & Onion Skin Tools */}
- <div className="flex items-center space-x-2">
+ <div className="flex items-center space-x-1.5">
{/* Add Cel Button */}
<button
type="button"
onClick={() => onAddCel(timeline.currentFrame)}
- className="flex items-center space-x-1 px-2.5 py-1 bg-blue-600 hover:bg-blue-500 text-white rounded font-medium shadow-sm"
+ className="px-2.5 py-1 bg-[#2c2c2c] hover:bg-[#383838] text-[#e5e5e5] rounded text-[11px] font-medium transition-colors cursor-pointer"
title="Add Cel for Current Frame"
>
- <Plus className="w-3.5 h-3.5" />
- <span className="text-[11px]">Add Cel</span>
+ + Add Cel
</button>
{/* Delete Cel Button */}
@@ -341,7 +335,7 @@ export const AnimationTimeline: React.FC<AnimationTimelineProps> = ({
<button
type="button"
onClick={() => onDeleteCel(timeline.currentFrame)}
- className="p-1 hover:bg-red-500/20 text-gray-400 hover:text-red-400 rounded transition-colors"
+ className="p-1 hover:bg-[#2c2c2c] text-[#8a8a8a] hover:text-rose-400 rounded transition-colors cursor-pointer"
title="Delete Cel from Current Frame"
>
<Trash2 className="w-3.5 h-3.5" />
@@ -353,24 +347,20 @@ export const AnimationTimeline: React.FC<AnimationTimelineProps> = ({
<button
type="button"
onClick={() => setShowOnionSettings(!showOnionSettings)}
- className={`flex items-center space-x-1 px-2 py-1 rounded border border-white/5 transition-colors ${
+ className={`px-2.5 py-1 rounded text-[11px] transition-colors cursor-pointer ${
timeline.onionSkin.enabled
- ? 'bg-purple-600/30 text-purple-300 ring-1 ring-purple-400'
- : 'text-gray-400 hover:bg-white/10'
+ ? 'bg-[var(--accent-subtle)] text-[var(--accent)] ring-1 ring-[var(--accent-border)]'
+ : 'bg-[#161616] text-[#8a8a8a] hover:text-[#e5e5e5] hover:bg-[#2c2c2c]'
}`}
title="Configure Colored Onion Skinning"
>
- <Layers className="w-3.5 h-3.5" />
- <span className="text-[11px]">Onion Skin</span>
+ Onion Skin
</button>
{showOnionSettings && (
- <div className="absolute bottom-full mb-2 right-0 bg-[#1b1e24] border border-purple-500/40 rounded-xl p-3 shadow-2xl z-50 flex flex-col space-y-2.5 w-64">
+ <div className="absolute bottom-full mb-2 right-0 bg-[#202020] border border-white/[0.1] rounded-lg p-3 shadow-2xl z-50 flex flex-col space-y-2.5 w-64">
<div className="flex items-center justify-between">
- <span className="font-semibold text-purple-300 text-xs flex items-center space-x-1">
- <Sparkles className="w-3.5 h-3.5" />
- <span>Colored Onion Skin</span>
- </span>
+ <span className="font-medium text-[#e5e5e5] text-xs">Onion Skin</span>
<label className="flex items-center space-x-1.5 cursor-pointer">
<input
type="checkbox"
@@ -384,15 +374,14 @@ export const AnimationTimeline: React.FC<AnimationTimelineProps> = ({
},
})
}
- className="accent-purple-500"
/>
- <span className="text-[10px] text-gray-300">Enabled</span>
+ <span className="text-[10px] text-[#8a8a8a]">Enabled</span>
</label>
</div>
- {/* Prior Frames Settings (Cyan/Red) */}
- <div className="flex items-center justify-between text-[11px] text-gray-300">
- <span>Prior Frames ({timeline.onionSkin.prevFrames}):</span>
+ {/* Prior Frames Settings */}
+ <div className="flex items-center justify-between text-[11px] text-[#cccccc]">
+ <span>Prior Frames ({timeline.onionSkin.prevFrames})</span>
<div className="flex items-center space-x-2">
<input
type="color"
@@ -422,14 +411,14 @@ export const AnimationTimeline: React.FC<AnimationTimelineProps> = ({
},
})
}
- className="w-16 accent-cyan-400 h-1"
+ className="w-16"
/>
</div>
</div>
- {/* Next Frames Settings (Magenta/Blue) */}
- <div className="flex items-center justify-between text-[11px] text-gray-300">
- <span>Next Frames ({timeline.onionSkin.nextFrames}):</span>
+ {/* Next Frames Settings */}
+ <div className="flex items-center justify-between text-[11px] text-[#cccccc]">
+ <span>Next Frames ({timeline.onionSkin.nextFrames})</span>
<div className="flex items-center space-x-2">
<input
type="color"
@@ -459,14 +448,14 @@ export const AnimationTimeline: React.FC<AnimationTimelineProps> = ({
},
})
}
- className="w-16 accent-pink-500 h-1"
+ className="w-16"
/>
</div>
</div>
{/* Base Opacity */}
- <div className="flex items-center justify-between text-[11px] text-gray-300">
- <span>Base Opacity:</span>
+ <div className="flex items-center justify-between text-[11px] text-[#cccccc]">
+ <span>Opacity</span>
<div className="flex items-center space-x-2">
<input
type="range"
@@ -483,9 +472,9 @@ export const AnimationTimeline: React.FC<AnimationTimelineProps> = ({
},
})
}
- className="w-24 accent-purple-500 h-1"
+ className="w-24"
/>
- <span className="font-mono text-[10px] w-6 text-right">
+ <span className="font-mono text-[10px] w-7 text-right text-[#8a8a8a]">
{Math.round(timeline.onionSkin.opacity * 100)}%
</span>
</div>
@@ -495,8 +484,8 @@ export const AnimationTimeline: React.FC<AnimationTimelineProps> = ({
</div>
{/* Total Frames Adjuster */}
- <div className="flex items-center space-x-1 bg-[#22252c] rounded px-1.5 py-0.5 border border-white/5">
- <span className="text-[10px] text-gray-400">Total:</span>
+ <div className="flex items-center space-x-1 bg-[#161616] rounded px-1.5 py-0.5 border border-white/[0.06]">
+ <span className="text-[10px] text-[#8a8a8a]">Total</span>
<input
type="number"
min="2"
@@ -508,7 +497,7 @@ export const AnimationTimeline: React.FC<AnimationTimelineProps> = ({
totalFrames: Math.max(2, Math.min(240, parseInt(e.target.value, 10) || 24)),
})
}
- className="w-10 bg-transparent font-mono text-white text-center text-[11px] outline-none"
+ className="w-10 bg-transparent font-mono text-[#e5e5e5] text-center text-[11px] outline-none"
/>
</div>
@@ -516,11 +505,10 @@ export const AnimationTimeline: React.FC<AnimationTimelineProps> = ({
<button
type="button"
onClick={() => setShowExportModal(true)}
- className="flex items-center space-x-1 px-2.5 py-1 bg-emerald-600 hover:bg-emerald-500 text-white rounded font-medium shadow-sm"
+ className="px-2.5 py-1 bg-[#2c2c2c] hover:bg-[#383838] text-[#e5e5e5] rounded text-[11px] font-medium transition-colors cursor-pointer"
title="Export Animation"
>
- <Download className="w-3.5 h-3.5" />
- <span className="text-[11px]">Export</span>
+ Export
</button>
{/* Close Timeline */}
@@ -528,7 +516,7 @@ export const AnimationTimeline: React.FC<AnimationTimelineProps> = ({
<button
type="button"
onClick={onClose}
- className="p-1 text-gray-400 hover:text-white hover:bg-white/10 rounded transition-colors"
+ className="p-1 text-[#8a8a8a] hover:text-[#e5e5e5] hover:bg-[#2c2c2c] rounded transition-colors cursor-pointer"
title="Close Timeline Dock"
>
<X className="w-3.5 h-3.5" />
@@ -538,23 +526,23 @@ export const AnimationTimeline: React.FC<AnimationTimelineProps> = ({
</div>
{/* 2. Interactive Scrubber Timeline Track */}
- <div className="px-3 py-2 flex flex-col space-y-1 bg-[#14161b]">
+ <div className="px-3 py-2 flex flex-col space-y-1 bg-[#161616]">
{/* Frame Ruler Numbers */}
<div
ref={scrubberRef}
onPointerDown={handlePointerDown}
- className="relative h-14 bg-[#1b1e25] rounded border border-[#2d313b] cursor-pointer overflow-hidden flex flex-col justify-between"
+ className="relative h-14 bg-[#1a1a1a] rounded border border-white/[0.08] cursor-pointer overflow-hidden flex flex-col justify-between"
>
{/* Top Frame Tick Ruler */}
- <div className="relative h-5 border-b border-[#292c36] bg-[#20242d] flex items-center">
+ <div className="relative h-5 border-b border-white/[0.06] bg-[#202020] flex items-center">
{Array.from({ length: timeline.totalFrames }).map((_, f) => (
<div
key={f}
style={{
width: `${100 / timeline.totalFrames}%`,
}}
- className={`h-full border-r border-[#2d313b] flex items-center justify-center text-[9px] font-mono select-none ${
- f % 5 === 0 ? 'text-gray-300 font-bold' : 'text-gray-500 text-[8px]'
+ className={`h-full border-r border-white/[0.05] flex items-center justify-center text-[9px] font-mono select-none ${
+ f % 5 === 0 ? 'text-[#cccccc] font-semibold' : 'text-[#666666] text-[8px]'
}`}
>
{f % 2 === 0 || timeline.totalFrames <= 24 ? f + 1 : ''}
@@ -574,30 +562,30 @@ export const AnimationTimeline: React.FC<AnimationTimelineProps> = ({
style={{
width: `${100 / timeline.totalFrames}%`,
}}
- className={`h-full border-r border-[#262933] flex items-center justify-center p-0.5 transition-colors ${
- isCurrent ? 'bg-sky-500/10' : ''
+ className={`h-full border-r border-white/[0.04] flex items-center justify-center p-0.5 transition-colors ${
+ isCurrent ? 'bg-[var(--accent-subtle)]' : ''
}`}
>
{hasCel ? (
<div
- className={`w-full h-5 rounded-[2px] flex items-center justify-center text-[9px] font-mono font-medium shadow-sm truncate ${
+ className={`w-full h-5 rounded-[2px] flex items-center justify-center text-[9px] font-mono font-medium truncate ${
isCurrent
- ? 'bg-sky-500 text-white font-bold ring-1 ring-white'
- : 'bg-[#3b4252] text-gray-200 hover:bg-[#434c5e]'
+ ? 'bg-[var(--accent)] text-[var(--accent-contrast)] font-semibold'
+ : 'bg-[#2c2c2c] text-[#cccccc] hover:bg-[#383838]'
}`}
title={`Frame ${f + 1}: Cel Assigned`}
>
- ●
+ <span className="w-1.5 h-1.5 rounded-full bg-current" />
</div>
) : (
- <div className="w-1 h-1 rounded-full bg-gray-600/40" />
+ <div className="w-1 h-1 rounded-full bg-white/15" />
)}
</div>
);
})}
</div>
- {/* Scrub Playhead Red Line */}
+ {/* Scrub Playhead Line */}
<div
className="absolute top-0 bottom-0 pointer-events-none z-20 transition-all duration-75 flex flex-col items-center"
style={{
@@ -605,70 +593,67 @@ export const AnimationTimeline: React.FC<AnimationTimelineProps> = ({
transform: 'translateX(-50%)',
}}
>
- <div className="w-3 h-2 bg-red-500 rounded-b shadow-[0_0_8px_rgba(239,68,68,0.8)]" />
- <div className="w-[2px] h-full bg-red-500" />
+ <div className="w-2.5 h-1.5 bg-red-500 rounded-b" />
+ <div className="w-[1.5px] h-full bg-red-500" />
</div>
</div>
{/* Cel Info Bar */}
- <div className="flex items-center justify-between text-[10px] text-gray-400 px-1">
+ <div className="flex items-center justify-between text-[10px] text-[#8a8a8a] px-1">
<div className="flex items-center space-x-2">
<span>
Active Cel:{' '}
{currentCelLayer ? (
- <span className="text-cyan-400 font-medium font-mono">{currentCelLayer.name}</span>
+ <span className="text-[var(--accent)] font-medium font-mono">{currentCelLayer.name}</span>
) : (
- <span className="text-gray-500 italic">None (Drawing creates new frame cel)</span>
+ <span className="text-[#666666] italic">None (Drawing creates new frame cel)</span>
)}
</span>
</div>
- <div className="flex items-center space-x-3 text-gray-500">
- <span>Click/drag scrubber to navigate</span>
- <span>•</span>
- <span>Space: Play/Pause</span>
- <span>•</span>
- <span>← / →: Prev/Next frame</span>
+ <div className="flex items-center space-x-3 text-[#666666]">
+ <span>Drag scrubber to navigate</span>
+ <span>·</span>
+ <span>Alt+Space: Play/Pause</span>
+ <span>·</span>
+ <span>← / →: Step frame</span>
</div>
</div>
</div>
{/* 3. Export Modal */}
{showExportModal && (
- <div className="fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center">
- <div className="bg-[#1b1e25] border border-white/10 rounded-xl p-5 shadow-2xl w-84 flex flex-col space-y-4">
+ <div className="fixed inset-0 z-50 bg-black/65 backdrop-blur-xs flex items-center justify-center">
+ <div className="bg-[#202020] border border-white/[0.1] rounded-lg p-4 shadow-2xl w-80 flex flex-col space-y-3.5">
<div className="flex items-center justify-between">
- <span className="text-sm font-semibold text-white flex items-center space-x-1.5">
- <Film className="w-4 h-4 text-emerald-400" />
- <span>Export Animation</span>
- </span>
+ <span className="text-xs font-medium text-[#e5e5e5]">Export Animation</span>
<button
type="button"
onClick={() => setShowExportModal(false)}
- className="text-gray-400 hover:text-white"
+ className="p-1 text-[#8a8a8a] hover:text-[#e5e5e5] hover:bg-[#2c2c2c] rounded transition-colors cursor-pointer"
>
- <X className="w-4 h-4" />
+ <X className="w-3.5 h-3.5" />
</button>
</div>
- <div className="flex flex-col space-y-2">
- <label className="text-xs text-gray-300">Format</label>
- <div className="grid grid-cols-2 gap-2 text-xs">
+ <div className="flex flex-col space-y-1.5">
+ <label className="text-[11px] text-[#8a8a8a]">Format</label>
+ <div className="grid grid-cols-2 gap-1.5 text-[11px]">
{(
[
['gif', 'Animated GIF'],
- ['apng', 'Animated PNG (APNG)'],
+ ['apng', 'Animated PNG'],
['webm', 'WebM Video'],
- ['png-zip', 'Numbered PNGs (.zip)'],
+ ['png-zip', 'PNG Sequence (.zip)'],
] as Array<[AnimationExportFormat, string]>
).map(([fmt, label]) => (
<button
key={fmt}
type="button"
onClick={() => setExportFormat(fmt)}
- className={`py-2 px-2.5 rounded text-left border transition-colors ${
+ className={`py-1.5 px-2.5 rounded text-left border transition-colors cursor-pointer ${
exportFormat === fmt
- ? 'bg-emerald-600/30 border-emerald-500 text-white font-medium ring-1 ring-emerald-500'
- : 'bg-[#252831] border-white/5 text-gray-400 hover:bg-white/5'
+ ? 'bg-[var(--accent-subtle)] border-[var(--accent-border)] text-[var(--accent)] font-medium'
+ : 'bg-[#161616] border-white/[0.06] text-[#8a8a8a] hover:text-[#e5e5e5] hover:bg-[#2c2c2c]'
}`}
>
{label}
@@ -677,20 +662,19 @@ export const AnimationTimeline: React.FC<AnimationTimelineProps> = ({
</div>
</div>
- <div className="text-[11px] text-gray-400 space-y-1 bg-[#14161b] p-2.5 rounded border border-white/5 font-mono">
+ <div className="text-[11px] text-[#8a8a8a] space-y-1 bg-[#161616] p-2.5 rounded border border-white/[0.06] font-mono">
<div>Resolution: {dimensions.width} × {dimensions.height} px</div>
<div>Frame Rate: {timeline.fps} FPS</div>
- <div>Total Frames: {timeline.totalFrames} frames</div>
+ <div>Total Frames: {timeline.totalFrames}</div>
</div>
<button
type="button"
onClick={handleExport}
disabled={isExporting}
- className="w-full py-2 bg-emerald-600 hover:bg-emerald-500 text-white font-medium rounded text-xs transition-colors shadow-lg flex items-center justify-center space-x-1.5 disabled:opacity-50"
+ className="w-full py-1.5 bg-[var(--accent)] text-[var(--accent-contrast)] hover:opacity-90 font-medium rounded text-xs transition-opacity disabled:opacity-50 cursor-pointer"
>
- <Download className="w-4 h-4" />
- <span>{isExporting ? exportProgress || 'Exporting...' : 'Start Export'}</span>
+ {isExporting ? exportProgress || 'Exporting...' : 'Start Export'}
</button>
</div>
</div>
diff --git a/src/components/AppShell.tsx b/src/components/AppShell.tsx
index fd15671..02c9e5e 100644
--- a/src/components/AppShell.tsx
+++ b/src/components/AppShell.tsx
@@ -9,6 +9,7 @@ import {
MenuSection,
SpeechBalloon,
TransformSession,
+ ShapeDragPreview,
} from '../types/editor';
import { CollabPeer } from '../types/multiplayer';
import { SparseTileGrid } from '../utils/tileEngine';
@@ -109,6 +110,7 @@ interface CanvasAreaContainerProps {
onConfirmBalloon: () => void;
onDeleteBalloon: () => void;
frameDragPreview?: FrameDragPreview | null;
+ shapeDragPreview?: ShapeDragPreview | null;
animationTimeline: AnimationTimeline | null;
onUpdateAnimationTimeline: (timeline: AnimationTimeline | null) => void;
onAddAnimationCel: (frameIndex: number) => void;
@@ -125,6 +127,7 @@ const CanvasAreaContainer: React.FC<CanvasAreaContainerProps> = React.memo((prop
const brushSettings = useToolStore((s) => s.brushSettings);
const liquifySettings = useToolStore((s) => s.liquifySettings);
const primaryColor = useToolStore((s) => s.primaryColor);
+ const secondaryColor = useToolStore((s) => s.secondaryColor);
const dimensions = useDocumentStore((s) => s.dimensions);
const colorMode = useDocumentStore((s) => s.colorMode);
@@ -270,6 +273,8 @@ const CanvasAreaContainer: React.FC<CanvasAreaContainerProps> = React.memo((prop
onConfirmBalloon={props.onConfirmBalloon}
onDeleteBalloon={props.onDeleteBalloon}
frameDragPreview={props.frameDragPreview}
+ shapeDragPreview={props.shapeDragPreview}
+ secondaryColor={secondaryColor}
animationTimeline={props.animationTimeline}
onUpdateAnimationTimeline={props.onUpdateAnimationTimeline}
onAddAnimationCel={props.onAddAnimationCel}
diff --git a/src/components/BrushSizePalette.tsx b/src/components/BrushSizePalette.tsx
index b4cffe5..6c65d04 100644
--- a/src/components/BrushSizePalette.tsx
+++ b/src/components/BrushSizePalette.tsx
@@ -6,7 +6,6 @@ import {
Square,
Eraser,
RotateCcw,
- Sparkles,
} from 'lucide-react';
import { ToolType } from '../types/editor';
import { ThemePreset } from '../types/settings';
@@ -39,7 +38,6 @@ export const BrushSizePalette: React.FC<BrushSizePaletteProps> = React.memo(({
}) => {
const [showMenu, setShowMenu] = useState(false);
const menuRef = useRef<HTMLDivElement>(null);
- const isVintage = themePreset === 'vintage-manga';
useEffect(() => {
if (!showMenu) return;
@@ -67,26 +65,11 @@ export const BrushSizePalette: React.FC<BrushSizePaletteProps> = React.memo(({
if (presetId === 'square-digital') {
return <Square className="w-3.5 h-3.5 text-teal-400 shrink-0" />;
}
- if (presetId?.startsWith('csp-')) {
- return (
- <Sparkles
- className={`w-3.5 h-3.5 shrink-0 ${
- isVintage ? 'text-[#5ce1e6]' : 'text-[var(--accent)]'
- }`}
- />
- );
- }
- return (
- <Paintbrush
- className={`w-3.5 h-3.5 shrink-0 ${
- isVintage ? 'text-[#5ce1e6]' : 'text-[var(--accent)]'
- }`}
- />
- );
+ return <Paintbrush className="w-3.5 h-3.5 shrink-0 text-[var(--accent)]" />;
};
const renderSizeCircle = (size: number) => {
- const dotClass = isVintage ? 'bg-[#f0f0f4]' : 'bg-[#e5e5e5]';
+ const dotClass = 'bg-[#e5e5e5]';
const smallMap: Array<[number, number]> = [
[0.7, 1.5],
[1, 2],
@@ -152,41 +135,23 @@ export const BrushSizePalette: React.FC<BrushSizePaletteProps> = React.memo(({
<div
data-testid="brush-size-palette"
data-theme-preset={themePreset}
- className={`flex flex-col h-full min-h-0 select-none ${
- isVintage ? 'bg-[#363638] text-[#e5e5e5]' : 'bg-[#202020] text-[#e5e5e5]'
- } ${className}`}
+ className={`flex flex-col h-full min-h-0 select-none bg-[#202020] text-[#e5e5e5] ${className}`}
>
{!hideHeader && (
- <div
- className={`h-7 px-2 flex items-center justify-between shrink-0 relative ${
- isVintage
- ? 'bg-gradient-to-b from-[#464649] to-[#363638] border-b border-[#232325] text-[#f0f0f4]'
- : 'bg-[#1a1a1a] border-b border-white/[0.06] text-[#e5e5e5]'
- }`}
- >
+ <div className="h-7 px-2 flex items-center justify-between shrink-0 relative bg-[#1a1a1a] border-b border-white/[0.06] text-[#e5e5e5]">
<div className="flex items-center space-x-1.5 min-w-0">
<div className="relative" ref={menuRef}>
<button
type="button"
onClick={() => setShowMenu((prev) => !prev)}
title="Brush Size Options"
- className={`p-1 rounded transition-colors cursor-pointer ${
- isVintage
- ? 'text-[#b0b0b6] hover:text-white hover:bg-[#4e4e52]'
- : 'text-[#8a8a8a] hover:text-[#e5e5e5] hover:bg-[#2c2c2c]'
- }`}
+ className="p-1 rounded transition-colors cursor-pointer text-[#8a8a8a] hover:text-[#e5e5e5] hover:bg-[#2c2c2c]"
>
<Menu className="w-3.5 h-3.5" />
</button>
{showMenu && (
- <div
- className={`absolute top-6 left-0 w-44 rounded shadow-xl py-1 z-50 text-[11px] ${
- isVintage
- ? 'bg-[#2b2b2e] border border-[#202022] text-[#e0e0e4]'
- : 'bg-[#1a1a1a] border border-white/[0.1] text-[#cccccc]'
- }`}
- >
+ <div className="absolute top-6 left-0 w-44 rounded shadow-xl py-1 z-50 text-[11px] bg-[#1a1a1a] border border-white/[0.1] text-[#cccccc]">
{onResetSizeToDefault && (
<button
type="button"
@@ -230,13 +195,7 @@ export const BrushSizePalette: React.FC<BrushSizePaletteProps> = React.memo(({
</span>
</div>
- <span
- className={`text-[10px] font-mono px-1.5 py-0.5 rounded shrink-0 ${
- isVintage
- ? 'bg-[#2b2b2e] border border-[#202022] text-[#38bdf8]'
- : 'bg-[#161616] text-[var(--accent)]'
- }`}
- >
+ <span className="text-[10px] font-mono px-1.5 py-0.5 rounded shrink-0 bg-[#161616] text-[var(--accent)]">
{currentSize}px
</span>
</div>
@@ -244,13 +203,7 @@ export const BrushSizePalette: React.FC<BrushSizePaletteProps> = React.memo(({
{/* Responsive CSP-style grid of brush size presets */}
<div className="p-1 flex-1 min-h-0 overflow-y-auto">
- <div
- className={`grid grid-cols-[repeat(auto-fill,minmax(32px,1fr))] border-t border-l ${
- isVintage
- ? 'border-[#252528] bg-[#2a2a2d]'
- : 'border-[#2a2a2a] bg-[#161616]'
- }`}
- >
+ <div className="grid grid-cols-[repeat(auto-fill,minmax(32px,1fr))] border-t border-l border-[#2a2a2a] bg-[#161616]">
{BRUSH_SIZE_PRESETS.map((preset) => {
const isSelected = Math.abs(currentSize - preset) < 0.05;
@@ -263,11 +216,7 @@ export const BrushSizePalette: React.FC<BrushSizePaletteProps> = React.memo(({
aria-pressed={isSelected}
className={`h-10 flex flex-col items-center justify-between py-1 px-0.5 border-r border-b transition-colors cursor-pointer relative ${
isSelected
- ? isVintage
- ? 'bg-[#337bb5] border-[#4e95cf] text-white font-semibold z-10'
- : 'bg-[var(--accent-subtle)] border-[var(--accent-border)] text-[var(--accent)] font-semibold z-10'
- : isVintage
- ? 'bg-[#343437] hover:bg-[#444448] border-[#252528] text-[#b8b8be] hover:text-white'
+ ? 'bg-[var(--accent-subtle)] border-[var(--accent-border)] text-[var(--accent)] font-semibold z-10'
: 'bg-[#202020] hover:bg-[#2c2c2c] border-[#2a2a2a] text-[#8a8a8a] hover:text-[#e5e5e5]'
}`}
>
diff --git a/src/components/CanvasArea.tsx b/src/components/CanvasArea.tsx
index 4e7d678..83e6569 100644
--- a/src/components/CanvasArea.tsx
+++ b/src/components/CanvasArea.tsx
@@ -11,7 +11,9 @@ import {
SpeechBalloon,
SoftProofSettings,
CanvasColorMode,
+ ShapeDragPreview,
} from '../types/editor';
+import { buildShapeSvgPaths, isOpenShape, resolveShapeFillColor } from '../utils/shapeEngine';
import { ROTATE_CURSOR_CSS, CanvasNavigationHandle } from '../hooks/useCanvasNavigation';
import { SelectionOverlay } from './SelectionOverlay';
import { TransformOverlay } from './TransformOverlay';
@@ -128,6 +130,8 @@ interface CanvasAreaProps {
onConfirmBalloon?: () => void;
onDeleteBalloon?: () => void;
frameDragPreview?: { mode: 'create' | 'divide'; start: { x: number; y: number }; end: { x: number; y: number } } | null;
+ shapeDragPreview?: ShapeDragPreview | null;
+ secondaryColor?: string;
animationTimeline?: AnimationTimelineType | null;
onUpdateAnimationTimeline?: (timeline: AnimationTimelineType) => void;
onAddAnimationCel?: (frameIndex: number) => void;
@@ -240,6 +244,8 @@ export const CanvasArea: React.FC<CanvasAreaProps> = React.memo(({
onConfirmBalloon,
onDeleteBalloon,
frameDragPreview = null,
+ shapeDragPreview = null,
+ secondaryColor = '#ffffff',
isHovering: _isHovering,
cursorPos: _cursorPos,
onPointerDown,
@@ -1287,7 +1293,7 @@ export const CanvasArea: React.FC<CanvasAreaProps> = React.memo(({
if (tool === 'text') {
return { cursor: 'text' };
}
- if (tool === 'select-rect' || tool === 'select-lasso' || tool === 'select-wand' || tool === 'fill' || tool === 'frame') {
+ if (tool === 'select-rect' || tool === 'select-lasso' || tool === 'select-wand' || tool === 'fill' || tool === 'frame' || tool === 'shape') {
return { cursor: 'crosshair' };
}
if (tool === 'liquify') {
@@ -1567,6 +1573,78 @@ export const CanvasArea: React.FC<CanvasAreaProps> = React.memo(({
</svg>
)}
+ {/* Live Geometric Shape Placement Preview */}
+ {shapeDragPreview && (() => {
+ const { geom, mainPath, arrowHeadPath } = buildShapeSvgPaths(shapeDragPreview);
+ const s = shapeDragPreview.settings;
+ const open = isOpenShape(s.shape);
+ const strokeColor = primaryColor || '#000000';
+ const fillColor = resolveShapeFillColor(s, strokeColor, secondaryColor);
+ const shouldFill = !open && (s.mode === 'fill' || s.mode === 'both');
+ const shouldStroke = open || s.mode === 'stroke' || s.mode === 'both';
+ const dashArray = s.dashed ? `${Math.max(1, s.dashLength)} ${Math.max(1, s.dashGap)}` : undefined;
+ const invZoom = 1 / Math.max(0.05, liveZoom);
+ const readoutText = open
+ ? `${Math.round(geom.length)}px · ${Math.round(geom.angleDeg)}°`
+ : `${Math.round(geom.width)} × ${Math.round(geom.height)}px`;
+ return (
+ <>
+ <svg
+ className="absolute inset-0 w-full h-full pointer-events-none z-30 overflow-visible"
+ viewBox={`0 0 ${dimensions.width} ${dimensions.height}`}
+ >
+ {mainPath && (
+ <path
+ d={mainPath}
+ fill={shouldFill ? fillColor : 'none'}
+ stroke={shouldStroke ? strokeColor : 'none'}
+ strokeWidth={Math.max(1, s.strokeWidth)}
+ strokeLinecap={s.lineCap}
+ strokeLinejoin={s.lineJoin}
+ strokeDasharray={dashArray}
+ opacity={Math.max(0.05, Math.min(1, s.opacity))}
+ />
+ )}
+ {arrowHeadPath && (
+ <path
+ d={arrowHeadPath}
+ fill="none"
+ stroke={strokeColor}
+ strokeWidth={Math.max(1, s.strokeWidth)}
+ strokeLinecap={s.lineCap}
+ strokeLinejoin={s.lineJoin}
+ opacity={Math.max(0.05, Math.min(1, s.opacity))}
+ />
+ )}
+ {!open && geom.width > 1 && geom.height > 1 && (
+ <rect
+ x={geom.x}
+ y={geom.y}
+ width={geom.width}
+ height={geom.height}
+ fill="none"
+ stroke="#e5e5e5"
+ strokeOpacity={0.55}
+ strokeWidth={1 * invZoom}
+ strokeDasharray={`${4 * invZoom} ${3 * invZoom}`}
+ />
+ )}
+ </svg>
+ <div
+ className="absolute pointer-events-none z-30 px-1.5 py-0.5 rounded bg-[#161616]/90 border border-white/15 text-[#e5e5e5] font-mono text-[10px] whitespace-nowrap"
+ style={{
+ left: `${geom.x2}px`,
+ top: `${geom.y2}px`,
+ transform: `translate(${10 * invZoom}px, ${10 * invZoom}px) scale(${invZoom})`,
+ transformOrigin: 'top left',
+ }}
+ >
+ {readoutText}
+ </div>
+ </>
+ );
+ })()}
+
{/* Local-Only 3D Viewport Ghost Layer (Strictly Client-Side Isolated State) */}
{is3DLayerOpen && onClose3DLayer && onInsertRasterLayer && (
<Local3DContainer
diff --git a/src/components/CommandBar.tsx b/src/components/CommandBar.tsx
index 17fa207..e7bb848 100644
--- a/src/components/CommandBar.tsx
+++ b/src/components/CommandBar.tsx
@@ -185,7 +185,7 @@ interface CommandBarProps {
export const CommandBar: React.FC<CommandBarProps> = React.memo(({
handlers,
- themePreset = 'modern',
+ themePreset: _themePreset = 'modern',
}) => {
const commandBarIds = useWorkspaceStore((s) => s.commandBarIds);
const showCommandBar = useWorkspaceStore((s) => s.showCommandBar);
@@ -197,8 +197,6 @@ export const CommandBar: React.FC<CommandBarProps> = React.memo(({
const customizeRef = useRef<HTMLDivElement>(null);
const presetRef = useRef<HTMLDivElement>(null);
- const isVintage = themePreset === 'vintage-manga';
-
useEffect(() => {
if (!isCustomizeOpen && !isPresetMenuOpen) return;
const handlePointerDown = (e: MouseEvent) => {
@@ -244,13 +242,7 @@ export const CommandBar: React.FC<CommandBarProps> = React.memo(({
>
{/* Customizable Command Buttons */}
{showCommandBar && (
- <div
- className={`flex items-center gap-0.5 px-1 h-6 rounded overflow-x-auto no-scrollbar ${
- isVintage
- ? 'bg-[#2b2b2e] border border-[#202022] shadow-[inset_1px_1px_2px_rgba(0,0,0,0.45)]'
- : 'bg-[#161616]'
- }`}
- >
+ <div className="flex items-center gap-0.5 px-1 h-6 rounded overflow-x-auto no-scrollbar bg-[#161616]">
{commandBarIds.map((cmdId) => {
const entry = catalogById.get(cmdId);
if (!entry) return null;
@@ -270,11 +262,7 @@ export const CommandBar: React.FC<CommandBarProps> = React.memo(({
disabled
? 'opacity-30 cursor-not-allowed text-[#8a8a8a]'
: active
- ? isVintage
- ? 'bg-[#337bb5] text-white cursor-pointer'
- : 'bg-[#2c2c2c] text-[var(--accent)] cursor-pointer'
- : isVintage
- ? 'text-[#c0c0c6] hover:text-white hover:bg-[#444448] cursor-pointer'
+ ? 'bg-[#2c2c2c] text-[var(--accent)] cursor-pointer'
: 'text-[#8a8a8a] hover:text-[#e5e5e5] hover:bg-[#2c2c2c] cursor-pointer'
}`}
>
@@ -303,13 +291,7 @@ export const CommandBar: React.FC<CommandBarProps> = React.memo(({
</button>
{isCustomizeOpen && (
- <div
- className={`fixed top-9 left-1/2 -translate-x-1/2 w-64 rounded-md shadow-2xl p-2 z-50 text-[11px] ${
- isVintage
- ? 'bg-[#333336] border border-[#202022] text-[#e5e5e5]'
- : 'bg-[#202020] border border-white/[0.1] text-[#e5e5e5]'
- }`}
- >
+ <div className="fixed top-9 left-1/2 -translate-x-1/2 w-64 rounded-md shadow-2xl p-2 z-50 text-[11px] bg-[#202020] border border-white/[0.1] text-[#e5e5e5]">
<div className="flex items-center justify-between pb-1.5 mb-1.5 border-b border-white/[0.08]">
<span className="font-medium text-xs">Command Bar</span>
<button
@@ -416,11 +398,7 @@ export const CommandBar: React.FC<CommandBarProps> = React.memo(({
}}
data-testid="workspace-preset-trigger"
title="Workspace Presets & Layout"
- className={`h-6 px-2 rounded flex items-center gap-1 text-[11px] transition-colors cursor-pointer ${
- isVintage
- ? 'bg-gradient-to-b from-[#4e4e52] to-[#3a3a3d] border border-[#242426] text-[#e5e5e5] hover:brightness-110'
- : 'bg-[#161616] hover:bg-[#2c2c2c] text-[#cccccc] hover:text-white'
- }`}
+ className="h-6 px-2 rounded flex items-center gap-1 text-[11px] transition-colors cursor-pointer bg-[#161616] hover:bg-[#2c2c2c] text-[#cccccc] hover:text-white"
>
<LayoutGrid className="w-3 h-3 text-[var(--accent)]" />
<span className="hidden xl:inline max-w-[116px] truncate">
@@ -432,11 +410,7 @@ export const CommandBar: React.FC<CommandBarProps> = React.memo(({
{isPresetMenuOpen && (
<div
data-testid="workspace-preset-menu"
- className={`absolute top-7 right-0 w-52 rounded-md shadow-2xl p-1 z-50 text-[11px] ${
- isVintage
- ? 'bg-[#333336] border border-[#202022] text-[#e5e5e5]'
- : 'bg-[#202020] border border-white/[0.1] text-[#e5e5e5]'
- }`}
+ className="absolute top-7 right-0 w-52 rounded-md shadow-2xl p-1 z-50 text-[11px] bg-[#202020] border border-white/[0.1] text-[#e5e5e5]"
>
<div className="px-2 py-1 text-[10px] uppercase tracking-wider text-[#8a8a8a]">
Workspace Presets
diff --git a/src/components/CrashRecoveryModal.tsx b/src/components/CrashRecoveryModal.tsx
index edc86cb..f6d64b8 100644
--- a/src/components/CrashRecoveryModal.tsx
+++ b/src/components/CrashRecoveryModal.tsx
@@ -3,14 +3,8 @@ import {
RotateCcw,
Trash2,
AlertTriangle,
- Layers,
- Calendar,
- Maximize2,
- Cpu,
FileText,
- Clock,
- Sparkles,
- ShieldCheck,
+ Layers,
} from 'lucide-react';
import { CrashedSessionInfo } from '../services/recoveryService';
@@ -84,23 +78,22 @@ export const CrashRecoveryModal: React.FC<CrashRecoveryModalProps> = ({
aria-labelledby="crash-recovery-title"
className="fixed inset-0 z-50 flex items-center justify-center bg-black/80 backdrop-blur-xs p-4 select-none animate-in fade-in duration-150"
>
- <div className="bg-[#242426] border border-[#3c3c40] rounded-xl shadow-2xl w-full max-w-2xl flex flex-col overflow-hidden text-xs text-[#d0d0d0]">
+ <div className="bg-[#202020] border border-white/[0.1] rounded-lg shadow-2xl w-full max-w-2xl flex flex-col overflow-hidden text-xs text-[#e5e5e5]">
{/* Header Bar */}
- <div className="flex items-center justify-between px-6 py-4 bg-[#2a2a2d] border-b border-[#38383a]">
+ <div className="flex items-center justify-between px-5 py-3.5 bg-[#1a1a1a] border-b border-white/[0.06]">
<div className="flex items-center space-x-3">
- <div className="w-8 h-8 rounded-lg bg-amber-500/15 border border-amber-500/30 flex items-center justify-center text-amber-400">
+ <div className="w-7 h-7 rounded-md bg-[#2c2c2c] flex items-center justify-center text-amber-400">
<AlertTriangle className="w-4 h-4" />
</div>
<div>
- <h2 id="crash-recovery-title" className="text-sm font-semibold text-white tracking-wide flex items-center gap-2">
+ <h2 id="crash-recovery-title" className="text-sm font-medium text-[#e5e5e5] flex items-center gap-2">
Restore Unsaved Session?
- <span className="px-2 py-0.5 rounded-full text-[10px] font-medium bg-emerald-500/15 text-emerald-400 border border-emerald-500/30 flex items-center gap-1">
- <ShieldCheck className="w-3 h-3" />
+ <span className="px-2 py-0.5 rounded text-[10px] font-medium bg-[#161616] text-[var(--accent)] border border-[var(--accent-border)]">
WAL Protected
</span>
</h2>
- <p className="text-[11px] text-[#999999] mt-0.5">
- Ink Studio detected an unexpected application shutdown. Your progress can be restored with zero data loss.
+ <p className="text-[11px] text-[#8a8a8a] mt-0.5">
+ Ink Studio detected an unexpected shutdown. Your progress can be restored.
</p>
</div>
</div>
@@ -169,54 +162,36 @@ export const CrashRecoveryModal: React.FC<CrashRecoveryModalProps> = ({
</div>
<div className="grid grid-cols-2 gap-2 text-xs">
- <div className="bg-[#242427] border border-[#323236] rounded p-2 flex items-center gap-2">
- <Maximize2 className="w-3.5 h-3.5 text-sky-400 shrink-0" />
- <div>
- <span className="text-[10px] text-[#888888] block">Canvas Size</span>
- <span className="font-semibold text-white">{width} × {height}</span>
- </div>
+ <div className="bg-[#161616] border border-white/[0.06] rounded p-2">
+ <span className="text-[10px] text-[#8a8a8a] block">Canvas Size</span>
+ <span className="font-medium text-[#e5e5e5]">{width} × {height}</span>
</div>
- <div className="bg-[#242427] border border-[#323236] rounded p-2 flex items-center gap-2">
- <Sparkles className="w-3.5 h-3.5 text-amber-400 shrink-0" />
- <div>
- <span className="text-[10px] text-[#888888] block">Resolution</span>
- <span className="font-semibold text-white">{dpi} DPI</span>
- </div>
+ <div className="bg-[#161616] border border-white/[0.06] rounded p-2">
+ <span className="text-[10px] text-[#8a8a8a] block">Resolution</span>
+ <span className="font-medium text-[#e5e5e5]">{dpi} DPI</span>
</div>
- <div className="bg-[#242427] border border-[#323236] rounded p-2 flex items-center gap-2">
- <Layers className="w-3.5 h-3.5 text-purple-400 shrink-0" />
- <div>
- <span className="text-[10px] text-[#888888] block">Layer Tree</span>
- <span className="font-semibold text-white">{layerCount} {layerCount === 1 ? 'Layer' : 'Layers'}</span>
- </div>
+ <div className="bg-[#161616] border border-white/[0.06] rounded p-2">
+ <span className="text-[10px] text-[#8a8a8a] block">Layer Tree</span>
+ <span className="font-medium text-[#e5e5e5]">{layerCount} {layerCount === 1 ? 'Layer' : 'Layers'}</span>
</div>
- <div className="bg-[#242427] border border-[#323236] rounded p-2 flex items-center gap-2">
- <Cpu className="w-3.5 h-3.5 text-emerald-400 shrink-0" />
- <div>
- <span className="text-[10px] text-[#888888] block">Color Expression</span>
- <span className="font-semibold text-white capitalize">{colorMode}</span>
- </div>
+ <div className="bg-[#161616] border border-white/[0.06] rounded p-2">
+ <span className="text-[10px] text-[#8a8a8a] block">Color Mode</span>
+ <span className="font-medium text-[#e5e5e5] capitalize">{colorMode}</span>
</div>
</div>
{/* Timestamp & Process Info */}
- <div className="bg-[#202022] border border-[#2d2d30] rounded p-2 text-[11px] space-y-1">
- <div className="flex items-center justify-between text-[#888888]">
- <span className="flex items-center gap-1.5">
- <Clock className="w-3 h-3 text-[#999999]" />
- Terminated At:
- </span>
- <span className="text-white font-mono">{crashDate}</span>
+ <div className="bg-[#161616] border border-white/[0.06] rounded p-2 text-[11px] space-y-1">
+ <div className="flex items-center justify-between text-[#8a8a8a]">
+ <span>Terminated At</span>
+ <span className="text-[#e5e5e5] font-mono">{crashDate}</span>
</div>
- <div className="flex items-center justify-between text-[#888888]">
- <span className="flex items-center gap-1.5">
- <Calendar className="w-3 h-3 text-[#999999]" />
- Previous PID:
- </span>
- <span className="text-[#aaaaaa] font-mono">{currentSession.pid}</span>
+ <div className="flex items-center justify-between text-[#8a8a8a]">
+ <span>Previous PID</span>
+ <span className="text-[#cccccc] font-mono">{currentSession.pid}</span>
</div>
</div>
</div>
diff --git a/src/components/Csp3DToolbar.tsx b/src/components/Csp3DToolbar.tsx
index 881a297..f61016d 100644
--- a/src/components/Csp3DToolbar.tsx
+++ b/src/components/Csp3DToolbar.tsx
@@ -1,4 +1,5 @@
import React, { useRef, useCallback, useState, useEffect } from 'react';
+import { X } from 'lucide-react';
import { LTConversionSettings } from '../types/editor';
export type Csp3DToolMode =
@@ -15,21 +16,31 @@ interface Csp3DToolbarProps {
activeMode: Csp3DToolMode;
onSelectMode: (mode: Csp3DToolMode) => void;
onDirectDrag: (mode: Csp3DToolMode, deltaX: number, deltaY: number, e: PointerEvent) => void;
- onSnapToGround: () => void;
- onResetModelTransform: () => void;
onExtractLineAndTone?: (settings: LTConversionSettings) => void;
isExtracting?: boolean;
+ hasModel?: boolean;
modelName?: string;
}
+const CAMERA_MODES: Array<{ mode: Csp3DToolMode; label: string; title: string }> = [
+ { mode: 'camera-orbit', label: 'Orbit', title: 'Orbit camera around model (click or drag)' },
+ { mode: 'camera-pan', label: 'Pan', title: 'Pan camera in screen plane (click or drag)' },
+ { mode: 'camera-zoom', label: 'Zoom', title: 'Zoom camera distance (click or drag)' },
+];
+
+const MODEL_MODES: Array<{ mode: Csp3DToolMode; label: string; title: string }> = [
+ { mode: 'model-move', label: 'Move', title: 'Move model in view plane (click or drag)' },
+ { mode: 'model-rotate-free', label: 'Rotate', title: 'Rotate model freely (click or drag)' },
+ { mode: 'model-plane-move', label: 'Floor', title: 'Slide model along floor plane (click or drag)' },
+];
+
export const Csp3DToolbar: React.FC<Csp3DToolbarProps> = ({
activeMode,
onSelectMode,
onDirectDrag,
- onSnapToGround,
- onResetModelTransform,
onExtractLineAndTone,
isExtracting = false,
+ hasModel = false,
modelName = 'Model',
}) => {
const [showLTDialog, setShowLTDialog] = useState(false);
@@ -42,10 +53,9 @@ export const Csp3DToolbar: React.FC<Csp3DToolbarProps> = ({
const defaultFolderName = `3D Extraction [${cleanModelName}]`;
useEffect(() => {
- if (!folderName) {
- setFolderName(defaultFolderName);
- }
- }, [defaultFolderName, folderName]);
+ setFolderName(defaultFolderName);
+ }, [defaultFolderName]);
+
const dragRef = useRef<{
mode: Csp3DToolMode;
startX: number;
@@ -61,7 +71,11 @@ export const Csp3DToolbar: React.FC<Csp3DToolbarProps> = ({
e.stopPropagation();
const target = e.currentTarget;
- target.setPointerCapture(e.pointerId);
+ try {
+ target.setPointerCapture(e.pointerId);
+ } catch {
+ // ignore
+ }
dragRef.current = {
mode,
@@ -77,7 +91,9 @@ export const Csp3DToolbar: React.FC<Csp3DToolbarProps> = ({
const dx = ev.clientX - dragRef.current.lastX;
const dy = ev.clientY - dragRef.current.lastY;
- if (Math.hypot(ev.clientX - dragRef.current.startX, ev.clientY - dragRef.current.startY) > 3) {
+ if (
+ Math.hypot(ev.clientX - dragRef.current.startX, ev.clientY - dragRef.current.startY) > 3
+ ) {
dragRef.current.hasDragged = true;
}
@@ -114,287 +130,86 @@ export const Csp3DToolbar: React.FC<Csp3DToolbarProps> = ({
return (
<div
- className="flex items-center space-x-0.5 bg-[#1b1e24]/95 border border-[#3b82f6]/40 rounded-lg p-1 shadow-2xl backdrop-blur-md select-none text-sky-400"
+ className="flex items-center gap-1.5 select-none"
onPointerDown={(e) => e.stopPropagation()}
>
- {/* 1. Camera Orbit */}
- <button
- type="button"
- onPointerDown={(e) => handlePointerDown('camera-orbit', e)}
- title="Orbit Camera: Click to select, or drag to rotate view around model"
- className={`p-1.5 rounded transition-all flex items-center justify-center ${
- activeMode === 'camera-orbit'
- ? 'bg-blue-600/30 text-sky-300 ring-1 ring-sky-400 shadow-sm'
- : 'text-sky-400/80 hover:text-sky-200 hover:bg-white/10'
- }`}
- >
- <svg viewBox="0 0 24 24" className="w-5 h-5" fill="none" stroke="currentColor" strokeWidth="1.75">
- {/* Camera body */}
- <rect x="7" y="8" width="11" height="9" rx="1.5" stroke="currentColor" />
- <polygon points="18,10.5 22,8.5 22,16.5 18,14.5" fill="currentColor" stroke="none" />
- {/* Curved orbit arrow around camera */}
- <path d="M12 4 C6.5 4, 3 8, 3 13 C3 16.5 5 19.5 8 21" strokeLinecap="round" />
- <polyline points="5 21 8 21 8 18" strokeLinecap="round" strokeLinejoin="round" />
- </svg>
- </button>
-
- {/* 2. Camera Pan */}
- <button
- type="button"
- onPointerDown={(e) => handlePointerDown('camera-pan', e)}
- title="Pan Camera: Click to select, or drag to move camera in screen plane"
- className={`p-1.5 rounded transition-all flex items-center justify-center ${
- activeMode === 'camera-pan'
- ? 'bg-blue-600/30 text-sky-300 ring-1 ring-sky-400 shadow-sm'
- : 'text-sky-400/80 hover:text-sky-200 hover:bg-white/10'
- }`}
- >
- <svg viewBox="0 0 24 24" className="w-5 h-5" fill="none" stroke="currentColor" strokeWidth="1.75">
- {/* Camera center */}
- <rect x="8.5" y="8.5" width="7" height="6.5" rx="1" stroke="currentColor" />
- {/* 4-way arrows */}
- <path d="M12 2 v4 M12 22 v-4 M2 12 h4 M22 12 h-4" strokeLinecap="round" />
- <polyline points="10 4 12 2 14 4" strokeLinecap="round" strokeLinejoin="round" />
- <polyline points="10 20 12 22 14 20" strokeLinecap="round" strokeLinejoin="round" />
- <polyline points="4 10 2 12 4 14" strokeLinecap="round" strokeLinejoin="round" />
- <polyline points="20 10 22 12 20 14" strokeLinecap="round" strokeLinejoin="round" />
- </svg>
- </button>
-
- {/* 3. Camera Distance / Zoom */}
- <button
- type="button"
- onPointerDown={(e) => handlePointerDown('camera-zoom', e)}
- title="Camera Zoom: Click to select, or drag up/down to zoom in/out"
- className={`p-1.5 rounded transition-all flex items-center justify-center ${
- activeMode === 'camera-zoom'
- ? 'bg-blue-600/30 text-sky-300 ring-1 ring-sky-400 shadow-sm'
- : 'text-sky-400/80 hover:text-sky-200 hover:bg-white/10'
- }`}
- >
- <svg viewBox="0 0 24 24" className="w-5 h-5" fill="none" stroke="currentColor" strokeWidth="1.75">
- {/* Vertical bidirectional dolly arrows beside camera */}
- <path d="M5 4 v16" strokeLinecap="round" />
- <polyline points="3 6 5 4 7 6" strokeLinecap="round" strokeLinejoin="round" />
- <polyline points="3 18 5 20 7 18" strokeLinecap="round" strokeLinejoin="round" />
- {/* Camera */}
- <rect x="10" y="8" width="9" height="8" rx="1.5" stroke="currentColor" />
- <polygon points="19,10 23,8 23,16 19,14" fill="currentColor" stroke="none" />
- </svg>
- </button>
-
- <div className="w-[1px] h-5 bg-white/15 mx-0.5" />
-
- {/* 4. Model Translate (Move in 3D View Plane) */}
- <button
- type="button"
- onPointerDown={(e) => handlePointerDown('model-move', e)}
- title="Move Model: Click to select, or drag to move 3D model up/down/left/right"
- className={`p-1.5 rounded transition-all flex items-center justify-center ${
- activeMode === 'model-move'
- ? 'bg-blue-600/30 text-sky-300 ring-1 ring-sky-400 shadow-sm'
- : 'text-sky-400/80 hover:text-sky-200 hover:bg-white/10'
- }`}
- >
- <svg viewBox="0 0 24 24" className="w-5 h-5" fill="none" stroke="currentColor" strokeWidth="1.75">
- {/* Isometric Cube in center */}
- <path d="M12 7.5 L16.5 10 L12 12.5 L7.5 10 Z" stroke="currentColor" strokeLinejoin="round" />
- <path d="M7.5 10 v4.5 L12 17 v-4.5" stroke="currentColor" strokeLinejoin="round" />
- <path d="M16.5 10 v4.5 L12 17" stroke="currentColor" strokeLinejoin="round" />
- {/* 4-way translation arrows */}
- <path d="M12 2.5 v3 M12 21.5 v-3 M2.5 12 h3 M21.5 12 h-3" strokeLinecap="round" />
- <polyline points="10 4 12 2 14 4" strokeLinecap="round" strokeLinejoin="round" />
- <polyline points="10 20 12 22 14 20" strokeLinecap="round" strokeLinejoin="round" />
- <polyline points="4 10 2 12 4 14" strokeLinecap="round" strokeLinejoin="round" />
- <polyline points="20 10 22 12 20 14" strokeLinecap="round" strokeLinejoin="round" />
- </svg>
- </button>
-
- {/* 5. Model Free Rotate (Pitch & Yaw) */}
- <button
- type="button"
- onPointerDown={(e) => handlePointerDown('model-rotate-free', e)}
- title="Free Rotate Model: Click to select, or drag to freely rotate 3D model in any direction"
- className={`p-1.5 rounded transition-all flex items-center justify-center ${
- activeMode === 'model-rotate-free'
- ? 'bg-blue-600/30 text-sky-300 ring-1 ring-sky-400 shadow-sm'
- : 'text-sky-400/80 hover:text-sky-200 hover:bg-white/10'
- }`}
- >
- <svg viewBox="0 0 24 24" className="w-5 h-5" fill="none" stroke="currentColor" strokeWidth="1.75">
- {/* Central Cube */}
- <path d="M12 8 L15.5 10 L12 12 L8.5 10 Z" stroke="currentColor" strokeLinejoin="round" />
- <path d="M8.5 10 v4 L12 16 v-4" stroke="currentColor" strokeLinejoin="round" />
- <path d="M15.5 10 v4 L12 16" stroke="currentColor" strokeLinejoin="round" />
- {/* Spherical rotation arrows circling the cube */}
- <path d="M12 3 C17 3, 21 7, 21 12 C21 16.5 17.5 20.2 13 20.9" strokeLinecap="round" />
- <polyline points="15 22 12 21 14 18" strokeLinecap="round" strokeLinejoin="round" />
- <path d="M6 5.5 C4 7.2 3 9.5 3 12 C3 14.5 4 17 6 18.5" strokeLinecap="round" strokeDasharray="1 2.5" />
- </svg>
- </button>
-
- {/* 6. Model Yaw (Horizontal Tilt / Turn) */}
- <button
- type="button"
- onPointerDown={(e) => handlePointerDown('model-rotate-yaw', e)}
- title="Rotate Model Horizontally: Click to select, or drag horizontally to turn model on vertical axis"
- className={`p-1.5 rounded transition-all flex items-center justify-center ${
- activeMode === 'model-rotate-yaw'
- ? 'bg-blue-600/30 text-sky-300 ring-1 ring-sky-400 shadow-sm'
- : 'text-sky-400/80 hover:text-sky-200 hover:bg-white/10'
- }`}
- >
- <svg viewBox="0 0 24 24" className="w-5 h-5" fill="none" stroke="currentColor" strokeWidth="1.75">
- {/* Cube */}
- <path d="M12 8.5 L16 10.5 L12 12.5 L8 10.5 Z" stroke="currentColor" strokeLinejoin="round" />
- <path d="M8 10.5 v4.5 L12 17.5 v-5" stroke="currentColor" strokeLinejoin="round" />
- <path d="M16 10.5 v4.5 L12 17.5" stroke="currentColor" strokeLinejoin="round" />
- {/* Top horizontal curved arrow */}
- <path d="M4 5 C8 3, 16 3, 20 5" strokeLinecap="round" />
- <polyline points="18 3 21 5 19 7.5" strokeLinecap="round" strokeLinejoin="round" />
- <polyline points="6 3 3 5 5 7.5" strokeLinecap="round" strokeLinejoin="round" />
- </svg>
- </button>
-
- {/* 7. Model Roll / Ground Tilt */}
- <button
- type="button"
- onPointerDown={(e) => handlePointerDown('model-rotate-roll', e)}
- title="Roll Model: Click to select, or drag to roll model along screen/ground axis"
- className={`p-1.5 rounded transition-all flex items-center justify-center ${
- activeMode === 'model-rotate-roll'
- ? 'bg-blue-600/30 text-sky-300 ring-1 ring-sky-400 shadow-sm'
- : 'text-sky-400/80 hover:text-sky-200 hover:bg-white/10'
- }`}
- >
- <svg viewBox="0 0 24 24" className="w-5 h-5" fill="none" stroke="currentColor" strokeWidth="1.75">
- {/* Perspective floor diamond */}
- <polygon points="12,14.5 20,18.5 12,22 4,18.5" stroke="currentColor" strokeWidth="1.2" opacity="0.6" />
- {/* Cube resting on plane */}
- <path d="M12 7 L15.5 9 L12 11 L8.5 9 Z" stroke="currentColor" strokeLinejoin="round" />
- <path d="M8.5 9 v4 L12 15 v-4" stroke="currentColor" strokeLinejoin="round" />
- <path d="M15.5 9 v4 L12 15" stroke="currentColor" strokeLinejoin="round" />
- {/* Circular roll arrow curving over plane */}
- <path d="M5 13 C4 10, 6 6, 12 5 C17 5, 20 8, 20 12" strokeLinecap="round" />
- <polyline points="18 10 20 12 22 10" strokeLinecap="round" strokeLinejoin="round" />
- </svg>
- </button>
-
- {/* 8. Model Plane Move (Move across ground plane) */}
- <button
- type="button"
- onPointerDown={(e) => handlePointerDown('model-plane-move', e)}
- title="Move on Ground Plane: Click to select, or drag to slide model along floor plane"
- className={`p-1.5 rounded transition-all flex items-center justify-center ${
- activeMode === 'model-plane-move'
- ? 'bg-blue-600/30 text-sky-300 ring-1 ring-sky-400 shadow-sm'
- : 'text-sky-400/80 hover:text-sky-200 hover:bg-white/10'
- }`}
- >
- <svg viewBox="0 0 24 24" className="w-5 h-5" fill="none" stroke="currentColor" strokeWidth="1.75">
- {/* Ground floor grid diamond */}
- <polygon points="12,13 21,17.5 12,22 3,17.5" stroke="currentColor" strokeWidth="1.2" opacity="0.6" />
- {/* Cross planar arrows on the ground */}
- <path d="M7 16 L17 19.5 M17 16 L7 19.5" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" />
- {/* Cube */}
- <path d="M12 5 L15.5 7 L12 9 L8.5 7 Z" stroke="currentColor" strokeLinejoin="round" />
- <path d="M8.5 7 v3.5 L12 12.5 v-3.5" stroke="currentColor" strokeLinejoin="round" />
- <path d="M15.5 7 v3.5 L12 12.5" stroke="currentColor" strokeLinejoin="round" />
- </svg>
- </button>
-
- {/* 9. Magnet: Snap to Ground Plane (Clip Studio Paint style) */}
- <button
- type="button"
- onClick={onSnapToGround}
- title="Snap Model to Ground: Instantly drops model flush to floor plane"
- className="p-1.5 rounded transition-all flex items-center justify-center text-cyan-400/90 hover:text-cyan-200 hover:bg-cyan-500/20 active:scale-95"
- >
- <svg viewBox="0 0 24 24" className="w-5 h-5" fill="none" stroke="currentColor" strokeWidth="1.75">
- {/* Magnet U shape */}
- <path
- d="M6 3 v7 C6 14, 9 17, 12 17 C15 17, 18 14, 18 10 v-7"
- stroke="currentColor"
- strokeLinecap="round"
- />
- {/* Pole tips */}
- <line x1="4.5" y1="6" x2="7.5" y2="6" stroke="currentColor" strokeWidth="2" />
- <line x1="16.5" y1="6" x2="19.5" y2="6" stroke="currentColor" strokeWidth="2" />
- {/* Ground surface and bolt */}
- <line x1="3" y1="21" x2="21" y2="21" stroke="currentColor" strokeWidth="2" strokeLinecap="round" />
- <polyline points="10 14 12 19 14 14" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" />
- </svg>
- </button>
+ {/* Camera Mode Group */}
+ <div className="flex items-center bg-[#161616] rounded p-0.5 border border-white/[0.06]">
+ <span className="px-1.5 text-[10px] text-[#666666] font-medium">Cam</span>
+ {CAMERA_MODES.map((item) => (
+ <button
+ key={item.mode}
+ type="button"
+ onPointerDown={(e) => handlePointerDown(item.mode, e)}
+ title={item.title}
+ className={`px-2 py-0.5 rounded text-[11px] transition-colors cursor-pointer ${
+ activeMode === item.mode
+ ? 'bg-[var(--accent)] text-[var(--accent-contrast)] font-medium'
+ : 'text-[#8a8a8a] hover:text-[#e5e5e5] hover:bg-[#2c2c2c]'
+ }`}
+ >
+ {item.label}
+ </button>
+ ))}
+ </div>
- <div className="w-[1px] h-5 bg-white/15 mx-0.5" />
+ {/* Model Mode Group */}
+ <div className="flex items-center bg-[#161616] rounded p-0.5 border border-white/[0.06]">
+ <span className="px-1.5 text-[10px] text-[#666666] font-medium">Obj</span>
+ {MODEL_MODES.map((item) => (
+ <button
+ key={item.mode}
+ type="button"
+ onPointerDown={(e) => handlePointerDown(item.mode, e)}
+ title={item.title}
+ className={`px-2 py-0.5 rounded text-[11px] transition-colors cursor-pointer ${
+ activeMode === item.mode
+ ? 'bg-[var(--accent)] text-[var(--accent-contrast)] font-medium'
+ : 'text-[#8a8a8a] hover:text-[#e5e5e5] hover:bg-[#2c2c2c]'
+ }`}
+ >
+ {item.label}
+ </button>
+ ))}
+ </div>
- {/* 10. Extract Line & Tone (LT Conversion) */}
+ {/* Unified Line & Tone (LT Conversion) Popover */}
<div className="relative">
<button
type="button"
- onClick={() => {
- if (!folderName) {
- setFolderName(defaultFolderName);
- }
- setShowLTDialog((prev) => !prev);
- }}
- disabled={isExtracting}
- title="Extract Line & Tone (LT Conversion of 3D Data)"
- className={`p-1.5 px-2 rounded transition-all flex items-center space-x-1.5 text-xs font-medium ${
+ onClick={() => setShowLTDialog((prev) => !prev)}
+ disabled={isExtracting || !hasModel}
+ title="Extract Lineart and Screentones from 3D Model"
+ className={`px-2.5 py-1 rounded text-[11px] font-medium transition-colors cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed ${
showLTDialog
- ? 'bg-purple-600/40 text-purple-200 ring-1 ring-purple-400 shadow-sm'
- : 'text-purple-300 hover:text-white hover:bg-purple-600/30'
- } disabled:opacity-50 disabled:cursor-not-allowed`}
+ ? 'bg-[var(--accent-subtle)] text-[var(--accent)] ring-1 ring-[var(--accent-border)]'
+ : 'bg-[#2c2c2c] text-[#e5e5e5] hover:bg-[#383838]'
+ }`}
>
- <svg viewBox="0 0 24 24" className="w-4 h-4" fill="none" stroke="currentColor" strokeWidth="1.75">
- {/* Outline box */}
- <rect x="3" y="3" width="18" height="18" rx="2" stroke="currentColor" />
- {/* Diagonal line divider */}
- <line x1="3" y1="21" x2="21" y2="3" stroke="currentColor" strokeWidth="1.5" />
- {/* Screentone dots on lower half */}
- <circle cx="8" cy="16" r="1" fill="currentColor" />
- <circle cx="12" cy="16" r="1" fill="currentColor" />
- <circle cx="16" cy="16" r="1" fill="currentColor" />
- <circle cx="10" cy="19" r="1" fill="currentColor" />
- <circle cx="14" cy="19" r="1" fill="currentColor" />
- {/* Upper contour line */}
- <path d="M7 8 Q12 5 17 8" stroke="currentColor" strokeWidth="1.5" fill="none" />
- </svg>
- <span className="text-[11px] font-medium tracking-wide">LT</span>
+ Line & Tone
</button>
- {/* LT Conversion Configuration Dialog */}
{showLTDialog && (
<div
- className="absolute top-full mt-2 left-1/2 -translate-x-1/2 w-72 bg-[#181b22]/98 backdrop-blur-xl border border-purple-500/50 rounded-xl p-3.5 shadow-2xl z-50 text-gray-200 select-none"
+ className="absolute top-full mt-2 right-0 w-72 bg-[#202020] border border-white/[0.1] rounded-lg p-3.5 shadow-2xl z-50 text-[#e5e5e5] select-none"
onPointerDown={(e) => e.stopPropagation()}
>
- {/* Modal Header */}
- <div className="flex items-center justify-between pb-2 border-b border-white/10">
- <div className="flex items-center space-x-1.5">
- <span className="w-2 h-2 rounded-full bg-purple-400 animate-pulse" />
- <span className="text-xs font-semibold text-purple-200 tracking-wide">
- LT Conversion (Line & Tone)
- </span>
- </div>
+ <div className="flex items-center justify-between pb-2 border-b border-white/[0.06]">
+ <span className="text-xs font-medium text-[#e5e5e5]">Line & Tone Extraction</span>
<button
type="button"
onClick={() => setShowLTDialog(false)}
- className="text-gray-400 hover:text-white p-0.5 rounded hover:bg-white/10"
+ className="text-[#8a8a8a] hover:text-[#e5e5e5] p-0.5 rounded hover:bg-[#2c2c2c] cursor-pointer"
>
- <svg viewBox="0 0 24 24" className="w-4 h-4" fill="none" stroke="currentColor" strokeWidth="2">
- <line x1="18" y1="6" x2="6" y2="18" />
- <line x1="6" y1="6" x2="18" y2="18" />
- </svg>
+ <X className="w-3.5 h-3.5" />
</button>
</div>
- {/* Edge Detection Sensitivity: Line Width & Threshold */}
<div className="mt-3 space-y-2.5">
<div className="space-y-1">
<div className="flex justify-between text-[11px]">
- <span className="text-gray-300 font-medium">Line Width</span>
- <span className="font-mono text-purple-300 font-bold">{lineWidth} px</span>
+ <span className="text-[#8a8a8a]">Line Width</span>
+ <span className="font-mono text-[#e5e5e5]">{lineWidth} px</span>
</div>
<input
type="range"
@@ -403,14 +218,14 @@ export const Csp3DToolbar: React.FC<Csp3DToolbarProps> = ({
step="1"
value={lineWidth}
onChange={(e) => setLineWidth(parseInt(e.target.value, 10))}
- className="w-full accent-purple-500 cursor-pointer h-1.5 bg-gray-700 rounded-lg"
+ className="w-full"
/>
</div>
<div className="space-y-1">
<div className="flex justify-between text-[11px]">
- <span className="text-gray-300 font-medium">Line Sensitivity (Threshold)</span>
- <span className="font-mono text-purple-300 font-bold">
+ <span className="text-[#8a8a8a]">Edge Sensitivity</span>
+ <span className="font-mono text-[#e5e5e5]">
{Math.round((1 - lineThreshold) * 100)}%
</span>
</div>
@@ -421,16 +236,15 @@ export const Csp3DToolbar: React.FC<Csp3DToolbarProps> = ({
step="0.01"
value={lineThreshold}
onChange={(e) => setLineThreshold(parseFloat(e.target.value))}
- className="w-full accent-purple-500 cursor-pointer h-1.5 bg-gray-700 rounded-lg"
+ className="w-full"
/>
</div>
</div>
- {/* Shading Tone Count: 1 to 4 Layers */}
<div className="mt-3 space-y-1.5">
<div className="flex justify-between text-[11px]">
- <span className="text-gray-300 font-medium">Shading Tone Count</span>
- <span className="text-[10px] text-gray-400 font-mono">60 LPI Screentone</span>
+ <span className="text-[#8a8a8a]">Screentone Bands</span>
+ <span className="text-[10px] text-[#666666] font-mono">60 LPI</span>
</div>
<div className="grid grid-cols-4 gap-1">
{([1, 2, 3, 4] as const).map((count) => (
@@ -438,44 +252,40 @@ export const Csp3DToolbar: React.FC<Csp3DToolbarProps> = ({
key={count}
type="button"
onClick={() => setToneCount(count)}
- className={`py-1 rounded text-[11px] font-medium transition-all ${
+ className={`py-1 rounded text-[11px] transition-colors cursor-pointer ${
toneCount === count
- ? 'bg-purple-600 text-white shadow-sm ring-1 ring-purple-300'
- : 'bg-white/5 text-gray-300 hover:bg-white/10 hover:text-white'
+ ? 'bg-[var(--accent)] text-[var(--accent-contrast)] font-medium'
+ : 'bg-[#161616] text-[#8a8a8a] hover:text-[#e5e5e5] hover:bg-[#2c2c2c]'
}`}
>
- {count} {count === 1 ? 'Tone' : 'Tones'}
+ {count}
</button>
))}
</div>
- <p className="text-[10px] text-gray-400 font-mono mt-0.5">
- {toneCount === 1 && 'Deep Shadow (45% density)'}
- {toneCount === 2 && 'Light (20%) + Deep Shadow (45%)'}
+ <p className="text-[10px] text-[#8a8a8a] font-mono">
+ {toneCount === 1 && 'Deep Shadow (45%)'}
+ {toneCount === 2 && 'Light (20%) + Deep (45%)'}
{toneCount === 3 && 'Light (15%) + Mid (30%) + Deep (50%)'}
- {toneCount === 4 && 'Light (10%) + Mid-L (25%) + Mid-D (40%) + Deep (55%)'}
+ {toneCount === 4 && '4-step gradation (10% - 55%)'}
</p>
</div>
- {/* Target Output Folder */}
<div className="mt-3 space-y-1">
- <label className="text-[11px] text-gray-300 font-medium block">
- Target Output Folder
- </label>
+ <label className="text-[11px] text-[#8a8a8a] block">Output Folder</label>
<input
type="text"
value={folderName}
onChange={(e) => setFolderName(e.target.value)}
placeholder={defaultFolderName}
- className="w-full px-2.5 py-1 text-xs bg-[#111317] border border-white/15 focus:border-purple-500 rounded text-gray-200 outline-none font-mono"
+ className="w-full px-2 py-1 text-xs bg-[#161616] border border-white/[0.08] rounded text-[#e5e5e5] font-mono"
/>
</div>
- {/* Action Buttons */}
- <div className="mt-4 flex items-center space-x-2">
+ <div className="mt-3.5 flex items-center space-x-2">
<button
type="button"
onClick={() => setShowLTDialog(false)}
- className="flex-1 py-1.5 rounded text-xs text-gray-400 hover:text-white hover:bg-white/10 transition-colors"
+ className="flex-1 py-1.5 rounded text-xs text-[#8a8a8a] hover:text-[#e5e5e5] hover:bg-[#2c2c2c] transition-colors cursor-pointer"
>
Cancel
</button>
@@ -491,26 +301,14 @@ export const Csp3DToolbar: React.FC<Csp3DToolbarProps> = ({
});
setShowLTDialog(false);
}}
- className="flex-1 py-1.5 bg-gradient-to-r from-purple-600 to-indigo-600 hover:from-purple-500 hover:to-indigo-500 text-white font-semibold rounded text-xs transition-all shadow-lg flex items-center justify-center space-x-1 disabled:opacity-50"
+ className="flex-1 py-1.5 bg-[var(--accent)] text-[var(--accent-contrast)] hover:opacity-90 font-medium rounded text-xs transition-opacity disabled:opacity-50 cursor-pointer"
>
- <span>{isExtracting ? 'Extracting...' : 'Extract LT'}</span>
+ {isExtracting ? 'Extracting...' : 'Extract'}
</button>
</div>
</div>
)}
</div>
-
- <div className="w-[1px] h-5 bg-white/15 mx-0.5" />
-
- {/* Reset Model Orientation */}
- <button
- type="button"
- onClick={onResetModelTransform}
- title="Reset Model: Center model and reset all rotations"
- className="p-1.5 rounded transition-all flex items-center justify-center text-gray-400 hover:text-white hover:bg-white/10 text-[10px] font-mono px-2"
- >
- Reset
- </button>
</div>
);
};
diff --git a/src/components/DockWorkspace.tsx b/src/components/DockWorkspace.tsx
index ebb4a21..f248c02 100644
--- a/src/components/DockWorkspace.tsx
+++ b/src/components/DockWorkspace.tsx
@@ -198,7 +198,7 @@ const DockGroupView: React.FC<DockGroupViewProps> = React.memo(({
side,
col,
group,
- themePreset,
+ themePreset: _themePreset,
draggingPanelId,
onStartDragPanel,
onEndDragPanel,
@@ -207,7 +207,6 @@ const DockGroupView: React.FC<DockGroupViewProps> = React.memo(({
const [menuOpen, setMenuOpen] = useState(false);
const [isDragOverTab, setIsDragOverTab] = useState(false);
const menuRef = useRef<HTMLDivElement>(null);
- const isVintage = themePreset === 'vintage-manga';
useEffect(() => {
if (!menuOpen) return;
@@ -249,9 +248,7 @@ const DockGroupView: React.FC<DockGroupViewProps> = React.memo(({
<div
data-testid={`dock-group-${group.id}`}
style={{ flexGrow: group.heightRatio, flexBasis: 0 }}
- className={`flex flex-col min-h-[72px] overflow-hidden ${
- isVintage ? 'bg-[#363638]' : 'bg-[#202020]'
- }`}
+ className="flex flex-col min-h-[72px] overflow-hidden bg-[#202020]"
>
{/* Palette Tab Header Bar (Draggable!) */}
<div
@@ -265,8 +262,6 @@ const DockGroupView: React.FC<DockGroupViewProps> = React.memo(({
className={`h-6 flex items-center justify-between px-1 shrink-0 select-none relative transition-colors ${
isDragOverTab
? 'bg-[var(--accent-subtle)] ring-1 ring-inset ring-[var(--accent)]'
- : isVintage
- ? 'bg-gradient-to-b from-[#49494d] to-[#3a3a3d] border-b border-[#232325]'
: 'bg-[#1a1a1a] border-b border-white/[0.06]'
}`}
>
@@ -291,11 +286,7 @@ const DockGroupView: React.FC<DockGroupViewProps> = React.memo(({
title={`${meta.title} — Drag tab to move palette`}
className={`h-5 px-1.5 rounded-sm flex items-center gap-1 text-[10px] transition-colors shrink-0 cursor-grab active:cursor-grabbing ${
isActive
- ? isVintage
- ? 'bg-[#337bb5] text-white font-medium'
- : 'bg-[#2c2c2c] text-[#e5e5e5] font-medium'
- : isVintage
- ? 'text-[#b0b0b6] hover:text-white hover:bg-[#4e4e52]'
+ ? 'bg-[#2c2c2c] text-[#e5e5e5] font-medium'
: 'text-[#8a8a8a] hover:text-[#e5e5e5] hover:bg-[#262626]'
}`}
>
@@ -327,11 +318,7 @@ const DockGroupView: React.FC<DockGroupViewProps> = React.memo(({
<div
className={`absolute top-6 ${
side === 'left' ? 'left-0' : 'right-0'
- } w-44 rounded-md shadow-2xl p-1 z-50 text-[11px] ${
- isVintage
- ? 'bg-[#333336] border border-[#202022] text-[#e5e5e5]'
- : 'bg-[#202020] border border-white/[0.1] text-[#e5e5e5]'
- }`}
+ } w-44 rounded-md shadow-2xl p-1 z-50 text-[11px] bg-[#202020] border border-white/[0.1] text-[#e5e5e5]`}
>
<div className="px-2 py-0.5 text-[10px] text-[#8a8a8a] truncate">
{DOCK_PANEL_META[activePanelId].title}
@@ -448,7 +435,6 @@ const DockColumnView: React.FC<DockColumnViewProps> = React.memo(({
const openPopover = useWorkspaceStore((s) => s.openPopover);
const colRef = useRef<HTMLDivElement>(null);
const [dragOverSplitIdx, setDragOverSplitIdx] = useState<number | null>(null);
- const isVintage = themePreset === 'vintage-manga';
const activePopoverPanelId =
col.collapsed && openPopover?.colId === col.id ? openPopover.panelId : null;
@@ -531,11 +517,7 @@ const DockColumnView: React.FC<DockColumnViewProps> = React.memo(({
<div
data-testid={`dock-column-${col.id}`}
data-collapsed="true"
- className={`relative w-[30px] h-full flex flex-col items-center py-1 gap-1 shrink-0 select-none z-20 ${
- isVintage
- ? 'bg-[#333336] border-x border-[#232325]'
- : 'bg-[#1c1c1c] border-x border-white/[0.04]'
- }`}
+ className="relative w-[30px] h-full flex flex-col items-center py-1 gap-1 shrink-0 select-none z-20 bg-[#1c1c1c] border-x border-white/[0.04]"
>
{/* Expand Column Button */}
<button
@@ -576,9 +558,7 @@ const DockColumnView: React.FC<DockColumnViewProps> = React.memo(({
aria-pressed={isOpen}
className={`relative w-6 h-7 rounded flex items-center justify-center transition-colors cursor-pointer shrink-0 ${
isOpen
- ? isVintage
- ? 'bg-[#337bb5] text-white'
- : 'bg-[#2c2c2c] text-[var(--accent)]'
+ ? 'bg-[#2c2c2c] text-[var(--accent)]'
: 'text-[#8a8a8a] hover:text-[#e5e5e5] hover:bg-[#2c2c2c]'
}`}
>
@@ -587,7 +567,7 @@ const DockColumnView: React.FC<DockColumnViewProps> = React.memo(({
className={`absolute top-1 bottom-1 w-[2px] rounded-full ${
side === 'left' ? 'left-0' : 'right-0'
}`}
- style={{ backgroundColor: isVintage ? '#38bdf8' : 'var(--accent)' }}
+ style={{ backgroundColor: 'var(--accent)' }}
/>
)}
{renderPanelIcon(pid, 'w-3.5 h-3.5')}
@@ -601,21 +581,11 @@ const DockColumnView: React.FC<DockColumnViewProps> = React.memo(({
<div
data-testid={`dock-popover-${activePopoverPanelId}`}
style={{ width: popoverWidth }}
- className={`absolute top-1 bottom-1 z-40 flex flex-col rounded-md shadow-[0_12px_36px_rgba(0,0,0,0.75)] overflow-hidden ${
+ className={`absolute top-1 bottom-1 z-40 flex flex-col rounded-md shadow-[0_12px_36px_rgba(0,0,0,0.75)] overflow-hidden bg-[#202020] border border-white/[0.12] ${
side === 'left' ? 'left-[32px]' : 'right-[32px]'
- } ${
- isVintage
- ? 'bg-[#363638] border border-[#202022]'
- : 'bg-[#202020] border border-white/[0.12]'
}`}
>
- <div
- className={`h-7 px-2 flex items-center justify-between shrink-0 ${
- isVintage
- ? 'bg-gradient-to-b from-[#49494d] to-[#3a3a3d] border-b border-[#232325]'
- : 'bg-[#1a1a1a] border-b border-white/[0.08]'
- }`}
- >
+ <div className="h-7 px-2 flex items-center justify-between shrink-0 bg-[#1a1a1a] border-b border-white/[0.08]">
<div className="flex items-center gap-1.5 min-w-0">
{renderPanelIcon(activePopoverPanelId, 'w-3.5 h-3.5 text-[var(--accent)]')}
<span className="text-[11px] font-medium text-[#e5e5e5] truncate">
@@ -661,18 +631,12 @@ const DockColumnView: React.FC<DockColumnViewProps> = React.memo(({
data-testid={`dock-column-${col.id}`}
data-collapsed="false"
style={{ width: col.width }}
- className={`relative h-full flex flex-col shrink-0 overflow-hidden z-10 ${
- isVintage ? 'bg-[#262628]' : 'bg-[#161616]'
- }`}
+ className="relative h-full flex flex-col shrink-0 overflow-hidden z-10 bg-[#161616]"
>
{/* Slim CSP Column Collapse Bar */}
<div
- className={`h-4 px-1 flex items-center shrink-0 ${
+ className={`h-4 px-1 flex items-center shrink-0 bg-[#181818] border-b border-white/[0.04] ${
side === 'left' ? 'justify-end' : 'justify-start'
- } ${
- isVintage
- ? 'bg-[#2e2e31] border-b border-[#202022]'
- : 'bg-[#181818] border-b border-white/[0.04]'
}`}
>
<button
@@ -723,11 +687,7 @@ const DockColumnView: React.FC<DockColumnViewProps> = React.memo(({
<div
onPointerDown={(e) => handleStartGroupSplitResize(e, grp, col.groups[idx + 1])}
title="Drag to resize stacked palettes"
- className={`h-1 shrink-0 cursor-row-resize transition-colors ${
- isVintage
- ? 'bg-[#232325] hover:bg-[#38bdf8]/60'
- : 'bg-[#161616] hover:bg-[var(--accent)]/50'
- }`}
+ className="h-1 shrink-0 cursor-row-resize transition-colors bg-[#161616] hover:bg-[var(--accent)]/50"
/>
)}
</React.Fragment>
@@ -789,8 +749,6 @@ export const DockWorkspace: React.FC<DockWorkspaceProps> = React.memo(({
const [edgeDropSide, setEdgeDropSide] = useState<DockSide | null>(null);
const workspaceRef = useRef<HTMLDivElement>(null);
- const isVintage = themePreset === 'vintage-manga';
-
// Close collapsed-strip popover on Escape or outside click on canvas
useEffect(() => {
if (!openPopover) return;
@@ -930,9 +888,7 @@ export const DockWorkspace: React.FC<DockWorkspaceProps> = React.memo(({
ref={workspaceRef}
data-testid="dock-workspace"
data-palettes-hidden={String(palettesHidden)}
- className={`flex flex-1 min-h-0 overflow-hidden relative gap-px ${
- isVintage ? 'bg-[#232325]' : 'bg-[#161616]'
- }`}
+ className="flex flex-1 min-h-0 overflow-hidden relative gap-px bg-[#161616]"
>
{/* Left Dock Zone */}
{!palettesHidden && (
diff --git a/src/components/DocumentTabBar.tsx b/src/components/DocumentTabBar.tsx
index 93f0629..7e1bb4a 100644
--- a/src/components/DocumentTabBar.tsx
+++ b/src/components/DocumentTabBar.tsx
@@ -20,7 +20,7 @@ export const DocumentTabBar: React.FC<DocumentTabBarProps> = React.memo(({
onCloseDocument,
onNewDocument,
onRenameDocument,
- themePreset = 'modern',
+ themePreset: _themePreset = 'modern',
}) => {
const [editingId, setEditingId] = useState<string | null>(null);
const [editingName, setEditingName] = useState<string>('');
@@ -38,110 +38,13 @@ export const DocumentTabBar: React.FC<DocumentTabBarProps> = React.memo(({
setEditingId(null);
};
- if (themePreset === 'modern') {
- return (
- <div
- data-testid="document-tab-bar"
- data-theme-preset="modern"
- className="h-7 flex items-center px-1.5 select-none z-20 shrink-0 overflow-x-auto no-scrollbar bg-[#1a1a1a] border-b border-white/[0.06]"
- >
- <div className="flex items-center space-x-1 h-full py-0.5">
- {documents.map((doc) => {
- const isActive = doc.id === activeDocumentId;
- const isDirty = Boolean(doc.isDirty);
-
- return (
- <div
- key={doc.id}
- onClick={() => onSelectDocument(doc.id)}
- onDoubleClick={(e) => handleStartRename(e, doc)}
- title={`${doc.name}${isDirty ? ' *' : ''} (${doc.dimensions.width}×${doc.dimensions.height}px)`}
- className={`group relative h-full flex items-center space-x-1.5 px-2.5 rounded text-[11px] cursor-pointer transition-colors ${
- isActive
- ? 'bg-[#262626] text-[#e5e5e5] font-medium border border-white/[0.08]'
- : 'text-[#8a8a8a] hover:text-[#e5e5e5] hover:bg-[#2c2c2c]/60 border border-transparent'
- }`}
- >
- <File
- className={`w-3 h-3 shrink-0 ${
- isActive ? 'text-[var(--accent)]' : 'text-[#666666]'
- }`}
- />
-
- {editingId === doc.id ? (
- <input
- type="text"
- value={editingName}
- onChange={(e) => setEditingName(e.target.value)}
- onBlur={() => handleFinishRename(doc.id)}
- onKeyDown={(e) => {
- if (e.key === 'Enter') handleFinishRename(doc.id);
- if (e.key === 'Escape') setEditingId(null);
- }}
- autoFocus
- onClick={(e) => e.stopPropagation()}
- className="bg-[#161616] text-[#e5e5e5] text-[11px] px-1 py-0.5 rounded-sm outline-none border border-[var(--accent)] w-28"
- />
- ) : (
- <span className="truncate max-w-[160px] tracking-normal">
- {doc.name}
- {isDirty && (
- <span
- data-testid={`dirty-indicator-${doc.id}`}
- className="ml-0.5 text-[var(--accent)] font-bold"
- title="Unsaved changes"
- >
- *
- </span>
- )}
- </span>
- )}
-
- <button
- type="button"
- onClick={(e) => {
- e.stopPropagation();
- onCloseDocument(doc.id);
- }}
- aria-label={`Close ${doc.name}`}
- title="Close file"
- className={`p-0.5 rounded transition-colors cursor-pointer ${
- isActive
- ? 'text-[#8a8a8a] hover:text-[#e5e5e5] hover:bg-white/10'
- : 'text-transparent group-hover:text-[#8a8a8a] hover:!text-[#e5e5e5] hover:bg-white/10'
- }`}
- >
- <X className="w-3 h-3" />
- </button>
-
- {isActive && (
- <div className="absolute bottom-0 left-2 right-2 h-[2px] bg-[var(--accent)] rounded-full" />
- )}
- </div>
- );
- })}
- </div>
-
- <button
- type="button"
- onClick={onNewDocument}
- aria-label="New Document"
- title="Create New File (Ctrl+N)"
- className="ml-1 p-1 rounded transition-colors flex items-center justify-center shrink-0 cursor-pointer text-[#8a8a8a] hover:text-[#e5e5e5] hover:bg-[#2c2c2c]"
- >
- <Plus className="w-3.5 h-3.5" />
- </button>
- </div>
- );
- }
-
return (
<div
data-testid="document-tab-bar"
- data-theme-preset="vintage-manga"
- className="h-7 flex items-center px-2 select-none z-20 shrink-0 overflow-x-auto no-scrollbar transition-colors bg-[#333336] border-b border-[#232325]"
+ data-theme-preset="modern"
+ className="h-7 flex items-center px-1.5 select-none z-20 shrink-0 overflow-x-auto no-scrollbar bg-[#1a1a1a] border-b border-white/[0.06]"
>
- <div className="flex items-center space-x-1 h-full">
+ <div className="flex items-center space-x-1 h-full py-0.5">
{documents.map((doc) => {
const isActive = doc.id === activeDocumentId;
const isDirty = Boolean(doc.isDirty);
@@ -152,14 +55,16 @@ export const DocumentTabBar: React.FC<DocumentTabBarProps> = React.memo(({
onClick={() => onSelectDocument(doc.id)}
onDoubleClick={(e) => handleStartRename(e, doc)}
title={`${doc.name}${isDirty ? ' *' : ''} (${doc.dimensions.width}×${doc.dimensions.height}px)`}
- className={`group relative h-full flex items-center space-x-1.5 px-2.5 text-[11px] cursor-pointer transition-colors ${
+ className={`group relative h-full flex items-center space-x-1.5 px-2.5 rounded text-[11px] cursor-pointer transition-colors ${
isActive
- ? 'bg-gradient-to-b from-[#56565a] to-[#464649] text-white font-medium border-t border-l border-r border-[#242426] shadow-[inset_0_1px_0_rgba(255,255,255,0.22)]'
- : 'bg-gradient-to-b from-[#424245] to-[#363638] text-[#aaaaae] hover:text-[#d0d0d5] border border-[#272729]'
+ ? 'bg-[#262626] text-[#e5e5e5] font-medium border border-white/[0.08]'
+ : 'text-[#8a8a8a] hover:text-[#e5e5e5] hover:bg-[#2c2c2c]/60 border border-transparent'
}`}
>
<File
- className={`w-3 h-3 shrink-0 ${isActive ? 'text-[#38bdf8]' : 'text-[#77777d]'}`}
+ className={`w-3 h-3 shrink-0 ${
+ isActive ? 'text-[var(--accent)]' : 'text-[#666666]'
+ }`}
/>
{editingId === doc.id ? (
@@ -174,15 +79,15 @@ export const DocumentTabBar: React.FC<DocumentTabBarProps> = React.memo(({
}}
autoFocus
onClick={(e) => e.stopPropagation()}
- className="bg-[#242426] text-white text-[11px] px-1.5 py-0.5 rounded-none outline-none border border-[#38bdf8] w-28"
+ className="bg-[#161616] text-[#e5e5e5] text-[11px] px-1 py-0.5 rounded-sm outline-none border border-[var(--accent)] w-28"
/>
) : (
- <span className="truncate max-w-[160px] tracking-wide">
+ <span className="truncate max-w-[160px] tracking-normal">
{doc.name}
{isDirty && (
<span
data-testid={`dirty-indicator-${doc.id}`}
- className="ml-0.5 text-amber-300 font-bold"
+ className="ml-0.5 text-[var(--accent)] font-bold"
title="Unsaved changes"
>
*
@@ -199,17 +104,17 @@ export const DocumentTabBar: React.FC<DocumentTabBarProps> = React.memo(({
}}
aria-label={`Close ${doc.name}`}
title="Close file"
- className={`p-0.5 rounded-xs transition-colors cursor-pointer ${
+ className={`p-0.5 rounded transition-colors cursor-pointer ${
isActive
- ? 'text-[#aaaaae] hover:text-white hover:bg-[#343438]'
- : 'text-transparent group-hover:text-[#aaaaae] hover:!text-white hover:bg-[#2c2c30]'
+ ? 'text-[#8a8a8a] hover:text-[#e5e5e5] hover:bg-white/10'
+ : 'text-transparent group-hover:text-[#8a8a8a] hover:!text-[#e5e5e5] hover:bg-white/10'
}`}
>
<X className="w-3 h-3" />
</button>
{isActive && (
- <div className="absolute bottom-0 left-0 right-0 h-[2px] bg-[#337bb5]" />
+ <div className="absolute bottom-0 left-2 right-2 h-[2px] bg-[var(--accent)] rounded-full" />
)}
</div>
);
@@ -221,9 +126,9 @@ export const DocumentTabBar: React.FC<DocumentTabBarProps> = React.memo(({
onClick={onNewDocument}
aria-label="New Document"
title="Create New File (Ctrl+N)"
- className="ml-1.5 p-1 rounded-[2px] transition-colors flex items-center justify-center shrink-0 cursor-pointer bg-gradient-to-b from-[#4e4e52] to-[#3a3a3d] border border-[#272729] text-[#aaaaae] hover:text-white shadow-[inset_0_1px_0_rgba(255,255,255,0.18)] active:brightness-90"
+ className="ml-1 p-1 rounded transition-colors flex items-center justify-center shrink-0 cursor-pointer text-[#8a8a8a] hover:text-[#e5e5e5] hover:bg-[#2c2c2c]"
>
- <Plus className="w-3 h-3" />
+ <Plus className="w-3.5 h-3.5" />
</button>
</div>
);
diff --git a/src/components/GlobalShortcutListener.tsx b/src/components/GlobalShortcutListener.tsx
index 8723fb7..a86d4e2 100644
--- a/src/components/GlobalShortcutListener.tsx
+++ b/src/components/GlobalShortcutListener.tsx
@@ -182,6 +182,12 @@ export const GlobalShortcutListener: React.FC<GlobalShortcutListenerProps> = Rea
Math.min(500, Math.round(stepBrushSizePreset(toolState.liquifySettings.size, dir)))
);
toolStoreActions.updateLiquifySettings({ size: nextSize });
+ } else if (toolState.tool === 'shape') {
+ const nextWidth = Math.max(
+ 1,
+ Math.min(120, Math.round(stepBrushSizePreset(toolState.shapeSettings.strokeWidth, dir)))
+ );
+ toolStoreActions.updateShapeSettings({ strokeWidth: nextWidth });
} else {
const nextSize = stepBrushSizePreset(toolState.brushSettings.size, dir);
toolStoreActions.updateBrushSettings({ size: nextSize });
diff --git a/src/components/Header.tsx b/src/components/Header.tsx
index 19e70a0..f9866cc 100644
--- a/src/components/Header.tsx
+++ b/src/components/Header.tsx
@@ -89,7 +89,6 @@ export const Header: React.FC<HeaderProps> = React.memo(({
onSelectAppView,
}) => {
const isRotated = Math.abs(rotation % 360) > 0.05;
- const isVintage = themePreset === 'vintage-manga';
const resolvedHandlers = useMemo<WorkspaceCommandHandlers>(
() =>
@@ -126,11 +125,7 @@ export const Header: React.FC<HeaderProps> = React.memo(({
<header
data-tauri-drag-region
data-theme-preset={themePreset}
- className={`h-[36px] px-2 flex items-center justify-between gap-2 select-none z-40 shrink-0 ${
- isVintage
- ? 'bg-gradient-to-b from-[#49494d] to-[#363638] border-b border-[#232325] text-[#f0f0f4]'
- : 'bg-[#202020] text-[#e5e5e5]'
- }`}
+ className="h-[36px] px-2 flex items-center justify-between gap-2 select-none z-40 shrink-0 bg-[#202020] text-[#e5e5e5]"
>
{/* Left: App Icon (Home Toggle) + Menu Bar */}
<div
@@ -209,11 +204,9 @@ export const Header: React.FC<HeaderProps> = React.memo(({
{/* Compact Zoom Control */}
<div
- className={`h-6 flex items-center rounded px-0.5 ${
- isVintage
- ? 'bg-[#2b2b2e] border border-[#202022]'
- : 'bg-[#161616]'
- } ${!hasOpenDocument ? 'opacity-40 pointer-events-none' : ''}`}
+ className={`h-6 flex items-center rounded px-0.5 bg-[#161616] ${
+ !hasOpenDocument ? 'opacity-40 pointer-events-none' : ''
+ }`}
>
<button
type="button"
@@ -244,9 +237,9 @@ export const Header: React.FC<HeaderProps> = React.memo(({
{/* Non-Destructive View Flip Controls (CSP-style Mirror View) */}
{(onToggleFlipHorizontal || onToggleFlipVertical) && (
<div
- className={`h-6 flex items-center rounded px-0.5 gap-0.5 ${
- isVintage ? 'bg-[#2b2b2e] border border-[#202022]' : 'bg-[#161616]'
- } ${!hasOpenDocument ? 'opacity-40 pointer-events-none' : ''}`}
+ className={`h-6 flex items-center rounded px-0.5 gap-0.5 bg-[#161616] ${
+ !hasOpenDocument ? 'opacity-40 pointer-events-none' : ''
+ }`}
>
{onToggleFlipHorizontal && (
<button
diff --git a/src/components/LayerStylesModal.tsx b/src/components/LayerStylesModal.tsx
index ae583ff..5c41333 100644
--- a/src/components/LayerStylesModal.tsx
+++ b/src/components/LayerStylesModal.tsx
@@ -1,5 +1,5 @@
import React, { useState, useEffect, useRef } from 'react';
-import { X, Check, RotateCcw, Sparkles } from 'lucide-react';
+import { X } from 'lucide-react';
import {
LayerStyles,
LayerStyleStroke,
@@ -267,9 +267,9 @@ export const LayerStylesModal: React.FC<LayerStylesModalProps> = ({
if (!isOpen) return null;
return (
- <div className="fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-xs select-none">
+ <div className="fixed inset-0 z-50 flex items-center justify-center bg-black/65 backdrop-blur-xs select-none">
<div
- className="w-[640px] max-w-[95vw] bg-[#242426] border border-[#3e3e42] rounded-lg shadow-2xl flex flex-col text-[#cccccc] overflow-hidden"
+ className="w-[640px] max-w-[95vw] bg-[#202020] border border-white/[0.1] rounded-lg shadow-2xl flex flex-col text-[#e5e5e5] overflow-hidden"
style={{
transform: `translate(${pos.x}px, ${pos.y}px)`,
}}
@@ -279,26 +279,23 @@ export const LayerStylesModal: React.FC<LayerStylesModalProps> = ({
onPointerDown={handlePointerDown}
onPointerMove={handlePointerMove}
onPointerUp={handlePointerUp}
- className="flex items-center justify-between px-4 py-2.5 bg-[#1e1e20] border-b border-[#333336] cursor-move text-xs font-semibold"
+ className="flex items-center justify-between px-4 py-2.5 bg-[#1a1a1a] border-b border-white/[0.06] cursor-move text-xs font-medium"
>
- <div className="flex items-center space-x-2">
- <Sparkles className="w-4 h-4 text-amber-400" />
- <span className="text-white">Layer Style (Blending Options) - {layerName}</span>
- </div>
+ <span className="text-[#e5e5e5]">Layer Style — {layerName}</span>
<button
onClick={onClose}
- className="p-1 text-[#888888] hover:text-white hover:bg-[#333336] rounded transition-colors"
+ className="p-1 text-[#8a8a8a] hover:text-[#e5e5e5] hover:bg-[#2c2c2c] rounded transition-colors cursor-pointer"
>
- <X className="w-4 h-4" />
+ <X className="w-3.5 h-3.5" />
</button>
</div>
{/* Modal Body: Left category sidebar + Right parameter panel */}
<div className="flex flex-1 min-h-[380px] text-xs">
{/* Left Column: Styles Checklist */}
- <div className="w-48 bg-[#1a1a1c] border-r border-[#333336] p-2 flex flex-col justify-between">
+ <div className="w-48 bg-[#161616] border-r border-white/[0.06] p-2 flex flex-col justify-between">
<div className="space-y-1">
- <div className="px-2 py-1 text-[10px] font-bold uppercase tracking-wider text-[#777777]">
+ <div className="px-2 py-1 text-[10px] font-medium uppercase tracking-wider text-[#8a8a8a]">
Styles
</div>
@@ -307,8 +304,8 @@ export const LayerStylesModal: React.FC<LayerStylesModalProps> = ({
onClick={() => setActiveTab('stroke')}
className={`flex items-center space-x-2 px-2.5 py-2 rounded cursor-pointer transition-colors ${
activeTab === 'stroke'
- ? 'bg-[#353538] text-white font-medium shadow-xs'
- : 'hover:bg-[#252528] text-[#aaaaaa]'
+ ? 'bg-[#2c2c2c] text-[#e5e5e5] font-medium'
+ : 'hover:bg-[#202020] text-[#8a8a8a]'
}`}
>
<input
@@ -318,7 +315,7 @@ export const LayerStylesModal: React.FC<LayerStylesModalProps> = ({
e.stopPropagation();
setStroke((s) => ({ ...s, enabled: e.target.checked }));
}}
- className="rounded border-[#444448] bg-[#1a1a1c] text-blue-500 focus:ring-0 cursor-pointer"
+ className="cursor-pointer"
/>
<span className="flex-1 truncate">Stroke</span>
</div>
@@ -328,8 +325,8 @@ export const LayerStylesModal: React.FC<LayerStylesModalProps> = ({
onClick={() => setActiveTab('dropShadow')}
className={`flex items-center space-x-2 px-2.5 py-2 rounded cursor-pointer transition-colors ${
activeTab === 'dropShadow'
- ? 'bg-[#353538] text-white font-medium shadow-xs'
- : 'hover:bg-[#252528] text-[#aaaaaa]'
+ ? 'bg-[#2c2c2c] text-[#e5e5e5] font-medium'
+ : 'hover:bg-[#202020] text-[#8a8a8a]'
}`}
>
<input
@@ -339,7 +336,7 @@ export const LayerStylesModal: React.FC<LayerStylesModalProps> = ({
e.stopPropagation();
setDropShadow((s) => ({ ...s, enabled: e.target.checked }));
}}
- className="rounded border-[#444448] bg-[#1a1a1c] text-blue-500 focus:ring-0 cursor-pointer"
+ className="cursor-pointer"
/>
<span className="flex-1 truncate">Drop Shadow</span>
</div>
@@ -349,8 +346,8 @@ export const LayerStylesModal: React.FC<LayerStylesModalProps> = ({
onClick={() => setActiveTab('outerGlow')}
className={`flex items-center space-x-2 px-2.5 py-2 rounded cursor-pointer transition-colors ${
activeTab === 'outerGlow'
- ? 'bg-[#353538] text-white font-medium shadow-xs'
- : 'hover:bg-[#252528] text-[#aaaaaa]'
+ ? 'bg-[#2c2c2c] text-[#e5e5e5] font-medium'
+ : 'hover:bg-[#202020] text-[#8a8a8a]'
}`}
>
<input
@@ -360,20 +357,20 @@ export const LayerStylesModal: React.FC<LayerStylesModalProps> = ({
e.stopPropagation();
setOuterGlow((s) => ({ ...s, enabled: e.target.checked }));
}}
- className="rounded border-[#444448] bg-[#1a1a1c] text-blue-500 focus:ring-0 cursor-pointer"
+ className="cursor-pointer"
/>
<span className="flex-1 truncate">Outer Glow</span>
</div>
</div>
{/* Interactive Swatch Preview Canvas */}
- <div className="pt-2 border-t border-[#2d2d30] flex flex-col items-center">
- <span className="text-[10px] text-[#777777] mb-1 font-mono">Preview</span>
+ <div className="pt-2 border-t border-white/[0.06] flex flex-col items-center">
+ <span className="text-[10px] text-[#8a8a8a] mb-1 font-mono">Preview</span>
<canvas
ref={previewCanvasRef}
width={100}
height={100}
- className="w-24 h-24 rounded border border-[#3e3e42] shadow-inner bg-[#1e1e20]"
+ className="w-24 h-24 rounded border border-white/[0.08] bg-[#202020]"
/>
</div>
</div>
@@ -383,14 +380,13 @@ export const LayerStylesModal: React.FC<LayerStylesModalProps> = ({
{/* --- STROKE OPTIONS --- */}
{activeTab === 'stroke' && (
<div className="space-y-4">
- <div className="flex items-center justify-between pb-2 border-b border-[#333336]">
- <span className="font-semibold text-white">Stroke Options</span>
- <label className="flex items-center space-x-1.5 cursor-pointer">
+ <div className="flex items-center justify-between pb-2 border-b border-white/[0.06]">
+ <span className="font-medium text-[#e5e5e5]">Stroke Options</span>
+ <label className="flex items-center space-x-1.5 cursor-pointer text-[#8a8a8a]">
<input
type="checkbox"
checked={stroke.enabled}
onChange={(e) => setStroke((s) => ({ ...s, enabled: e.target.checked }))}
- className="rounded border-[#444448] bg-[#1a1a1c] text-blue-500 focus:ring-0"
/>
<span className="text-xs">Enable Stroke</span>
</label>
@@ -399,8 +395,8 @@ export const LayerStylesModal: React.FC<LayerStylesModalProps> = ({
{/* Structure / Size */}
<div className="space-y-1">
<div className="flex justify-between">
- <span className="text-[#999999]">Size</span>
- <span className="font-mono">{stroke.size} px</span>
+ <span className="text-[#8a8a8a]">Size</span>
+ <span className="font-mono text-[#e5e5e5]">{stroke.size} px</span>
</div>
<input
type="range"
@@ -408,22 +404,22 @@ export const LayerStylesModal: React.FC<LayerStylesModalProps> = ({
max="100"
value={stroke.size}
onChange={(e) => setStroke((s) => ({ ...s, size: Number(e.target.value) }))}
- className="w-full accent-blue-500 cursor-pointer"
+ className="w-full"
/>
</div>
{/* Position */}
<div className="space-y-1">
- <span className="text-[#999999] block">Position</span>
- <div className="grid grid-cols-3 gap-1 bg-[#1a1a1c] p-1 rounded border border-[#333336]">
+ <span className="text-[#8a8a8a] block">Position</span>
+ <div className="grid grid-cols-3 gap-1 bg-[#161616] p-1 rounded border border-white/[0.06]">
{(['outside', 'inside', 'center'] as const).map((pos) => (
<button
key={pos}
onClick={() => setStroke((s) => ({ ...s, position: pos }))}
- className={`py-1 text-center capitalize rounded transition-colors ${
+ className={`py-1 text-center capitalize rounded transition-colors cursor-pointer ${
stroke.position === pos
- ? 'bg-[#3b82f6] text-white font-medium shadow-xs'
- : 'hover:bg-[#28282b] text-[#aaaaaa]'
+ ? 'bg-[var(--accent)] text-[var(--accent-contrast)] font-medium'
+ : 'hover:bg-[#2c2c2c] text-[#8a8a8a] hover:text-[#e5e5e5]'
}`}
>
{pos}
@@ -435,8 +431,8 @@ export const LayerStylesModal: React.FC<LayerStylesModalProps> = ({
{/* Opacity */}
<div className="space-y-1">
<div className="flex justify-between">
- <span className="text-[#999999]">Opacity</span>
- <span className="font-mono">{Math.round(stroke.opacity * 100)}%</span>
+ <span className="text-[#8a8a8a]">Opacity</span>
+ <span className="font-mono text-[#e5e5e5]">{Math.round(stroke.opacity * 100)}%</span>
</div>
<input
type="range"
@@ -445,25 +441,25 @@ export const LayerStylesModal: React.FC<LayerStylesModalProps> = ({
step="0.01"
value={stroke.opacity}
onChange={(e) => setStroke((s) => ({ ...s, opacity: Number(e.target.value) }))}
- className="w-full accent-blue-500 cursor-pointer"
+ className="w-full"
/>
</div>
{/* Color */}
<div className="space-y-1">
- <span className="text-[#999999] block">Color</span>
+ <span className="text-[#8a8a8a] block">Color</span>
<div className="flex items-center space-x-2">
<input
type="color"
value={stroke.color}
onChange={(e) => setStroke((s) => ({ ...s, color: e.target.value }))}
- className="w-8 h-8 rounded border border-[#444448] bg-transparent cursor-pointer"
+ className="w-7 h-7 rounded border border-white/[0.1] bg-transparent cursor-pointer"
/>
<input
type="text"
value={stroke.color}
onChange={(e) => setStroke((s) => ({ ...s, color: e.target.value }))}
- className="w-24 px-2 py-1 bg-[#1a1a1c] border border-[#3e3e42] rounded font-mono text-xs focus:outline-none focus:border-blue-500"
+ className="w-24 px-2 py-1 bg-[#161616] border border-white/[0.08] rounded font-mono text-xs text-[#e5e5e5]"
/>
</div>
</div>
@@ -473,14 +469,13 @@ export const LayerStylesModal: React.FC<LayerStylesModalProps> = ({
{/* --- DROP SHADOW OPTIONS --- */}
{activeTab === 'dropShadow' && (
<div className="space-y-4">
- <div className="flex items-center justify-between pb-2 border-b border-[#333336]">
- <span className="font-semibold text-white">Drop Shadow Options</span>
- <label className="flex items-center space-x-1.5 cursor-pointer">
+ <div className="flex items-center justify-between pb-2 border-b border-white/[0.06]">
+ <span className="font-medium text-[#e5e5e5]">Drop Shadow Options</span>
+ <label className="flex items-center space-x-1.5 cursor-pointer text-[#8a8a8a]">
<input
type="checkbox"
checked={dropShadow.enabled}
onChange={(e) => setDropShadow((s) => ({ ...s, enabled: e.target.checked }))}
- className="rounded border-[#444448] bg-[#1a1a1c] text-blue-500 focus:ring-0"
/>
<span className="text-xs">Enable Shadow</span>
</label>
@@ -489,27 +484,27 @@ export const LayerStylesModal: React.FC<LayerStylesModalProps> = ({
{/* Color & Opacity */}
<div className="grid grid-cols-2 gap-3">
<div className="space-y-1">
- <span className="text-[#999999] block">Color</span>
+ <span className="text-[#8a8a8a] block">Color</span>
<div className="flex items-center space-x-2">
<input
type="color"
value={dropShadow.color}
onChange={(e) => setDropShadow((s) => ({ ...s, color: e.target.value }))}
- className="w-8 h-8 rounded border border-[#444448] bg-transparent cursor-pointer"
+ className="w-7 h-7 rounded border border-white/[0.1] bg-transparent cursor-pointer"
/>
<input
type="text"
value={dropShadow.color}
onChange={(e) => setDropShadow((s) => ({ ...s, color: e.target.value }))}
- className="w-20 px-2 py-1 bg-[#1a1a1c] border border-[#3e3e42] rounded font-mono text-xs focus:outline-none focus:border-blue-500"
+ className="w-20 px-2 py-1 bg-[#161616] border border-white/[0.08] rounded font-mono text-xs text-[#e5e5e5]"
/>
</div>
</div>
<div className="space-y-1">
<div className="flex justify-between">
- <span className="text-[#999999]">Opacity</span>
- <span className="font-mono">{Math.round(dropShadow.opacity * 100)}%</span>
+ <span className="text-[#8a8a8a]">Opacity</span>
+ <span className="font-mono text-[#e5e5e5]">{Math.round(dropShadow.opacity * 100)}%</span>
</div>
<input
type="range"
@@ -518,7 +513,7 @@ export const LayerStylesModal: React.FC<LayerStylesModalProps> = ({
step="0.01"
value={dropShadow.opacity}
onChange={(e) => setDropShadow((s) => ({ ...s, opacity: Number(e.target.value) }))}
- className="w-full accent-blue-500 cursor-pointer"
+ className="w-full"
/>
</div>
</div>
@@ -526,8 +521,8 @@ export const LayerStylesModal: React.FC<LayerStylesModalProps> = ({
{/* Angle */}
<div className="space-y-1">
<div className="flex justify-between">
- <span className="text-[#999999]">Angle</span>
- <span className="font-mono">{dropShadow.angle}°</span>
+ <span className="text-[#8a8a8a]">Angle</span>
+ <span className="font-mono text-[#e5e5e5]">{dropShadow.angle}°</span>
</div>
<input
type="range"
@@ -535,15 +530,15 @@ export const LayerStylesModal: React.FC<LayerStylesModalProps> = ({
max="360"
value={dropShadow.angle}
onChange={(e) => setDropShadow((s) => ({ ...s, angle: Number(e.target.value) }))}
- className="w-full accent-blue-500 cursor-pointer"
+ className="w-full"
/>
</div>
{/* Distance */}
<div className="space-y-1">
<div className="flex justify-between">
- <span className="text-[#999999]">Distance</span>
- <span className="font-mono">{dropShadow.distance} px</span>
+ <span className="text-[#8a8a8a]">Distance</span>
+ <span className="font-mono text-[#e5e5e5]">{dropShadow.distance} px</span>
</div>
<input
type="range"
@@ -551,15 +546,15 @@ export const LayerStylesModal: React.FC<LayerStylesModalProps> = ({
max="100"
value={dropShadow.distance}
onChange={(e) => setDropShadow((s) => ({ ...s, distance: Number(e.target.value) }))}
- className="w-full accent-blue-500 cursor-pointer"
+ className="w-full"
/>
</div>
{/* Spread */}
<div className="space-y-1">
<div className="flex justify-between">
- <span className="text-[#999999]">Spread</span>
- <span className="font-mono">{dropShadow.spread}%</span>
+ <span className="text-[#8a8a8a]">Spread</span>
+ <span className="font-mono text-[#e5e5e5]">{dropShadow.spread}%</span>
</div>
<input
type="range"
@@ -567,15 +562,15 @@ export const LayerStylesModal: React.FC<LayerStylesModalProps> = ({
max="100"
value={dropShadow.spread}
onChange={(e) => setDropShadow((s) => ({ ...s, spread: Number(e.target.value) }))}
- className="w-full accent-blue-500 cursor-pointer"
+ className="w-full"
/>
</div>
{/* Size / Blur */}
<div className="space-y-1">
<div className="flex justify-between">
- <span className="text-[#999999]">Size (Blur)</span>
- <span className="font-mono">{dropShadow.blur} px</span>
+ <span className="text-[#8a8a8a]">Size (Blur)</span>
+ <span className="font-mono text-[#e5e5e5]">{dropShadow.blur} px</span>
</div>
<input
type="range"
@@ -583,7 +578,7 @@ export const LayerStylesModal: React.FC<LayerStylesModalProps> = ({
max="100"
value={dropShadow.blur}
onChange={(e) => setDropShadow((s) => ({ ...s, blur: Number(e.target.value) }))}
- className="w-full accent-blue-500 cursor-pointer"
+ className="w-full"
/>
</div>
</div>
@@ -592,14 +587,13 @@ export const LayerStylesModal: React.FC<LayerStylesModalProps> = ({
{/* --- OUTER GLOW OPTIONS --- */}
{activeTab === 'outerGlow' && (
<div className="space-y-4">
- <div className="flex items-center justify-between pb-2 border-b border-[#333336]">
- <span className="font-semibold text-white">Outer Glow Options</span>
- <label className="flex items-center space-x-1.5 cursor-pointer">
+ <div className="flex items-center justify-between pb-2 border-b border-white/[0.06]">
+ <span className="font-medium text-[#e5e5e5]">Outer Glow Options</span>
+ <label className="flex items-center space-x-1.5 cursor-pointer text-[#8a8a8a]">
<input
type="checkbox"
checked={outerGlow.enabled}
onChange={(e) => setOuterGlow((s) => ({ ...s, enabled: e.target.checked }))}
- className="rounded border-[#444448] bg-[#1a1a1c] text-blue-500 focus:ring-0"
/>
<span className="text-xs">Enable Glow</span>
</label>
@@ -608,27 +602,27 @@ export const LayerStylesModal: React.FC<LayerStylesModalProps> = ({
{/* Color & Opacity */}
<div className="grid grid-cols-2 gap-3">
<div className="space-y-1">
- <span className="text-[#999999] block">Color</span>
+ <span className="text-[#8a8a8a] block">Color</span>
<div className="flex items-center space-x-2">
<input
type="color"
value={outerGlow.color}
onChange={(e) => setOuterGlow((s) => ({ ...s, color: e.target.value }))}
- className="w-8 h-8 rounded border border-[#444448] bg-transparent cursor-pointer"
+ className="w-7 h-7 rounded border border-white/[0.1] bg-transparent cursor-pointer"
/>
<input
type="text"
value={outerGlow.color}
onChange={(e) => setOuterGlow((s) => ({ ...s, color: e.target.value }))}
- className="w-20 px-2 py-1 bg-[#1a1a1c] border border-[#3e3e42] rounded font-mono text-xs focus:outline-none focus:border-blue-500"
+ className="w-20 px-2 py-1 bg-[#161616] border border-white/[0.08] rounded font-mono text-xs text-[#e5e5e5]"
/>
</div>
</div>
<div className="space-y-1">
<div className="flex justify-between">
- <span className="text-[#999999]">Opacity</span>
- <span className="font-mono">{Math.round(outerGlow.opacity * 100)}%</span>
+ <span className="text-[#8a8a8a]">Opacity</span>
+ <span className="font-mono text-[#e5e5e5]">{Math.round(outerGlow.opacity * 100)}%</span>
</div>
<input
type="range"
@@ -637,7 +631,7 @@ export const LayerStylesModal: React.FC<LayerStylesModalProps> = ({
step="0.01"
value={outerGlow.opacity}
onChange={(e) => setOuterGlow((s) => ({ ...s, opacity: Number(e.target.value) }))}
- className="w-full accent-blue-500 cursor-pointer"
+ className="w-full"
/>
</div>
</div>
@@ -645,8 +639,8 @@ export const LayerStylesModal: React.FC<LayerStylesModalProps> = ({
{/* Spread */}
<div className="space-y-1">
<div className="flex justify-between">
- <span className="text-[#999999]">Spread</span>
- <span className="font-mono">{outerGlow.spread}%</span>
+ <span className="text-[#8a8a8a]">Spread</span>
+ <span className="font-mono text-[#e5e5e5]">{outerGlow.spread}%</span>
</div>
<input
type="range"
@@ -654,15 +648,15 @@ export const LayerStylesModal: React.FC<LayerStylesModalProps> = ({
max="100"
value={outerGlow.spread}
onChange={(e) => setOuterGlow((s) => ({ ...s, spread: Number(e.target.value) }))}
- className="w-full accent-blue-500 cursor-pointer"
+ className="w-full"
/>
</div>
{/* Size / Blur */}
<div className="space-y-1">
<div className="flex justify-between">
- <span className="text-[#999999]">Size (Blur)</span>
- <span className="font-mono">{outerGlow.blur} px</span>
+ <span className="text-[#8a8a8a]">Size (Blur)</span>
+ <span className="font-mono text-[#e5e5e5]">{outerGlow.blur} px</span>
</div>
<input
type="range"
@@ -670,7 +664,7 @@ export const LayerStylesModal: React.FC<LayerStylesModalProps> = ({
max="100"
value={outerGlow.blur}
onChange={(e) => setOuterGlow((s) => ({ ...s, blur: Number(e.target.value) }))}
- className="w-full accent-blue-500 cursor-pointer"
+ className="w-full"
/>
</div>
</div>
@@ -679,28 +673,26 @@ export const LayerStylesModal: React.FC<LayerStylesModalProps> = ({
</div>
{/* Footer Actions */}
- <div className="flex items-center justify-between px-4 py-3 bg-[#1e1e20] border-t border-[#333336]">
+ <div className="flex items-center justify-between px-4 py-2.5 bg-[#1a1a1a] border-t border-white/[0.06]">
<button
onClick={handleResetDefaults}
- className="flex items-center space-x-1.5 px-3 py-1.5 text-xs text-[#888888] hover:text-white bg-[#28282b] hover:bg-[#333336] rounded border border-[#3e3e42] transition-colors"
+ className="px-3 py-1.5 text-xs text-[#8a8a8a] hover:text-[#e5e5e5] bg-[#161616] hover:bg-[#2c2c2c] rounded border border-white/[0.06] transition-colors cursor-pointer"
>
- <RotateCcw className="w-3.5 h-3.5" />
- <span>Reset Category</span>
+ Reset Category
</button>
<div className="flex items-center space-x-2">
<button
onClick={onClose}
- className="px-4 py-1.5 text-xs text-[#aaaaaa] hover:text-white hover:bg-[#333336] rounded transition-colors"
+ className="px-3.5 py-1.5 text-xs text-[#8a8a8a] hover:text-[#e5e5e5] hover:bg-[#2c2c2c] rounded transition-colors cursor-pointer"
>
Cancel
</button>
<button
onClick={handleConfirm}
- className="flex items-center space-x-1.5 px-4 py-1.5 text-xs font-medium text-white bg-blue-600 hover:bg-blue-500 rounded shadow transition-colors"
+ className="px-4 py-1.5 text-xs font-medium bg-[var(--accent)] text-[var(--accent-contrast)] hover:opacity-90 rounded transition-opacity cursor-pointer"
>
- <Check className="w-3.5 h-3.5" />
- <span>OK</span>
+ OK
</button>
</div>
</div>
diff --git a/src/components/LightSourceWidget.tsx b/src/components/LightSourceWidget.tsx
index 065c349..527b109 100644
--- a/src/components/LightSourceWidget.tsx
+++ b/src/components/LightSourceWidget.tsx
@@ -1,5 +1,5 @@
import React, { useRef, useEffect, useCallback, useState } from 'react';
-import { Sun, RotateCcw } from 'lucide-react';
+import { RotateCcw } from 'lucide-react';
export interface LightSettings {
azimuth: number; // 0 to 360 degrees (horizontal)
@@ -14,12 +14,14 @@ interface LightSourceWidgetProps {
settings: LightSettings;
onChange: (settings: LightSettings) => void;
onReset: () => void;
+ embedded?: boolean;
}
export const LightSourceWidget: React.FC<LightSourceWidgetProps> = ({
settings,
onChange,
onReset,
+ embedded = false,
}) => {
const canvasRef = useRef<HTMLCanvasElement | null>(null);
const isDraggingRef = useRef<boolean>(false);
@@ -223,19 +225,20 @@ export const LightSourceWidget: React.FC<LightSourceWidgetProps> = ({
return (
<div
- className="bg-[#1b1e24]/95 border border-[#3b82f6]/40 rounded-lg p-2.5 shadow-2xl backdrop-blur-md w-60 text-xs text-gray-200 select-none"
+ className={
+ embedded
+ ? 'bg-[#161616] border border-white/[0.06] rounded-md p-2.5 w-full text-xs text-[#e5e5e5] select-none'
+ : 'bg-[#202020]/95 border border-white/[0.1] rounded-lg p-2.5 shadow-2xl backdrop-blur-md w-60 text-xs text-[#e5e5e5] select-none'
+ }
onPointerDown={(e) => e.stopPropagation()}
>
- <div className="flex items-center justify-between border-b border-white/10 pb-1.5 mb-2">
- <div className="flex items-center space-x-1.5 font-medium text-sky-400">
- <Sun className="w-3.5 h-3.5 text-amber-400" />
- <span className="text-[11px] font-semibold uppercase tracking-wider">Light Source</span>
- </div>
+ <div className="flex items-center justify-between border-b border-white/[0.06] pb-1.5 mb-2">
+ <span className="text-[11px] font-medium text-[#e5e5e5]">Light Source</span>
<div className="flex items-center space-x-1">
<button
type="button"
onClick={() => setActiveTab(activeTab === 'sphere' ? 'sliders' : 'sphere')}
- className="text-[10px] px-1.5 py-0.5 rounded bg-white/10 hover:bg-white/20 text-gray-300"
+ className="text-[10px] px-1.5 py-0.5 rounded bg-[#2c2c2c] hover:bg-[#383838] text-[#cccccc] cursor-pointer"
>
{activeTab === 'sphere' ? 'Sliders' : 'Sphere'}
</button>
@@ -243,7 +246,7 @@ export const LightSourceWidget: React.FC<LightSourceWidgetProps> = ({
type="button"
onClick={onReset}
title="Reset Light to Default (Top-Right Front)"
- className="p-1 rounded text-gray-400 hover:text-white hover:bg-white/10"
+ className="p-1 rounded text-[#8a8a8a] hover:text-[#e5e5e5] hover:bg-[#2c2c2c] cursor-pointer"
>
<RotateCcw className="w-3 h-3" />
</button>
@@ -256,42 +259,42 @@ export const LightSourceWidget: React.FC<LightSourceWidgetProps> = ({
<div className="relative group cursor-crosshair">
<canvas
ref={canvasRef}
- width={140}
- height={140}
+ width={132}
+ height={132}
onPointerDown={handlePointerDown}
- className="rounded-full shadow-inner border border-white/10"
+ className="rounded-full border border-white/[0.1]"
style={{ touchAction: 'none' }}
/>
<div className="absolute inset-0 pointer-events-none flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity">
- <span className="text-[9px] bg-black/60 px-1.5 py-0.5 rounded text-gray-300">
- Drag to angle light
+ <span className="text-[9px] bg-black/70 px-1.5 py-0.5 rounded text-[#e5e5e5]">
+ Drag to angle
</span>
</div>
</div>
{/* Front / Back Light Toggle */}
- <div className="flex items-center justify-between w-full mt-2 px-1">
+ <div className="flex items-center justify-between w-full mt-2 px-0.5">
<button
type="button"
onClick={() => onChange({ ...settings, isBacklit: !settings.isBacklit })}
- className={`text-[10px] px-2 py-0.5 rounded font-medium transition-colors ${
+ className={`text-[10px] px-2 py-0.5 rounded font-medium transition-colors cursor-pointer ${
settings.isBacklit
- ? 'bg-rose-600/30 text-rose-300 border border-rose-500/50'
- : 'bg-sky-600/30 text-sky-300 border border-sky-500/50'
+ ? 'bg-[var(--accent-subtle)] text-[var(--accent)] ring-1 ring-[var(--accent-border)]'
+ : 'bg-[#2c2c2c] text-[#cccccc] hover:text-[#e5e5e5]'
}`}
>
- {settings.isBacklit ? 'Backlight Mode' : 'Front Light'}
+ {settings.isBacklit ? 'Backlight' : 'Front Light'}
</button>
- <span className="text-[10px] font-mono text-gray-400">
- {settings.azimuth}° | {settings.elevation}°
+ <span className="text-[10px] font-mono text-[#8a8a8a]">
+ {settings.azimuth}° / {settings.elevation}°
</span>
</div>
</div>
) : (
<div className="space-y-2 py-1">
{/* Azimuth (Horizontal) */}
- <div className="flex items-center justify-between">
- <span className="text-[10px] text-gray-400">Azimuth</span>
+ <div className="flex items-center justify-between gap-2">
+ <span className="text-[10px] text-[#8a8a8a] w-14">Azimuth</span>
<input
type="range"
min="0"
@@ -299,14 +302,14 @@ export const LightSourceWidget: React.FC<LightSourceWidgetProps> = ({
step="2"
value={settings.azimuth}
onChange={(e) => onChange({ ...settings, azimuth: parseInt(e.target.value, 10) })}
- className="w-28 accent-amber-400 cursor-pointer h-1.5"
+ className="flex-1"
/>
- <span className="text-[10px] font-mono w-7 text-right">{settings.azimuth}°</span>
+ <span className="text-[10px] font-mono w-7 text-right text-[#e5e5e5]">{settings.azimuth}°</span>
</div>
{/* Elevation (Vertical) */}
- <div className="flex items-center justify-between">
- <span className="text-[10px] text-gray-400">Elevation</span>
+ <div className="flex items-center justify-between gap-2">
+ <span className="text-[10px] text-[#8a8a8a] w-14">Elevation</span>
<input
type="range"
min="-85"
@@ -314,17 +317,17 @@ export const LightSourceWidget: React.FC<LightSourceWidgetProps> = ({
step="1"
value={settings.elevation}
onChange={(e) => onChange({ ...settings, elevation: parseInt(e.target.value, 10) })}
- className="w-28 accent-amber-400 cursor-pointer h-1.5"
+ className="flex-1"
/>
- <span className="text-[10px] font-mono w-7 text-right">{settings.elevation}°</span>
+ <span className="text-[10px] font-mono w-7 text-right text-[#e5e5e5]">{settings.elevation}°</span>
</div>
</div>
)}
{/* Common Controls: Intensity & Ambient Fill */}
- <div className="mt-2.5 pt-2 border-t border-white/10 space-y-1.5">
- <div className="flex items-center justify-between">
- <span className="text-[10px] text-gray-400">Intensity</span>
+ <div className="mt-2.5 pt-2 border-t border-white/[0.06] space-y-1.5">
+ <div className="flex items-center justify-between gap-2">
+ <span className="text-[10px] text-[#8a8a8a] w-14">Intensity</span>
<input
type="range"
min="0.2"
@@ -332,13 +335,13 @@ export const LightSourceWidget: React.FC<LightSourceWidgetProps> = ({
step="0.05"
value={settings.intensity}
onChange={(e) => onChange({ ...settings, intensity: parseFloat(e.target.value) })}
- className="w-28 accent-blue-500 cursor-pointer h-1.5"
+ className="flex-1"
/>
- <span className="text-[10px] font-mono w-7 text-right">{Math.round(settings.intensity * 100)}%</span>
+ <span className="text-[10px] font-mono w-8 text-right text-[#e5e5e5]">{Math.round(settings.intensity * 100)}%</span>
</div>
- <div className="flex items-center justify-between">
- <span className="text-[10px] text-gray-400">Shadow Fill</span>
+ <div className="flex items-center justify-between gap-2">
+ <span className="text-[10px] text-[#8a8a8a] w-14">Fill</span>
<input
type="range"
min="0.1"
@@ -346,26 +349,26 @@ export const LightSourceWidget: React.FC<LightSourceWidgetProps> = ({
step="0.05"
value={settings.ambientIntensity}
onChange={(e) => onChange({ ...settings, ambientIntensity: parseFloat(e.target.value) })}
- className="w-28 accent-emerald-500 cursor-pointer h-1.5"
+ className="flex-1"
/>
- <span className="text-[10px] font-mono w-7 text-right">
+ <span className="text-[10px] font-mono w-8 text-right text-[#e5e5e5]">
{Math.round(settings.ambientIntensity * 100)}%
</span>
</div>
{/* Color Presets */}
<div className="flex items-center justify-between pt-1">
- <span className="text-[10px] text-gray-400">Color</span>
- <div className="flex items-center space-x-1">
+ <span className="text-[10px] text-[#8a8a8a]">Tint</span>
+ <div className="flex items-center space-x-1.5">
{colorPresets.map((preset) => (
<button
key={preset.label}
type="button"
onClick={() => onChange({ ...settings, color: preset.color })}
title={preset.label}
- className={`w-4 h-4 rounded-full border transition-transform ${
+ className={`w-4 h-4 rounded-full border transition-transform cursor-pointer ${
settings.color.toLowerCase() === preset.color.toLowerCase()
- ? 'scale-110 border-sky-400 ring-1 ring-sky-400'
+ ? 'scale-110 border-[var(--accent)] ring-1 ring-[var(--accent)]'
: 'border-white/30 hover:scale-105'
}`}
style={{ backgroundColor: preset.color }}
diff --git a/src/components/Local3DContainer.tsx b/src/components/Local3DContainer.tsx
index fa3d890..3b46b1d 100644
--- a/src/components/Local3DContainer.tsx
+++ b/src/components/Local3DContainer.tsx
@@ -21,23 +21,7 @@ import {
} from '../utils/mannequin3D';
import { Csp3DToolbar, Csp3DToolMode } from './Csp3DToolbar';
import { LightSourceWidget, LightSettings } from './LightSourceWidget';
-import {
- Sun,
- Layers,
- RotateCcw,
- CheckCircle2,
- X,
- Upload,
- Grid,
- Camera,
- Compass,
- Move,
- Rotate3d,
- User,
- Sliders,
- Sparkles,
- Link,
-} from 'lucide-react';
+import { X, SlidersHorizontal, Upload } from 'lucide-react';
export type ShadingMode = 'shaded' | 'smooth' | 'silhouette';
export type GizmoMode = 'none' | 'rotate' | 'translate';
@@ -95,11 +79,10 @@ export const Local3DContainer: React.FC<Local3DContainerProps> = ({
const [activeToolMode, setActiveToolMode] = useState<Csp3DToolMode>('camera-orbit');
const [gizmoMode, setGizmoMode] = useState<GizmoMode>('none');
const [showGrid, setShowGrid] = useState<boolean>(true);
+ const [showInspector, setShowInspector] = useState<boolean>(true);
+ const [inspectorTab, setInspectorTab] = useState<'transform' | 'scene' | 'pose'>('transform');
const [showLightPanel, setShowLightPanel] = useState<boolean>(false);
- const [showCameraPresets, setShowCameraPresets] = useState<boolean>(false);
const [isMannequinActive, setIsMannequinActive] = useState<boolean>(false);
- const [showPoseDrawer, setShowPoseDrawer] = useState<boolean>(false);
- const [showLTModal, setShowLTModal] = useState<boolean>(false);
const [syncCameraPerspective, setSyncCameraPerspective] = useState<boolean>(true);
const syncCameraPerspectiveRef = useRef<boolean>(syncCameraPerspective);
syncCameraPerspectiveRef.current = syncCameraPerspective;
@@ -108,8 +91,6 @@ export const Local3DContainer: React.FC<Local3DContainerProps> = ({
const perspectiveRulerRef = useRef(perspectiveRuler);
perspectiveRulerRef.current = perspectiveRuler;
const [activeIKHandle, setActiveIKHandle] = useState<string | null>(null);
- const [ltLineThreshold, setLtLineThreshold] = useState<number>(0.28);
- const [ltToneBands, setLtToneBands] = useState<2 | 3>(2);
// Viewport Settings
const [opacity, setOpacity] = useState<number>(0.85);
@@ -672,7 +653,6 @@ export const Local3DContainer: React.FC<Local3DContainerProps> = ({
}
camera.lookAt(target);
controls.update();
- setShowCameraPresets(false);
},
[]
);
@@ -985,7 +965,6 @@ export const Local3DContainer: React.FC<Local3DContainerProps> = ({
const handleExtractLineAndTone = async (settings?: LTConversionSettings) => {
if (!sceneRef.current || !cameraRef.current || !modelRootRef.current || isBaking) return;
setIsBaking(true);
- setShowLTModal(false);
try {
if (transformHelperRef.current) transformHelperRef.current.visible = false;
@@ -993,8 +972,8 @@ export const Local3DContainer: React.FC<Local3DContainerProps> = ({
if (ikHandlesContainerRef.current) ikHandlesContainerRef.current.visible = false;
const effectiveLineWidth = settings?.lineWidth ?? 1;
- const effectiveThreshold = settings?.lineThreshold ?? ltLineThreshold;
- const effectiveToneCount = settings?.toneCount ?? ltToneBands;
+ const effectiveThreshold = settings?.lineThreshold ?? 0.28;
+ const effectiveToneCount = settings?.toneCount ?? 2;
const modelDisplayName = loadedFileName
? loadedFileName.replace(/\.[^/.]+$/, '')
: isMannequinActive
@@ -1119,29 +1098,33 @@ export const Local3DContainer: React.FC<Local3DContainerProps> = ({
{/* Empty state prompt if no model is loaded */}
{!loadedFileName && (
<div className="absolute inset-0 flex items-center justify-center pointer-events-none">
- <div className="bg-[#181b20]/90 border border-white/10 backdrop-blur-md rounded-xl px-8 py-6 flex flex-col items-center space-y-3 pointer-events-auto shadow-2xl text-center">
- <div className="w-12 h-12 rounded-full bg-purple-500/20 border border-purple-500/30 flex items-center justify-center text-purple-400">
- <Upload className="w-6 h-6" />
+ <div className="bg-[#202020]/95 border border-white/[0.1] backdrop-blur-md rounded-lg px-6 py-5 flex flex-col items-center space-y-3 pointer-events-auto shadow-2xl text-center max-w-xs">
+ <div className="w-10 h-10 rounded-md bg-[#161616] border border-white/[0.08] flex items-center justify-center text-[#8a8a8a]">
+ <Upload className="w-5 h-5" />
</div>
<div>
- <p className="text-sm font-medium text-white">Import 3D Model</p>
- <p className="text-xs text-gray-400 mt-1">Drag and drop .glb, .gltf, or .obj file, or click upload</p>
+ <p className="text-xs font-medium text-[#e5e5e5]">3D Reference Stage</p>
+ <p className="text-[11px] text-[#8a8a8a] mt-1">
+ Drop a .glb, .gltf, or .obj file, or start with a rigged mannequin
+ </p>
</div>
- <div className="flex items-center space-x-2">
+ <div className="flex items-center space-x-2 pt-1">
<button
type="button"
onClick={() => fileInputRef.current?.click()}
- className="px-4 py-1.5 bg-purple-600 hover:bg-purple-500 text-white rounded text-xs font-medium transition-colors shadow-lg shadow-purple-900/30"
+ className="px-3 py-1.5 bg-[#2c2c2c] hover:bg-[#383838] text-[#e5e5e5] rounded text-xs font-medium transition-colors cursor-pointer"
>
- Upload Model
+ Import Model
</button>
<button
type="button"
- onClick={loadProceduralMannequin}
- className="px-4 py-1.5 bg-blue-600 hover:bg-blue-500 text-white rounded text-xs font-medium transition-colors shadow-lg shadow-blue-900/30 flex items-center space-x-1.5"
+ onClick={() => {
+ loadProceduralMannequin();
+ setInspectorTab('pose');
+ }}
+ className="px-3 py-1.5 bg-[var(--accent)] text-[var(--accent-contrast)] hover:opacity-90 rounded text-xs font-medium transition-opacity cursor-pointer"
>
- <User className="w-3.5 h-3.5" />
- <span>Insert 3D Mannequin</span>
+ Insert Mannequin
</button>
</div>
</div>
@@ -1149,538 +1132,485 @@ export const Local3DContainer: React.FC<Local3DContainerProps> = ({
)}
</div>
- {/* Floating Clip Studio Paint 3D HUD (Rendered via Portal) */}
+ {/* Modern Unified 3D Workspace HUD (Rendered via Portal) */}
{createPortal(
- <div className="fixed inset-x-0 top-12 pointer-events-none z-50 flex flex-col items-center select-none space-y-2">
- {/* 1. Main Clip Studio Paint 3D Launcher Toolbar */}
- <div className="pointer-events-auto shadow-2xl flex items-center space-x-2">
- <Csp3DToolbar
- activeMode={activeToolMode}
- onSelectMode={(mode) => setActiveToolMode(mode)}
- onDirectDrag={(mode, dx, dy) => applyTransformDelta(mode, dx, dy)}
- onSnapToGround={handleSnapToGround}
- onResetModelTransform={handleResetModelTransform}
- onExtractLineAndTone={handleExtractLineAndTone}
- isExtracting={isBaking}
- modelName={loadedFileName || (isMannequinActive ? 'Mannequin' : '3D Model')}
- />
-
- {/* Quick Turn Buttons */}
- <div className="flex items-center space-x-0.5 bg-[#1b1e24]/95 border border-[#3b82f6]/40 rounded-lg p-1 text-[11px] text-gray-300">
- <button
- type="button"
- onClick={() => rotateModelYaw(-90)}
- title="Turn 90° Left"
- className="px-1.5 py-1 rounded hover:bg-white/10 text-sky-400 font-mono"
- >
- ↶ 90°
- </button>
- <button
- type="button"
- onClick={() => rotateModelYaw(90)}
- title="Turn 90° Right"
- className="px-1.5 py-1 rounded hover:bg-white/10 text-sky-400 font-mono"
- >
- ↷ 90°
- </button>
- <button
- type="button"
- onClick={() => rotateModelYaw(180)}
- title="Flip Model 180°"
- className="px-1.5 py-1 rounded hover:bg-white/10 text-sky-400 font-mono"
- >
- 180°
- </button>
- </div>
- </div>
-
- {/* 2. Secondary Comprehensive Controls Toolbar */}
+ <>
+ <input
+ ref={fileInputRef}
+ type="file"
+ accept=".glb,.gltf,.obj"
+ className="hidden"
+ onChange={handleFileUpload}
+ />
+
+ {/* Compact Single-Row Top Action Bar */}
<div
- className="pointer-events-auto bg-[#181b20]/95 backdrop-blur-md border border-[#3b82f6]/40 shadow-2xl rounded-lg px-3 py-1.5 flex items-center space-x-2.5 text-xs text-[#cccccc]"
+ className="fixed top-12 left-1/2 -translate-x-1/2 z-50 bg-[#202020]/95 backdrop-blur-md border border-white/[0.1] rounded-lg px-2 py-1 shadow-2xl flex items-center gap-1.5 text-xs text-[#e5e5e5] select-none"
onPointerDown={(e) => e.stopPropagation()}
>
- {/* Model & Mannequin Upload / Preset Button */}
- <div className="flex items-center space-x-1.5 bg-[#252830] rounded px-2 py-1 border border-white/10">
- <span className="text-[10px] uppercase font-semibold text-gray-400">Model</span>
+ {/* Model Source */}
+ <div className="flex items-center bg-[#161616] rounded p-0.5 border border-white/[0.06]">
<button
type="button"
onClick={() => fileInputRef.current?.click()}
- title="Upload 3D Model (.glb, .gltf, .obj)"
- className={`p-1 px-2 rounded transition-colors flex items-center space-x-1.5 ${
+ title="Import 3D Model (.glb, .gltf, .obj)"
+ className={`px-2 py-0.5 rounded text-[11px] transition-colors cursor-pointer max-w-[96px] truncate ${
loadedFileName && !isMannequinActive
- ? 'bg-purple-600 text-white hover:bg-purple-500'
- : 'bg-purple-600/30 text-purple-300 hover:bg-purple-600 hover:text-white'
+ ? 'bg-[#2c2c2c] text-[#e5e5e5] font-medium'
+ : 'text-[#8a8a8a] hover:text-[#e5e5e5] hover:bg-[#2c2c2c]'
}`}
>
- <Upload className="w-3.5 h-3.5" />
- <span className="text-[10px] font-medium max-w-[100px] truncate">
- {loadedFileName || 'Upload'}
- </span>
+ {loadedFileName && !isMannequinActive ? loadedFileName : 'Import 3D'}
</button>
<button
type="button"
- onClick={loadProceduralMannequin}
- title="Load Rigged Humanoid Drawing Mannequin"
- className={`p-1 px-2 rounded transition-colors flex items-center space-x-1.5 ${
+ onClick={() => {
+ loadProceduralMannequin();
+ setInspectorTab('pose');
+ }}
+ title="Load Rigged Humanoid Mannequin"
+ className={`px-2 py-0.5 rounded text-[11px] transition-colors cursor-pointer ${
isMannequinActive
- ? 'bg-blue-600 text-white hover:bg-blue-500'
- : 'bg-blue-600/30 text-blue-300 hover:bg-blue-600 hover:text-white'
+ ? 'bg-[#2c2c2c] text-[#e5e5e5] font-medium'
+ : 'text-[#8a8a8a] hover:text-[#e5e5e5] hover:bg-[#2c2c2c]'
}`}
>
- <User className="w-3.5 h-3.5" />
- <span className="text-[10px] font-medium">Mannequin</span>
+ Mannequin
</button>
- <input
- ref={fileInputRef}
- type="file"
- accept=".glb,.gltf,.obj"
- className="hidden"
- onChange={handleFileUpload}
- />
</div>
- {/* Poses Drawer Trigger (Standing, Action, Sitting, Fists, Relaxed Palm) */}
- {isMannequinActive && (
- <div className="relative">
- <button
- type="button"
- onClick={() => setShowPoseDrawer(!showPoseDrawer)}
- className={`flex items-center space-x-1 px-2 py-1 rounded border border-white/10 text-[10px] transition-colors ${
- showPoseDrawer ? 'bg-amber-600 text-white' : 'bg-[#252830] text-amber-300 hover:bg-white/10'
- }`}
- title="Humanoid Pose Presets"
- >
- <Sliders className="w-3.5 h-3.5" />
- <span>Poses</span>
- </button>
+ <div className="w-px h-4 bg-white/[0.08]" />
- {showPoseDrawer && (
- <div className="absolute top-full mt-1.5 left-0 bg-[#1b1e24] border border-[#f59e0b]/40 rounded-lg p-2 shadow-2xl z-50 flex flex-col space-y-1.5 w-44">
- <span className="text-[10px] font-semibold text-gray-400 uppercase tracking-wider px-1">
- Pose Presets
- </span>
- <button
- type="button"
- onClick={() => {
- handleApplyPreset('standing');
- setShowPoseDrawer(false);
- }}
- className="text-left px-2 py-1 rounded text-[11px] hover:bg-white/10 text-gray-200 flex items-center justify-between"
- >
- <span>Heroic Standing</span>
- <span className="text-[9px] text-gray-500 font-mono">Neutral</span>
- </button>
- <button
- type="button"
- onClick={() => {
- handleApplyPreset('action');
- setShowPoseDrawer(false);
- }}
- className="text-left px-2 py-1 rounded text-[11px] hover:bg-white/10 text-gray-200 flex items-center justify-between"
- >
- <span>Manga Action</span>
- <span className="text-[9px] text-orange-400 font-mono">Combat</span>
- </button>
- <button
- type="button"
- onClick={() => {
- handleApplyPreset('sitting');
- setShowPoseDrawer(false);
- }}
- className="text-left px-2 py-1 rounded text-[11px] hover:bg-white/10 text-gray-200 flex items-center justify-between"
- >
- <span>Seated Pose</span>
- <span className="text-[9px] text-sky-400 font-mono">Rest</span>
- </button>
- <div className="border-t border-white/10 my-0.5" />
- <button
- type="button"
- onClick={() => {
- handleApplyPreset('fists');
- setShowPoseDrawer(false);
- }}
- className="text-left px-2 py-1 rounded text-[11px] hover:bg-white/10 text-gray-200 flex items-center justify-between"
- >
- <span>Hand Fists</span>
- <span className="text-[9px] text-gray-400 font-mono">Clenched</span>
- </button>
- <button
- type="button"
- onClick={() => {
- handleApplyPreset('relaxed_palm');
- setShowPoseDrawer(false);
- }}
- className="text-left px-2 py-1 rounded text-[11px] hover:bg-white/10 text-gray-200 flex items-center justify-between"
- >
- <span>Relaxed Palm</span>
- <span className="text-[9px] text-gray-400 font-mono">Open</span>
- </button>
- </div>
- )}
- </div>
- )}
-
- {/* IK Limbs Selector */}
- {isMannequinActive && (
- <div className="flex items-center space-x-1 bg-[#252830] rounded px-1.5 py-1 border border-white/10">
- <span className="text-[10px] uppercase font-semibold text-gray-400 mr-1">IK</span>
- {(['head', 'leftHand', 'rightHand', 'leftFoot', 'rightFoot'] as const).map((limb) => (
- <button
- key={limb}
- type="button"
- onClick={() => selectIKTarget(activeIKHandle === limb ? null : limb)}
- title={`Manipulate ${limb} IK handle`}
- className={`px-1.5 py-0.5 rounded text-[10px] capitalize transition-colors ${
- activeIKHandle === limb ? 'bg-cyan-600 text-white font-medium' : 'text-gray-400 hover:bg-white/10'
- }`}
- >
- {limb === 'leftHand'
- ? 'L-Hand'
- : limb === 'rightHand'
- ? 'R-Hand'
- : limb === 'leftFoot'
- ? 'L-Foot'
- : limb === 'rightFoot'
- ? 'R-Foot'
- : 'Head'}
- </button>
- ))}
- </div>
- )}
-
- {/* 3D Gizmo Rings Mode (Rotate / Translate / Off) */}
- <div className="flex items-center space-x-1 bg-[#252830] rounded px-1.5 py-1 border border-white/10">
- <span className="text-[10px] uppercase font-semibold text-gray-400 mr-1">Gizmo</span>
- <button
- type="button"
- onClick={() => setGizmoMode(gizmoMode === 'rotate' ? 'none' : 'rotate')}
- title="Toggle 3D Rotation Rings"
- className={`p-1 rounded flex items-center space-x-1 ${
- gizmoMode === 'rotate' ? 'bg-amber-600 text-white' : 'hover:bg-white/10 text-gray-300'
- }`}
- >
- <Rotate3d className="w-3.5 h-3.5" />
- <span className="text-[10px]">Rings</span>
- </button>
- <button
- type="button"
- onClick={() => setGizmoMode(gizmoMode === 'translate' ? 'none' : 'translate')}
- title="Toggle 3D Translation Arrows"
- className={`p-1 rounded flex items-center space-x-1 ${
- gizmoMode === 'translate' ? 'bg-amber-600 text-white' : 'hover:bg-white/10 text-gray-300'
- }`}
- >
- <Move className="w-3.5 h-3.5" />
- </button>
- </div>
-
- {/* Perspective (Dolly Zoom - Clip Studio Paint style) */}
- <div className="flex items-center space-x-1.5 bg-[#252830] rounded px-2 py-1 border border-white/10">
- <Compass className="w-3 h-3 text-sky-400" />
- <span className="text-[10px] text-gray-400" title="Exaggerates or flattens perspective distortion">
- Perspective
- </span>
- <input
- type="range"
- min="0.3"
- max="2.5"
- step="0.05"
- value={perspective}
- onChange={(e) => applyPerspectiveDollyZoom(parseFloat(e.target.value))}
- className="w-16 accent-sky-400 cursor-pointer h-1.5"
- title="Adjust perspective foreshortening (Dolly Zoom)"
- />
- <span className="text-[10px] font-mono w-7 text-right">{perspective.toFixed(1)}x</span>
- </div>
-
- {/* Camera Presets Menu */}
- <div className="relative">
- <button
- type="button"
- onClick={() => setShowCameraPresets(!showCameraPresets)}
- className="flex items-center space-x-1 bg-[#252830] hover:bg-white/10 px-2 py-1 rounded border border-white/10 text-sky-400 text-[10px]"
- title="Camera Angle Presets"
- >
- <Camera className="w-3.5 h-3.5" />
- <span>Angle</span>
- </button>
-
- {showCameraPresets && (
- <div className="absolute top-full mt-1.5 left-0 bg-[#1b1e24] border border-[#3b82f6]/40 rounded-lg p-1.5 shadow-2xl z-50 flex flex-col space-y-1 w-32">
- <button
- onClick={() => setCameraPreset('front')}
- className="text-left px-2 py-1 rounded text-[11px] hover:bg-white/10 text-gray-200"
- >
- Front View
- </button>
- <button
- onClick={() => setCameraPreset('threeQuarter')}
- className="text-left px-2 py-1 rounded text-[11px] hover:bg-white/10 text-gray-200"
- >
- 3/4 Perspective
- </button>
- <button
- onClick={() => setCameraPreset('side')}
- className="text-left px-2 py-1 rounded text-[11px] hover:bg-white/10 text-gray-200"
- >
- Side Profile
- </button>
- <button
- onClick={() => setCameraPreset('top')}
- className="text-left px-2 py-1 rounded text-[11px] hover:bg-white/10 text-gray-200"
- >
- Top (Bird's Eye)
- </button>
- <button
- onClick={() => setCameraPreset('lowAngle')}
- className="text-left px-2 py-1 rounded text-[11px] hover:bg-white/10 text-gray-200"
- >
- Low Angle (Worm)
- </button>
- <button
- onClick={() => setCameraPreset('back')}
- className="text-left px-2 py-1 rounded text-[11px] hover:bg-white/10 text-gray-200"
- >
- Back View
- </button>
- </div>
- )}
- </div>
+ {/* Camera / Object Mode & Unified Line & Tone */}
+ <Csp3DToolbar
+ activeMode={activeToolMode}
+ onSelectMode={(mode) => setActiveToolMode(mode)}
+ onDirectDrag={(mode, dx, dy) => applyTransformDelta(mode, dx, dy)}
+ onExtractLineAndTone={handleExtractLineAndTone}
+ isExtracting={isBaking}
+ hasModel={Boolean(loadedFileName)}
+ modelName={loadedFileName || (isMannequinActive ? 'Mannequin' : '3D Model')}
+ />
- {/* Shading Mode */}
- <div className="flex items-center space-x-1 bg-[#252830] rounded px-1.5 py-1 border border-white/10">
- <span className="text-[10px] uppercase font-semibold text-gray-400 mr-1">Shade</span>
- {(['shaded', 'smooth', 'silhouette'] as ShadingMode[]).map((mode) => (
- <button
- key={mode}
- type="button"
- onClick={() => {
- setShadingMode(mode);
- applyShading(mode);
- }}
- className={`px-1.5 py-0.5 rounded text-[10px] capitalize transition-colors ${
- shadingMode === mode ? 'bg-blue-600 text-white font-medium' : 'text-gray-400 hover:bg-white/10'
- }`}
- >
- {mode}
- </button>
- ))}
- </div>
+ <div className="w-px h-4 bg-white/[0.08]" />
- {/* Floor Grid Toggle */}
+ {/* Inspector Toggle */}
<button
type="button"
- onClick={() => setShowGrid(!showGrid)}
- title="Toggle Ground Perspective Grid"
- className={`p-1.5 rounded transition-colors ${
- showGrid ? 'bg-sky-600/30 text-sky-300 ring-1 ring-sky-400' : 'text-gray-400 hover:bg-white/10'
+ onClick={() => setShowInspector((v) => !v)}
+ title={showInspector ? 'Hide 3D Inspector' : 'Show 3D Inspector'}
+ className={`p-1 rounded transition-colors cursor-pointer ${
+ showInspector
+ ? 'bg-[var(--accent-subtle)] text-[var(--accent)]'
+ : 'text-[#8a8a8a] hover:text-[#e5e5e5] hover:bg-[#2c2c2c]'
}`}
>
- <Grid className="w-3.5 h-3.5" />
+ <SlidersHorizontal className="w-3.5 h-3.5" />
</button>
- {/* Light Source Panel Toggle */}
- <div className="relative">
- <button
- type="button"
- onClick={() => setShowLightPanel(!showLightPanel)}
- title="Configure 3D Light Source"
- className={`p-1.5 rounded transition-colors flex items-center space-x-1 ${
- showLightPanel
- ? 'bg-amber-500/30 text-amber-300 ring-1 ring-amber-400'
- : 'text-amber-400 hover:bg-white/10'
- }`}
- >
- <Sun className="w-3.5 h-3.5" />
- <span className="text-[10px]">Light</span>
- </button>
-
- {showLightPanel && (
- <div className="absolute top-full mt-2 right-0 z-50">
- <LightSourceWidget
- settings={lightSettings}
- onChange={(s) => setLightSettings(s)}
- onReset={() =>
- setLightSettings({
- azimuth: 45,
- elevation: 45,
- intensity: 1.5,
- ambientIntensity: 0.65,
- color: '#ffffff',
- isBacklit: false,
- })
- }
- />
- </div>
- )}
- </div>
-
- {/* Local Opacity */}
- <div className="flex items-center space-x-1 bg-[#252830] rounded px-1.5 py-1 border border-white/10">
- <Layers className="w-3 h-3 text-gray-400" />
- <input
- type="range"
- min="0.1"
- max="1"
- step="0.05"
- value={opacity}
- onChange={(e) => setOpacity(parseFloat(e.target.value))}
- className="w-14 accent-blue-500 cursor-pointer h-1.5"
- />
- <span className="text-[10px] font-mono">{Math.round(opacity * 100)}%</span>
- </div>
-
- {/* Reset Camera */}
+ {/* Primary Bake Action */}
<button
- onClick={handleResetCamera}
- title="Reset Camera View"
- className="p-1.5 text-gray-400 hover:text-white hover:bg-white/10 rounded transition-colors"
+ type="button"
+ onClick={handleBakeTo2D}
+ disabled={isBaking || !loadedFileName}
+ title={!loadedFileName ? 'Load a model first' : 'Rasterize 3D view into a 2D Layer'}
+ className="px-2.5 py-1 bg-[var(--accent)] text-[var(--accent-contrast)] hover:opacity-90 font-medium rounded text-[11px] transition-opacity disabled:opacity-40 disabled:cursor-not-allowed cursor-pointer"
>
- <RotateCcw className="w-3.5 h-3.5" />
+ {isBaking ? 'Baking...' : 'Bake Layer'}
</button>
- {/* Perspective Ruler Camera Sync Toggle */}
+ {/* Close */}
<button
type="button"
- onClick={() => {
- const nextSync = !syncCameraPerspective;
- setSyncCameraPerspective(nextSync);
- if (nextSync && cameraRef.current && onUpdatePerspectiveRuler) {
- const ruler = calculatePerspectiveFromCamera(
- cameraRef.current,
- dimensions.width,
- dimensions.height,
- perspectiveRuler
- );
- onUpdatePerspectiveRuler(ruler);
- }
- }}
- title="Synchronize 3D camera with document Perspective Ruler"
- className={`p-1.5 px-2 rounded transition-colors flex items-center space-x-1 ${
- syncCameraPerspective
- ? 'bg-cyan-600/30 text-cyan-300 ring-1 ring-cyan-400'
- : 'text-gray-400 hover:bg-white/10'
- }`}
+ onClick={onClose}
+ title="Close 3D Stage"
+ className="p-1 text-[#8a8a8a] hover:text-[#e5e5e5] hover:bg-[#2c2c2c] rounded transition-colors cursor-pointer"
>
- <Link className="w-3.5 h-3.5" />
- <span className="text-[10px]">Ruler Sync</span>
+ <X className="w-3.5 h-3.5" />
</button>
+ </div>
- {/* 3D LT Line & Screentone Extraction */}
- <div className="relative">
- <button
- type="button"
- onClick={() => setShowLTModal(!showLTModal)}
- disabled={isBaking || !modelRootRef.current}
- title="Extract Lineart and Screentones from 3D Model (LT Conversion)"
- className="flex items-center space-x-1 bg-purple-600 hover:bg-purple-500 text-white font-medium px-2.5 py-1 rounded shadow-md transition-colors disabled:opacity-50 disabled:cursor-not-allowed"
- >
- <Sparkles className="w-3.5 h-3.5 text-amber-300" />
- <span className="text-xs">LT Convert</span>
- </button>
+ {/* Collapsible Floating 3D Inspector (Docked Bottom-Left, Zero Overlap) */}
+ {showInspector && (
+ <div
+ className="fixed bottom-10 left-16 z-50 w-64 bg-[#202020]/95 backdrop-blur-md border border-white/[0.1] rounded-lg shadow-2xl overflow-hidden text-xs text-[#e5e5e5] select-none flex flex-col max-h-[calc(100vh-140px)]"
+ onPointerDown={(e) => e.stopPropagation()}
+ >
+ {/* Tabs */}
+ <div className="flex items-center bg-[#1a1a1a] border-b border-white/[0.06] p-1 gap-0.5">
+ {(
+ [
+ ['transform', 'Transform'],
+ ['scene', 'Scene'],
+ ...(isMannequinActive ? ([['pose', 'Pose']] as const) : []),
+ ] as Array<['transform' | 'scene' | 'pose', string]>
+ ).map(([tabId, label]) => (
+ <button
+ key={tabId}
+ type="button"
+ onClick={() => setInspectorTab(tabId)}
+ className={`flex-1 py-1 rounded text-[11px] transition-colors cursor-pointer ${
+ inspectorTab === tabId
+ ? 'bg-[#2c2c2c] text-[#e5e5e5] font-medium'
+ : 'text-[#8a8a8a] hover:text-[#e5e5e5]'
+ }`}
+ >
+ {label}
+ </button>
+ ))}
+ </div>
+
+ <div className="p-3 space-y-3 overflow-y-auto">
+ {inspectorTab === 'transform' && (
+ <>
+ {/* Fine Model Rotation Modes */}
+ <div className="space-y-1">
+ <span className="text-[10px] uppercase tracking-wider text-[#8a8a8a]">
+ Model Controls
+ </span>
+ <div className="grid grid-cols-3 gap-1 bg-[#161616] p-0.5 rounded border border-white/[0.06]">
+ {(
+ [
+ ['model-rotate-free', 'Free'],
+ ['model-rotate-yaw', 'Turn Y'],
+ ['model-rotate-roll', 'Roll'],
+ ] as Array<[Csp3DToolMode, string]>
+ ).map(([mode, lbl]) => (
+ <button
+ key={mode}
+ type="button"
+ onClick={() => setActiveToolMode(mode)}
+ className={`py-1 rounded text-[10px] transition-colors cursor-pointer ${
+ activeToolMode === mode
+ ? 'bg-[var(--accent)] text-[var(--accent-contrast)] font-medium'
+ : 'text-[#8a8a8a] hover:text-[#e5e5e5] hover:bg-[#2c2c2c]'
+ }`}
+ >
+ {lbl}
+ </button>
+ ))}
+ </div>
+ </div>
+
+ {/* Quick Turn */}
+ <div className="space-y-1">
+ <span className="text-[10px] uppercase tracking-wider text-[#8a8a8a]">
+ Quick Turn
+ </span>
+ <div className="grid grid-cols-3 gap-1">
+ <button
+ type="button"
+ onClick={() => rotateModelYaw(-90)}
+ className="py-1 rounded bg-[#161616] hover:bg-[#2c2c2c] border border-white/[0.06] text-[11px] font-mono text-[#e5e5e5] cursor-pointer"
+ >
+ -90°
+ </button>
+ <button
+ type="button"
+ onClick={() => rotateModelYaw(90)}
+ className="py-1 rounded bg-[#161616] hover:bg-[#2c2c2c] border border-white/[0.06] text-[11px] font-mono text-[#e5e5e5] cursor-pointer"
+ >
+ +90°
+ </button>
+ <button
+ type="button"
+ onClick={() => rotateModelYaw(180)}
+ className="py-1 rounded bg-[#161616] hover:bg-[#2c2c2c] border border-white/[0.06] text-[11px] font-mono text-[#e5e5e5] cursor-pointer"
+ >
+ 180°
+ </button>
+ </div>
+ </div>
- {showLTModal && (
- <div className="absolute top-full mt-2 right-0 bg-[#1b1e24] border border-purple-500/40 rounded-xl p-3 shadow-2xl z-50 flex flex-col space-y-2.5 w-60">
- <div className="flex items-center justify-between">
- <span className="text-xs font-semibold text-purple-300 flex items-center space-x-1">
- <Sparkles className="w-3.5 h-3.5" />
- <span>LT Line & Tone Extraction</span>
- </span>
- <button
- type="button"
- onClick={() => setShowLTModal(false)}
- className="text-gray-400 hover:text-white"
- >
- <X className="w-3.5 h-3.5" />
- </button>
- </div>
-
- <div className="flex flex-col space-y-1">
- <div className="flex items-center justify-between text-[11px] text-gray-300">
- <span>Line Sensitivity</span>
- <span className="font-mono text-cyan-400">{Math.round((1 - ltLineThreshold) * 100)}%</span>
+ {/* 3D Gizmo */}
+ <div className="space-y-1">
+ <span className="text-[10px] uppercase tracking-wider text-[#8a8a8a]">
+ 3D Gizmo
+ </span>
+ <div className="grid grid-cols-3 gap-1 bg-[#161616] p-0.5 rounded border border-white/[0.06]">
+ {(
+ [
+ ['none', 'Off'],
+ ['rotate', 'Rotate'],
+ ['translate', 'Move'],
+ ] as Array<[GizmoMode, string]>
+ ).map(([gMode, lbl]) => (
+ <button
+ key={gMode}
+ type="button"
+ onClick={() => setGizmoMode(gMode)}
+ className={`py-1 rounded text-[10px] transition-colors cursor-pointer ${
+ gizmoMode === gMode
+ ? 'bg-[#2c2c2c] text-[#e5e5e5] font-medium'
+ : 'text-[#8a8a8a] hover:text-[#e5e5e5]'
+ }`}
+ >
+ {lbl}
+ </button>
+ ))}
+ </div>
</div>
- <input
- type="range"
- min="0.1"
- max="0.6"
- step="0.02"
- value={ltLineThreshold}
- onChange={(e) => setLtLineThreshold(parseFloat(e.target.value))}
- className="w-full accent-purple-500 cursor-pointer h-1.5"
- />
- </div>
-
- <div className="flex flex-col space-y-1">
- <span className="text-[11px] text-gray-300">Screentone Quantization</span>
- <div className="flex space-x-2">
+
+ {/* Utility Actions */}
+ <div className="grid grid-cols-2 gap-1.5 pt-1 border-t border-white/[0.06]">
+ <button
+ type="button"
+ onClick={handleSnapToGround}
+ className="py-1.5 px-2 rounded bg-[#161616] hover:bg-[#2c2c2c] border border-white/[0.06] text-[11px] text-[#e5e5e5] cursor-pointer"
+ >
+ Snap Floor
+ </button>
<button
type="button"
- onClick={() => setLtToneBands(2)}
- className={`flex-1 py-1 rounded text-[10px] font-medium transition-colors ${
- ltToneBands === 2
- ? 'bg-purple-600 text-white'
- : 'bg-white/5 text-gray-400 hover:bg-white/10'
- }`}
+ onClick={handleResetModelTransform}
+ className="py-1.5 px-2 rounded bg-[#161616] hover:bg-[#2c2c2c] border border-white/[0.06] text-[11px] text-[#8a8a8a] hover:text-[#e5e5e5] cursor-pointer"
>
- 2 Bands (Shadow)
+ Reset Model
</button>
<button
type="button"
- onClick={() => setLtToneBands(3)}
- className={`flex-1 py-1 rounded text-[10px] font-medium transition-colors ${
- ltToneBands === 3
- ? 'bg-purple-600 text-white'
- : 'bg-white/5 text-gray-400 hover:bg-white/10'
- }`}
+ onClick={handleResetCamera}
+ className="col-span-2 py-1.5 px-2 rounded bg-[#161616] hover:bg-[#2c2c2c] border border-white/[0.06] text-[11px] text-[#8a8a8a] hover:text-[#e5e5e5] cursor-pointer"
>
- 3 Bands (Deep/Mid)
+ Reset Camera
</button>
</div>
- </div>
+ </>
+ )}
- <button
- type="button"
- onClick={() =>
- handleExtractLineAndTone({
- lineWidth: 1,
- lineThreshold: ltLineThreshold,
- toneCount: ltToneBands,
- folderName: '',
- })
- }
- disabled={isBaking}
- className="w-full py-1.5 bg-gradient-to-r from-purple-600 to-indigo-600 hover:from-purple-500 hover:to-indigo-500 text-white font-medium rounded text-xs transition-colors shadow-lg flex items-center justify-center space-x-1.5"
- >
- <CheckCircle2 className="w-3.5 h-3.5" />
- <span>Extract Line & Tone</span>
- </button>
- </div>
- )}
- </div>
+ {inspectorTab === 'scene' && (
+ <>
+ {/* Camera Presets */}
+ <div className="space-y-1">
+ <span className="text-[10px] uppercase tracking-wider text-[#8a8a8a]">
+ Camera Angle
+ </span>
+ <div className="grid grid-cols-3 gap-1">
+ {(
+ [
+ ['front', 'Front'],
+ ['threeQuarter', '3/4'],
+ ['side', 'Side'],
+ ['back', 'Back'],
+ ['top', 'Top'],
+ ['lowAngle', 'Low'],
+ ] as const
+ ).map(([preset, lbl]) => (
+ <button
+ key={preset}
+ type="button"
+ onClick={() => setCameraPreset(preset)}
+ className="py-1 rounded bg-[#161616] hover:bg-[#2c2c2c] border border-white/[0.06] text-[10px] text-[#cccccc] hover:text-[#e5e5e5] cursor-pointer"
+ >
+ {lbl}
+ </button>
+ ))}
+ </div>
+ </div>
- {/* Bake to 2D Layer */}
- <button
- type="button"
- onClick={handleBakeTo2D}
- disabled={isBaking || !modelRootRef.current}
- title={!modelRootRef.current ? 'Upload a model to convert to layer' : 'Convert to 2D Layer'}
- className="flex items-center space-x-1.5 bg-emerald-600 hover:bg-emerald-500 text-white font-medium px-3 py-1 rounded shadow-md transition-colors disabled:opacity-50 disabled:cursor-not-allowed"
- >
- <CheckCircle2 className="w-3.5 h-3.5" />
- <span className="text-xs">{isBaking ? 'Baking...' : 'Convert to 2D Layer'}</span>
- </button>
+ {/* Shading */}
+ <div className="space-y-1">
+ <span className="text-[10px] uppercase tracking-wider text-[#8a8a8a]">
+ Shading
+ </span>
+ <div className="grid grid-cols-3 gap-1 bg-[#161616] p-0.5 rounded border border-white/[0.06]">
+ {(['shaded', 'smooth', 'silhouette'] as ShadingMode[]).map((mode) => (
+ <button
+ key={mode}
+ type="button"
+ onClick={() => {
+ setShadingMode(mode);
+ applyShading(mode);
+ }}
+ className={`py-1 rounded text-[10px] capitalize transition-colors cursor-pointer ${
+ shadingMode === mode
+ ? 'bg-[#2c2c2c] text-[#e5e5e5] font-medium'
+ : 'text-[#8a8a8a] hover:text-[#e5e5e5]'
+ }`}
+ >
+ {mode}
+ </button>
+ ))}
+ </div>
+ </div>
- {/* Close */}
- <button
- onClick={onClose}
- title="Close 3D Viewport"
- className="p-1 text-gray-400 hover:text-red-400 hover:bg-white/10 rounded transition-colors"
- >
- <X className="w-4 h-4" />
- </button>
- </div>
- </div>,
+ {/* Sliders */}
+ <div className="space-y-2">
+ <div>
+ <div className="flex justify-between text-[11px] mb-0.5">
+ <span className="text-[#8a8a8a]">Perspective</span>
+ <span className="font-mono text-[#e5e5e5]">{perspective.toFixed(1)}x</span>
+ </div>
+ <input
+ type="range"
+ min="0.3"
+ max="2.5"
+ step="0.05"
+ value={perspective}
+ onChange={(e) => applyPerspectiveDollyZoom(parseFloat(e.target.value))}
+ className="w-full"
+ />
+ </div>
+
+ <div>
+ <div className="flex justify-between text-[11px] mb-0.5">
+ <span className="text-[#8a8a8a]">Opacity</span>
+ <span className="font-mono text-[#e5e5e5]">{Math.round(opacity * 100)}%</span>
+ </div>
+ <input
+ type="range"
+ min="0.1"
+ max="1"
+ step="0.05"
+ value={opacity}
+ onChange={(e) => setOpacity(parseFloat(e.target.value))}
+ className="w-full"
+ />
+ </div>
+ </div>
+
+ {/* Toggles */}
+ <div className="space-y-1.5 pt-1 border-t border-white/[0.06]">
+ <label className="flex items-center justify-between text-[11px] text-[#cccccc] cursor-pointer">
+ <span>Floor Grid</span>
+ <input
+ type="checkbox"
+ checked={showGrid}
+ onChange={(e) => setShowGrid(e.target.checked)}
+ />
+ </label>
+ <label className="flex items-center justify-between text-[11px] text-[#cccccc] cursor-pointer">
+ <span>Sync Perspective Ruler</span>
+ <input
+ type="checkbox"
+ checked={syncCameraPerspective}
+ onChange={(e) => {
+ const nextSync = e.target.checked;
+ setSyncCameraPerspective(nextSync);
+ if (nextSync && cameraRef.current && onUpdatePerspectiveRuler) {
+ const ruler = calculatePerspectiveFromCamera(
+ cameraRef.current,
+ dimensions.width,
+ dimensions.height,
+ perspectiveRuler
+ );
+ onUpdatePerspectiveRuler(ruler);
+ }
+ }}
+ />
+ </label>
+ </div>
+
+ {/* Collapsible Light Source */}
+ <div className="pt-1 border-t border-white/[0.06] space-y-2">
+ <button
+ type="button"
+ onClick={() => setShowLightPanel((v) => !v)}
+ className="w-full py-1 px-2 rounded bg-[#161616] hover:bg-[#2c2c2c] border border-white/[0.06] text-[11px] text-[#e5e5e5] flex items-center justify-between cursor-pointer"
+ >
+ <span>Lighting</span>
+ <span className="text-[10px] text-[#8a8a8a]">
+ {showLightPanel ? 'Hide' : 'Adjust'}
+ </span>
+ </button>
+
+ {showLightPanel && (
+ <LightSourceWidget
+ embedded
+ settings={lightSettings}
+ onChange={(s) => setLightSettings(s)}
+ onReset={() =>
+ setLightSettings({
+ azimuth: 45,
+ elevation: 45,
+ intensity: 1.5,
+ ambientIntensity: 0.65,
+ color: '#ffffff',
+ isBacklit: false,
+ })
+ }
+ />
+ )}
+ </div>
+ </>
+ )}
+
+ {inspectorTab === 'pose' && isMannequinActive && (
+ <>
+ {/* Pose Presets */}
+ <div className="space-y-1">
+ <span className="text-[10px] uppercase tracking-wider text-[#8a8a8a]">
+ Pose Presets
+ </span>
+ <div className="grid grid-cols-2 gap-1">
+ {(
+ [
+ ['standing', 'Standing'],
+ ['action', 'Action'],
+ ['sitting', 'Seated'],
+ ['fists', 'Fists'],
+ ['relaxed_palm', 'Relaxed'],
+ ] as Array<[PosePresetName, string]>
+ ).map(([preset, lbl]) => (
+ <button
+ key={preset}
+ type="button"
+ onClick={() => handleApplyPreset(preset)}
+ className="py-1.5 px-2 rounded bg-[#161616] hover:bg-[#2c2c2c] border border-white/[0.06] text-[11px] text-[#e5e5e5] text-left cursor-pointer"
+ >
+ {lbl}
+ </button>
+ ))}
+ </div>
+ </div>
+
+ {/* IK Limb Handles */}
+ <div className="space-y-1 pt-1 border-t border-white/[0.06]">
+ <div className="flex items-center justify-between">
+ <span className="text-[10px] uppercase tracking-wider text-[#8a8a8a]">
+ IK Limbs
+ </span>
+ {activeIKHandle && (
+ <button
+ type="button"
+ onClick={() => selectIKTarget(null)}
+ className="text-[10px] text-[#8a8a8a] hover:text-[#e5e5e5] cursor-pointer"
+ >
+ Deselect
+ </button>
+ )}
+ </div>
+ <div className="grid grid-cols-3 gap-1">
+ {(
+ [
+ ['head', 'Head'],
+ ['leftHand', 'L-Hand'],
+ ['rightHand', 'R-Hand'],
+ ['leftFoot', 'L-Foot'],
+ ['rightFoot', 'R-Foot'],
+ ] as const
+ ).map(([limb, lbl]) => (
+ <button
+ key={limb}
+ type="button"
+ onClick={() => selectIKTarget(activeIKHandle === limb ? null : limb)}
+ className={`py-1 px-1.5 rounded text-[10px] transition-colors cursor-pointer ${
+ activeIKHandle === limb
+ ? 'bg-[var(--accent)] text-[var(--accent-contrast)] font-medium'
+ : 'bg-[#161616] border border-white/[0.06] text-[#cccccc] hover:bg-[#2c2c2c]'
+ }`}
+ >
+ {lbl}
+ </button>
+ ))}
+ </div>
+ </div>
+ </>
+ )}
+ </div>
+ </div>
+ )}
+ </>,
document.body
)}
</>
diff --git a/src/components/MangaEffectsModal.tsx b/src/components/MangaEffectsModal.tsx
index 1ebf52c..9afb8a6 100644
--- a/src/components/MangaEffectsModal.tsx
+++ b/src/components/MangaEffectsModal.tsx
@@ -1,5 +1,5 @@
import React, { useState, useRef, useEffect, useCallback } from 'react';
-import { X, Sparkles, Check, RefreshCw } from 'lucide-react';
+import { X } from 'lucide-react';
import {
renderSaturatedLines,
renderStreamLines,
@@ -127,30 +127,27 @@ export const MangaEffectsModal: React.FC<MangaEffectsModalProps> = ({
};
return (
- <div className="fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-xs select-none">
- <div className="w-[680px] bg-[#222327] border border-[#3b3d45] rounded-lg shadow-2xl overflow-hidden flex flex-col text-[#cccccc] font-sans">
+ <div className="fixed inset-0 z-50 flex items-center justify-center bg-black/65 backdrop-blur-xs select-none">
+ <div className="w-[680px] bg-[#202020] border border-white/[0.1] rounded-lg shadow-2xl overflow-hidden flex flex-col text-[#e5e5e5] font-sans">
{/* Header */}
- <div className="px-4 py-3 bg-[#1a1b1e] border-b border-[#2e3036] flex items-center justify-between">
- <div className="flex items-center space-x-2">
- <Sparkles className="w-4 h-4 text-amber-400" />
- <h2 className="text-sm font-semibold text-white">Manga Effect Lines Generator</h2>
- </div>
+ <div className="px-4 py-2.5 bg-[#1a1a1a] border-b border-white/[0.06] flex items-center justify-between">
+ <h2 className="text-xs font-medium text-[#e5e5e5]">Manga Effect Lines</h2>
<button
onClick={onClose}
- className="p-1 rounded text-[#888888] hover:text-white hover:bg-[#2b2d31] transition-colors"
+ className="p-1 rounded text-[#8a8a8a] hover:text-[#e5e5e5] hover:bg-[#2c2c2c] transition-colors cursor-pointer"
>
- <X className="w-4 h-4" />
+ <X className="w-3.5 h-3.5" />
</button>
</div>
{/* Tab Switcher */}
- <div className="flex border-b border-[#2e3036] bg-[#1d1e21] px-4 pt-2">
+ <div className="flex border-b border-white/[0.06] bg-[#1a1a1a] px-4">
<button
onClick={() => setActiveTab('saturated')}
className={`px-3 py-1.5 text-xs font-medium border-b-2 transition-colors cursor-pointer ${
activeTab === 'saturated'
- ? 'border-cyan-400 text-cyan-300'
- : 'border-transparent text-[#888888] hover:text-[#cccccc]'
+ ? 'border-[var(--accent)] text-[#e5e5e5]'
+ : 'border-transparent text-[#8a8a8a] hover:text-[#e5e5e5]'
}`}
>
Saturated Lines (Focus / Burst)
@@ -159,8 +156,8 @@ export const MangaEffectsModal: React.FC<MangaEffectsModalProps> = ({
onClick={() => setActiveTab('stream')}
className={`px-3 py-1.5 text-xs font-medium border-b-2 transition-colors cursor-pointer ${
activeTab === 'stream'
- ? 'border-cyan-400 text-cyan-300'
- : 'border-transparent text-[#888888] hover:text-[#cccccc]'
+ ? 'border-[var(--accent)] text-[#e5e5e5]'
+ : 'border-transparent text-[#8a8a8a] hover:text-[#e5e5e5]'
}`}
>
Stream Lines (Parallel Speed)
@@ -171,7 +168,7 @@ export const MangaEffectsModal: React.FC<MangaEffectsModalProps> = ({
<div className="p-4 flex space-x-4 max-h-[480px]">
{/* Interactive Preview Canvas */}
<div className="flex flex-col items-center">
- <div className="relative border border-[#3b3d45] rounded overflow-hidden bg-white shadow-inner">
+ <div className="relative border border-white/[0.08] rounded overflow-hidden bg-white">
<canvas
ref={previewCanvasRef}
width={300}
@@ -182,7 +179,7 @@ export const MangaEffectsModal: React.FC<MangaEffectsModalProps> = ({
/>
</div>
{activeTab === 'saturated' && (
- <span className="text-[10px] text-[#777777] mt-1.5">
+ <span className="text-[10px] text-[#8a8a8a] mt-1.5">
Click preview to reposition focus point
</span>
)}
@@ -194,8 +191,8 @@ export const MangaEffectsModal: React.FC<MangaEffectsModalProps> = ({
<>
<div>
<div className="flex justify-between text-[11px] mb-1">
- <span className="text-[#aaaaaa]">Center Cutout Radius:</span>
- <span className="font-mono text-cyan-400">{satOptions.innerRadius}px</span>
+ <span className="text-[#8a8a8a]">Center Cutout Radius</span>
+ <span className="font-mono text-[#e5e5e5]">{satOptions.innerRadius}px</span>
</div>
<input
type="range"
@@ -205,14 +202,14 @@ export const MangaEffectsModal: React.FC<MangaEffectsModalProps> = ({
onChange={(e) =>
setSatOptions((p) => ({ ...p, innerRadius: Number(e.target.value) }))
}
- className="w-full accent-cyan-400"
+ className="w-full"
/>
</div>
<div>
<div className="flex justify-between text-[11px] mb-1">
- <span className="text-[#aaaaaa]">Line Density:</span>
- <span className="font-mono text-cyan-400">{satOptions.density} lines</span>
+ <span className="text-[#8a8a8a]">Line Density</span>
+ <span className="font-mono text-[#e5e5e5]">{satOptions.density} lines</span>
</div>
<input
type="range"
@@ -222,14 +219,14 @@ export const MangaEffectsModal: React.FC<MangaEffectsModalProps> = ({
onChange={(e) =>
setSatOptions((p) => ({ ...p, density: Number(e.target.value) }))
}
- className="w-full accent-cyan-400"
+ className="w-full"
/>
</div>
<div>
<div className="flex justify-between text-[11px] mb-1">
- <span className="text-[#aaaaaa]">Stroke Width:</span>
- <span className="font-mono text-cyan-400">{satOptions.lineWidth}px</span>
+ <span className="text-[#8a8a8a]">Stroke Width</span>
+ <span className="font-mono text-[#e5e5e5]">{satOptions.lineWidth}px</span>
</div>
<input
type="range"
@@ -239,14 +236,14 @@ export const MangaEffectsModal: React.FC<MangaEffectsModalProps> = ({
onChange={(e) =>
setSatOptions((p) => ({ ...p, lineWidth: Number(e.target.value) }))
}
- className="w-full accent-cyan-400"
+ className="w-full"
/>
</div>
<div>
<div className="flex justify-between text-[11px] mb-1">
- <span className="text-[#aaaaaa]">Spacing & Depth Jitter:</span>
- <span className="font-mono text-cyan-400">{Math.round(satOptions.spacingJitter * 100)}%</span>
+ <span className="text-[#8a8a8a]">Spacing & Depth Jitter</span>
+ <span className="font-mono text-[#e5e5e5]">{Math.round(satOptions.spacingJitter * 100)}%</span>
</div>
<input
type="range"
@@ -260,28 +257,28 @@ export const MangaEffectsModal: React.FC<MangaEffectsModalProps> = ({
lengthJitter: Number(e.target.value) / 100,
}))
}
- className="w-full accent-cyan-400"
+ className="w-full"
/>
</div>
<div className="flex items-center space-x-2 pt-1">
- <span className="text-[11px] text-[#aaaaaa]">Taper Direction:</span>
+ <span className="text-[11px] text-[#8a8a8a]">Taper Direction</span>
<button
onClick={() => setSatOptions((p) => ({ ...p, taper: 'in' }))}
- className={`px-2 py-0.5 rounded text-[11px] border ${
+ className={`px-2 py-0.5 rounded text-[11px] border transition-colors cursor-pointer ${
satOptions.taper === 'in'
- ? 'bg-cyan-500/20 text-cyan-300 border-cyan-500/40'
- : 'border-[#3b3d45] text-[#888888]'
+ ? 'bg-[var(--accent-subtle)] text-[var(--accent)] border-[var(--accent-border)]'
+ : 'bg-[#161616] border-white/[0.06] text-[#8a8a8a] hover:text-[#e5e5e5]'
}`}
>
Point to Center
</button>
<button
onClick={() => setSatOptions((p) => ({ ...p, taper: 'none' }))}
- className={`px-2 py-0.5 rounded text-[11px] border ${
+ className={`px-2 py-0.5 rounded text-[11px] border transition-colors cursor-pointer ${
satOptions.taper === 'none'
- ? 'bg-cyan-500/20 text-cyan-300 border-cyan-500/40'
- : 'border-[#3b3d45] text-[#888888]'
+ ? 'bg-[var(--accent-subtle)] text-[var(--accent)] border-[var(--accent-border)]'
+ : 'bg-[#161616] border-white/[0.06] text-[#8a8a8a] hover:text-[#e5e5e5]'
}`}
>
Uniform
@@ -292,8 +289,8 @@ export const MangaEffectsModal: React.FC<MangaEffectsModalProps> = ({
<>
<div>
<div className="flex justify-between text-[11px] mb-1">
- <span className="text-[#aaaaaa]">Angle:</span>
- <span className="font-mono text-cyan-400">{streamOptions.angle}°</span>
+ <span className="text-[#8a8a8a]">Angle</span>
+ <span className="font-mono text-[#e5e5e5]">{streamOptions.angle}°</span>
</div>
<div className="flex items-center space-x-2">
<input
@@ -304,35 +301,26 @@ export const MangaEffectsModal: React.FC<MangaEffectsModalProps> = ({
onChange={(e) =>
setStreamOptions((p) => ({ ...p, angle: Number(e.target.value) }))
}
- className="flex-1 accent-cyan-400"
+ className="flex-1"
/>
<div className="flex space-x-1">
- <button
- onClick={() => setStreamOptions((p) => ({ ...p, angle: 0 }))}
- className="px-1.5 py-0.5 rounded bg-[#18191c] border border-[#3b3d45] text-[10px]"
- >
- 0°
- </button>
- <button
- onClick={() => setStreamOptions((p) => ({ ...p, angle: 90 }))}
- className="px-1.5 py-0.5 rounded bg-[#18191c] border border-[#3b3d45] text-[10px]"
- >
- 90°
- </button>
- <button
- onClick={() => setStreamOptions((p) => ({ ...p, angle: 45 }))}
- className="px-1.5 py-0.5 rounded bg-[#18191c] border border-[#3b3d45] text-[10px]"
- >
- 45°
- </button>
+ {[0, 90, 45].map((deg) => (
+ <button
+ key={deg}
+ onClick={() => setStreamOptions((p) => ({ ...p, angle: deg }))}
+ className="px-1.5 py-0.5 rounded bg-[#161616] hover:bg-[#2c2c2c] border border-white/[0.06] text-[10px] text-[#e5e5e5] cursor-pointer"
+ >
+ {deg}°
+ </button>
+ ))}
</div>
</div>
</div>
<div>
<div className="flex justify-between text-[11px] mb-1">
- <span className="text-[#aaaaaa]">Density:</span>
- <span className="font-mono text-cyan-400">{streamOptions.density} lines</span>
+ <span className="text-[#8a8a8a]">Density</span>
+ <span className="font-mono text-[#e5e5e5]">{streamOptions.density} lines</span>
</div>
<input
type="range"
@@ -342,14 +330,14 @@ export const MangaEffectsModal: React.FC<MangaEffectsModalProps> = ({
onChange={(e) =>
setStreamOptions((p) => ({ ...p, density: Number(e.target.value) }))
}
- className="w-full accent-cyan-400"
+ className="w-full"
/>
</div>
<div>
<div className="flex justify-between text-[11px] mb-1">
- <span className="text-[#aaaaaa]">Streak Length:</span>
- <span className="font-mono text-cyan-400">{streamOptions.lineLength}px</span>
+ <span className="text-[#8a8a8a]">Streak Length</span>
+ <span className="font-mono text-[#e5e5e5]">{streamOptions.lineLength}px</span>
</div>
<input
type="range"
@@ -359,14 +347,14 @@ export const MangaEffectsModal: React.FC<MangaEffectsModalProps> = ({
onChange={(e) =>
setStreamOptions((p) => ({ ...p, lineLength: Number(e.target.value) }))
}
- className="w-full accent-cyan-400"
+ className="w-full"
/>
</div>
<div>
<div className="flex justify-between text-[11px] mb-1">
- <span className="text-[#aaaaaa]">Thickness:</span>
- <span className="font-mono text-cyan-400">{streamOptions.thickness}px</span>
+ <span className="text-[#8a8a8a]">Thickness</span>
+ <span className="font-mono text-[#e5e5e5]">{streamOptions.thickness}px</span>
</div>
<input
type="range"
@@ -376,14 +364,14 @@ export const MangaEffectsModal: React.FC<MangaEffectsModalProps> = ({
onChange={(e) =>
setStreamOptions((p) => ({ ...p, thickness: Number(e.target.value) }))
}
- className="w-full accent-cyan-400"
+ className="w-full"
/>
</div>
<div>
<div className="flex justify-between text-[11px] mb-1">
- <span className="text-[#aaaaaa]">Thickness & Length Noise:</span>
- <span className="font-mono text-cyan-400">
+ <span className="text-[#8a8a8a]">Thickness & Length Noise</span>
+ <span className="font-mono text-[#e5e5e5]">
{Math.round(streamOptions.thicknessNoise * 100)}%
</span>
</div>
@@ -399,7 +387,7 @@ export const MangaEffectsModal: React.FC<MangaEffectsModalProps> = ({
lengthNoise: Number(e.target.value) / 100,
}))
}
- className="w-full accent-cyan-400"
+ className="w-full"
/>
</div>
</>
@@ -408,10 +396,9 @@ export const MangaEffectsModal: React.FC<MangaEffectsModalProps> = ({
</div>
{/* Footer */}
- <div className="px-4 py-3 bg-[#1a1b1e] border-t border-[#2e3036] flex items-center justify-between">
+ <div className="px-4 py-2.5 bg-[#1a1a1a] border-t border-white/[0.06] flex items-center justify-between">
<button
onClick={() => {
- // Quick reset to defaults
if (activeTab === 'saturated') {
setSatOptions({
centerX: Math.round(canvasWidth * 0.5),
@@ -437,25 +424,23 @@ export const MangaEffectsModal: React.FC<MangaEffectsModalProps> = ({
});
}
}}
- className="flex items-center space-x-1 text-xs text-[#888888] hover:text-[#cccccc] transition-colors cursor-pointer"
+ className="text-xs text-[#8a8a8a] hover:text-[#e5e5e5] transition-colors cursor-pointer"
>
- <RefreshCw className="w-3 h-3" />
- <span>Reset Defaults</span>
+ Reset Defaults
</button>
<div className="flex items-center space-x-2">
<button
onClick={onClose}
- className="px-3 py-1.5 bg-[#2b2d31] hover:bg-[#383a40] text-[#cccccc] rounded text-xs transition-colors cursor-pointer"
+ className="px-3 py-1.5 bg-[#2c2c2c] hover:bg-[#383838] text-[#e5e5e5] rounded text-xs transition-colors cursor-pointer"
>
Cancel
</button>
<button
onClick={handleApplyClick}
- className="px-3.5 py-1.5 bg-[#234b3e] hover:bg-[#2b604f] text-[#55eaab] border border-[#2e6e58] rounded text-xs font-semibold flex items-center space-x-1.5 transition-colors cursor-pointer"
+ className="px-3.5 py-1.5 bg-[var(--accent)] text-[var(--accent-contrast)] hover:opacity-90 rounded text-xs font-medium transition-opacity cursor-pointer"
>
- <Check className="w-3.5 h-3.5" />
- <span>Apply Effect to Layer</span>
+ Apply Effect
</button>
</div>
</div>
diff --git a/src/components/ModernPropertyBar.tsx b/src/components/ModernPropertyBar.tsx
index c526672..cd0353f 100644
--- a/src/components/ModernPropertyBar.tsx
+++ b/src/components/ModernPropertyBar.tsx
@@ -43,7 +43,7 @@ export const ModernPropertyBar: React.FC<ModernPropertyBarProps> = ({
const brushDisplayName = brushSettings.brushName || (brushSettings.preset as string) || 'Brush';
return (
- <div className="h-9 px-3 flex items-center justify-between text-xs select-none z-20 shrink-0 bg-[#1e1f24] border-b border-white/[0.08] text-white/90">
+ <div className="h-9 px-3 flex items-center justify-between text-xs select-none z-20 shrink-0 bg-[#202020] border-b border-white/[0.06] text-[#e5e5e5]">
{/* Left controls */}
<div className="flex items-center space-x-2">
{/* Presets Button */}
@@ -97,7 +97,7 @@ export const ModernPropertyBar: React.FC<ModernPropertyBarProps> = ({
title="Brush Blending Mode"
>
{BLEND_MODES.map((bm) => (
- <option key={bm.value} value={bm.value} className="bg-[#1e1f24] text-white">
+ <option key={bm.value} value={bm.value} className="bg-[#202020] text-[#e5e5e5]">
{bm.label}
</option>
))}
diff --git a/src/components/NavigatorPanel.tsx b/src/components/NavigatorPanel.tsx
index 44e7107..540d1c2 100644
--- a/src/components/NavigatorPanel.tsx
+++ b/src/components/NavigatorPanel.tsx
@@ -217,7 +217,6 @@ export const NavigatorPanel: React.FC<NavigatorPanelProps> = React.memo(
themePreset = 'modern',
throttleMs = NAVIGATOR_PREVIEW_THROTTLE_MS,
}) => {
- const isVintage = themePreset === 'vintage-manga';
const stageRef = useRef<HTMLDivElement | null>(null);
const previewCanvasRef = useRef<HTMLCanvasElement | null>(null);
@@ -582,21 +581,17 @@ export const NavigatorPanel: React.FC<NavigatorPanelProps> = React.memo(
const m = metricsRef.current;
- const btnBase = isVintage
- ? 'h-5 px-1 rounded text-[10px] flex items-center justify-center text-[#d0d0d5] hover:text-white hover:bg-[#4e4e52] transition-colors cursor-pointer'
- : 'h-5 px-1 rounded text-[10px] flex items-center justify-center text-[#a3a3a3] hover:text-[#f5f5f5] hover:bg-[#2c2c2c] transition-colors cursor-pointer';
+ const btnBase =
+ 'h-5 px-1 rounded text-[10px] flex items-center justify-center text-[#a3a3a3] hover:text-[#f5f5f5] hover:bg-[#2c2c2c] transition-colors cursor-pointer';
- const btnActive = isVintage
- ? 'bg-[#337bb5] text-white'
- : 'bg-[var(--accent-subtle)] text-[var(--accent)] ring-1 ring-inset ring-[var(--accent-border)]';
+ const btnActive =
+ 'bg-[var(--accent-subtle)] text-[var(--accent)] ring-1 ring-inset ring-[var(--accent-border)]';
return (
<div
data-testid="navigator-panel"
data-theme-preset={themePreset}
- className={`flex flex-col h-full min-h-0 select-none ${
- isVintage ? 'bg-[#363638] text-[#e5e5e5]' : 'bg-[#202020] text-[#e5e5e5]'
- }`}
+ className="flex flex-col h-full min-h-0 select-none bg-[#202020] text-[#e5e5e5]"
>
{/* Interactive Canvas Preview Stage */}
<div
@@ -606,9 +601,9 @@ export const NavigatorPanel: React.FC<NavigatorPanelProps> = React.memo(
onPointerMove={handleStagePointerMove}
onPointerUp={finishStageDrag}
onPointerCancel={finishStageDrag}
- className={`relative flex-1 min-h-[76px] overflow-hidden ${
+ className={`relative flex-1 min-h-[76px] overflow-hidden bg-[#141414] ${
isDraggingFrame ? 'cursor-grabbing' : 'cursor-grab'
- } ${isVintage ? 'bg-[#252527]' : 'bg-[#141414]'}`}
+ }`}
title="Click or drag red viewport frame to pan canvas"
>
<canvas
@@ -632,13 +627,7 @@ export const NavigatorPanel: React.FC<NavigatorPanelProps> = React.memo(
</div>
{/* Compact Control Bar */}
- <div
- className={`shrink-0 px-1.5 py-1 flex flex-col gap-1 border-t ${
- isVintage
- ? 'bg-[#313134] border-[#232325]'
- : 'bg-[#1b1b1b] border-white/[0.06]'
- }`}
- >
+ <div className="shrink-0 px-1.5 py-1 flex flex-col gap-1 border-t bg-[#1b1b1b] border-white/[0.06]">
{/* Row 1: Zoom Controls */}
<div className="flex items-center gap-1">
<button
diff --git a/src/components/PerspectiveRulerOverlay.tsx b/src/components/PerspectiveRulerOverlay.tsx
index dc22aa7..0bc4cd2 100644
--- a/src/components/PerspectiveRulerOverlay.tsx
+++ b/src/components/PerspectiveRulerOverlay.tsx
@@ -16,11 +16,8 @@ import { canvasToScreen, screenToCanvas } from '../utils/canvasUtils';
import { CanvasDimensions } from '../types/editor';
import { CanvasNavigationHandle } from '../hooks/useCanvasNavigation';
import {
- Lock,
- Unlock,
Eye,
EyeOff,
- Magnet,
ChevronDown,
X,
} from 'lucide-react';
@@ -482,8 +479,7 @@ export const PerspectiveRulerOverlay: React.FC<PerspectiveRulerOverlayProps> = (
className="pointer-events-auto absolute -translate-x-1/2 -translate-y-1/2 cursor-grab active:cursor-grabbing z-30"
style={{ left: `${edgePos.x}px`, top: `${edgePos.y}px` }}
>
- <div className="flex items-center space-x-1 px-2 py-0.5 bg-white text-black border border-black/80 rounded-md shadow-lg text-[10px] font-mono font-bold hover:bg-neutral-100 transition-transform hover:scale-105 active:scale-95">
- <span>⊙</span>
+ <div className="flex items-center space-x-1 px-2 py-0.5 bg-white text-black border border-black/80 rounded shadow-lg text-[10px] font-mono font-semibold hover:bg-neutral-100 transition-transform hover:scale-105 active:scale-95">
<span>{vp.label}</span>
<span className="text-[9px] text-neutral-500 font-normal">
{Math.round(dist)}px
@@ -496,18 +492,18 @@ export const PerspectiveRulerOverlay: React.FC<PerspectiveRulerOverlayProps> = (
</>
)}
- {/* Floating Perspective Ruler Toolbar (Minimalist CSP Style) */}
+ {/* Floating Perspective Ruler Toolbar */}
<div
- className="pointer-events-auto absolute top-3 right-4 z-40 bg-[#1e1e20]/90 backdrop-blur-md border border-[#3e3e42] rounded-md shadow-2xl p-1.5 flex items-center space-x-1.5 text-xs text-[#cccccc] select-none font-sans"
+ className="pointer-events-auto absolute top-3 right-4 z-40 bg-[#202020]/95 backdrop-blur-md border border-white/[0.1] rounded-md shadow-2xl p-1 flex items-center space-x-1 text-[11px] text-[#e5e5e5] select-none font-sans"
>
{/* Toggle Ruler Visibility */}
<button
onClick={() => onUpdateRuler({ ...ruler, enabled: !ruler.enabled })}
title={ruler.enabled ? 'Hide Perspective Ruler' : 'Show Perspective Ruler'}
- className={`p-1.5 rounded transition-colors ${
+ className={`p-1 rounded transition-colors cursor-pointer ${
ruler.enabled
- ? 'bg-[#3b82f6]/20 text-[#38bdf8] border border-[#3b82f6]/40'
- : 'text-[#888888] hover:text-white hover:bg-[#2e2e32]'
+ ? 'bg-[var(--accent-subtle)] text-[var(--accent)]'
+ : 'text-[#8a8a8a] hover:text-[#e5e5e5] hover:bg-[#2c2c2c]'
}`}
>
{ruler.enabled ? <Eye className="w-3.5 h-3.5" /> : <EyeOff className="w-3.5 h-3.5" />}
@@ -517,20 +513,19 @@ export const PerspectiveRulerOverlay: React.FC<PerspectiveRulerOverlayProps> = (
<button
onClick={() => onUpdateRuler({ ...ruler, snapEnabled: !ruler.snapEnabled })}
title={`Perspective Snapping: ${ruler.snapEnabled ? 'ENABLED' : 'DISABLED'} (Hold Alt to freehand)`}
- className={`flex items-center space-x-1 px-2 py-1 rounded font-medium transition-colors ${
+ className={`px-2 py-1 rounded font-medium transition-colors cursor-pointer ${
ruler.snapEnabled
- ? 'bg-emerald-600/20 text-emerald-400 border border-emerald-500/40'
- : 'bg-[#2a2a2e] text-[#888888] hover:text-[#cccccc]'
+ ? 'bg-[var(--accent-subtle)] text-[var(--accent)] ring-1 ring-[var(--accent-border)]'
+ : 'bg-[#161616] text-[#8a8a8a] hover:text-[#e5e5e5] hover:bg-[#2c2c2c]'
}`}
>
- <Magnet className="w-3.5 h-3.5" />
- <span>Snap {ruler.snapEnabled ? 'ON' : 'OFF'}</span>
+ Snap {ruler.snapEnabled ? 'ON' : 'OFF'}
</button>
- <div className="w-px h-4 bg-[#3e3e42]" />
+ <div className="w-px h-4 bg-white/[0.08]" />
{/* 1P / 2P / 3P Mode Selector */}
- <div className="flex bg-[#141416] p-0.5 rounded border border-[#333338]">
+ <div className="flex bg-[#161616] p-0.5 rounded border border-white/[0.06]">
{(['1-point', '2-point', '3-point'] as PerspectiveType[]).map((mode) => {
const label = mode === '1-point' ? '1P' : mode === '2-point' ? '2P' : '3P';
const isActive = ruler.type === mode;
@@ -539,10 +534,10 @@ export const PerspectiveRulerOverlay: React.FC<PerspectiveRulerOverlayProps> = (
key={mode}
onClick={() => handleSwitchType(mode)}
title={`${label} Perspective`}
- className={`px-2 py-0.5 text-[11px] font-semibold rounded transition-colors ${
+ className={`px-2 py-0.5 text-[11px] font-medium rounded transition-colors cursor-pointer ${
isActive
- ? 'bg-[#38bdf8] text-black shadow-sm'
- : 'text-[#999999] hover:text-white'
+ ? 'bg-[var(--accent)] text-[var(--accent-contrast)]'
+ : 'text-[#8a8a8a] hover:text-[#e5e5e5]'
}`}
>
{label}
@@ -553,10 +548,10 @@ export const PerspectiveRulerOverlay: React.FC<PerspectiveRulerOverlayProps> = (
{/* Ray Count Stepper */}
<div
- className="flex items-center space-x-1 px-1.5 py-1 rounded bg-[#2a2a2e] text-[#cccccc] text-[11px]"
+ className="flex items-center space-x-1 px-1.5 py-0.5 rounded bg-[#161616] border border-white/[0.06] text-[#e5e5e5] text-[11px]"
title="Number of Guide Rays per Vanishing Point"
>
- <span className="text-[10px] text-[#888888] select-none font-medium">Lines:</span>
+ <span className="text-[10px] text-[#8a8a8a] select-none">Lines</span>
<button
onClick={() =>
onUpdateRuler({
@@ -565,12 +560,12 @@ export const PerspectiveRulerOverlay: React.FC<PerspectiveRulerOverlayProps> = (
})
}
disabled={(ruler.guideRayCount || 6) <= 2}
- className="w-4 h-4 flex items-center justify-center rounded bg-[#1e1e20] hover:bg-[#38383e] disabled:opacity-30 disabled:pointer-events-none text-white font-bold text-xs"
+ className="w-4 h-4 flex items-center justify-center rounded bg-[#202020] hover:bg-[#2c2c2c] disabled:opacity-30 disabled:pointer-events-none text-[#e5e5e5] font-mono text-xs cursor-pointer"
title="Decrease Guide Rays"
>
-
</button>
- <span className="w-4 text-center font-mono font-semibold text-white text-[11px]">
+ <span className="w-4 text-center font-mono text-[#e5e5e5] text-[11px]">
{ruler.guideRayCount || 6}
</span>
<button
@@ -581,7 +576,7 @@ export const PerspectiveRulerOverlay: React.FC<PerspectiveRulerOverlayProps> = (
})
}
disabled={(ruler.guideRayCount || 6) >= 16}
- className="w-4 h-4 flex items-center justify-center rounded bg-[#1e1e20] hover:bg-[#38383e] disabled:opacity-30 disabled:pointer-events-none text-white font-bold text-xs"
+ className="w-4 h-4 flex items-center justify-center rounded bg-[#202020] hover:bg-[#2c2c2c] disabled:opacity-30 disabled:pointer-events-none text-[#e5e5e5] font-mono text-xs cursor-pointer"
title="Increase Guide Rays"
>
+
@@ -596,14 +591,13 @@ export const PerspectiveRulerOverlay: React.FC<PerspectiveRulerOverlayProps> = (
? 'Ruler Locked (Handles frozen to prevent misclicks while inking)'
: 'Ruler Unlocked (Drag handles or eye level to adjust perspective)'
}
- className={`flex items-center space-x-1 px-2 py-1 rounded font-medium transition-colors ${
+ className={`px-2 py-1 rounded font-medium transition-colors cursor-pointer ${
ruler.locked
- ? 'bg-[#f59e0b]/20 text-amber-400 border border-[#f59e0b]/40'
- : 'bg-[#2a2a2e] text-[#cccccc] hover:text-white'
+ ? 'bg-[var(--accent-subtle)] text-[var(--accent)] ring-1 ring-[var(--accent-border)]'
+ : 'bg-[#161616] text-[#8a8a8a] hover:text-[#e5e5e5] hover:bg-[#2c2c2c]'
}`}
>
- {ruler.locked ? <Lock className="w-3.5 h-3.5" /> : <Unlock className="w-3.5 h-3.5" />}
- <span>{ruler.locked ? 'Locked' : 'Edit'}</span>
+ {ruler.locked ? 'Locked' : 'Edit'}
</button>
{/* Presets Dropdown */}
@@ -611,41 +605,41 @@ export const PerspectiveRulerOverlay: React.FC<PerspectiveRulerOverlayProps> = (
<button
onClick={() => setIsPresetsOpen((prev) => !prev)}
title="Preset Perspective Angles"
- className="flex items-center space-x-1 px-2 py-1 rounded bg-[#2a2a2e] text-[#cccccc] hover:text-white transition-colors"
+ className="flex items-center space-x-1 px-2 py-1 rounded bg-[#161616] text-[#8a8a8a] hover:text-[#e5e5e5] hover:bg-[#2c2c2c] transition-colors cursor-pointer"
>
<span>Presets</span>
<ChevronDown className="w-3 h-3" />
</button>
{isPresetsOpen && (
- <div className="absolute right-0 top-full mt-1.5 w-48 bg-[#1f1f23] border border-[#3e3e44] rounded shadow-2xl py-1 z-50 text-[11px]">
+ <div className="absolute right-0 top-full mt-1.5 w-48 bg-[#202020] border border-white/[0.1] rounded-md shadow-2xl py-1 z-50 text-[11px]">
<button
onClick={() => handleApplyPreset('1p-center')}
- className="w-full text-left px-3 py-1.5 hover:bg-[#2d2d34] flex items-center justify-between"
+ className="w-full text-left px-3 py-1.5 hover:bg-[#2c2c2c] text-[#e5e5e5] flex items-center justify-between cursor-pointer"
>
<span>1-Point Center</span>
- <span className="text-[10px] text-[#777777]">1 VP</span>
+ <span className="text-[10px] text-[#8a8a8a]">1 VP</span>
</button>
<button
onClick={() => handleApplyPreset('2p-wide')}
- className="w-full text-left px-3 py-1.5 hover:bg-[#2d2d34] flex items-center justify-between"
+ className="w-full text-left px-3 py-1.5 hover:bg-[#2c2c2c] text-[#e5e5e5] flex items-center justify-between cursor-pointer"
>
<span>2-Point Street (Wide)</span>
- <span className="text-[10px] text-[#777777]">2 VPs</span>
+ <span className="text-[10px] text-[#8a8a8a]">2 VPs</span>
</button>
<button
onClick={() => handleApplyPreset('3p-birds')}
- className="w-full text-left px-3 py-1.5 hover:bg-[#2d2d34] flex items-center justify-between"
+ className="w-full text-left px-3 py-1.5 hover:bg-[#2c2c2c] text-[#e5e5e5] flex items-center justify-between cursor-pointer"
>
<span>3-Point Bird's-Eye</span>
- <span className="text-[10px] text-[#777777]">High Angle</span>
+ <span className="text-[10px] text-[#8a8a8a]">High Angle</span>
</button>
<button
onClick={() => handleApplyPreset('3p-worms')}
- className="w-full text-left px-3 py-1.5 hover:bg-[#2d2d34] flex items-center justify-between"
+ className="w-full text-left px-3 py-1.5 hover:bg-[#2c2c2c] text-[#e5e5e5] flex items-center justify-between cursor-pointer"
>
<span>3-Point Worm's-Eye</span>
- <span className="text-[10px] text-[#777777]">Low Angle</span>
+ <span className="text-[10px] text-[#8a8a8a]">Low Angle</span>
</button>
</div>
)}
@@ -656,7 +650,7 @@ export const PerspectiveRulerOverlay: React.FC<PerspectiveRulerOverlayProps> = (
<button
onClick={onRemoveRuler}
title="Remove Perspective Ruler from Canvas"
- className="p-1 rounded text-[#888888] hover:text-red-400 hover:bg-red-500/10 transition-colors ml-0.5"
+ className="p-1 rounded text-[#8a8a8a] hover:text-[#e5e5e5] hover:bg-[#2c2c2c] transition-colors cursor-pointer"
>
<X className="w-3.5 h-3.5" />
</button>
diff --git a/src/components/QuickAccessPanel.tsx b/src/components/QuickAccessPanel.tsx
index 049034b..9656d3f 100644
--- a/src/components/QuickAccessPanel.tsx
+++ b/src/components/QuickAccessPanel.tsx
@@ -22,6 +22,7 @@ import {
SlidersHorizontal,
Palette,
PenTool,
+ Shapes,
} from 'lucide-react';
import { ToolType } from '../types/editor';
import { ThemePreset } from '../types/settings';
@@ -49,6 +50,7 @@ const QUICK_TOOL_CATALOG: Array<{ id: ToolType; label: string }> = [
{ id: 'pipette', label: 'Eyedropper' },
{ id: 'liquify', label: 'Liquify' },
{ id: 'fill', label: 'Fill Bucket' },
+ { id: 'shape', label: 'Shapes' },
{ id: 'select-rect', label: 'Marquee' },
{ id: 'select-lasso', label: 'Lasso' },
{ id: 'select-wand', label: 'Magic Wand' },
@@ -73,6 +75,8 @@ function renderToolIcon(tool: ToolType): React.ReactNode {
return <LiquifyIcon className={cls} />;
case 'fill':
return <PaintBucket className={cls} />;
+ case 'shape':
+ return <Shapes className={cls} />;
case 'select-rect':
return <BoxSelect className={cls} />;
case 'select-lasso':
@@ -117,7 +121,6 @@ export const QuickAccessPanel: React.FC<QuickAccessPanelProps> = React.memo(({
const [isEditing, setIsEditing] = useState(false);
const [addTab, setAddTab] = useState<'command' | 'tool' | 'brush'>('command');
- const isVintage = themePreset === 'vintage-manga';
const handleActivateItem = (item: QuickAccessItem) => {
if (item.kind === 'command' && item.commandId) {
@@ -182,18 +185,10 @@ export const QuickAccessPanel: React.FC<QuickAccessPanelProps> = React.memo(({
<div
data-testid="quick-access-panel"
data-theme-preset={themePreset}
- className={`flex flex-col h-full min-h-0 select-none text-xs ${
- isVintage ? 'bg-[#363638] text-[#e5e5e5]' : 'bg-[#202020] text-[#e5e5e5]'
- }`}
+ className="flex flex-col h-full min-h-0 select-none text-xs bg-[#202020] text-[#e5e5e5]"
>
{/* Toolbar: Grid/List + Edit Mode */}
- <div
- className={`h-7 px-1.5 flex items-center justify-between shrink-0 ${
- isVintage
- ? 'bg-[#2e2e31] border-b border-[#232325]'
- : 'bg-[#1a1a1a] border-b border-white/[0.06]'
- }`}
- >
+ <div className="h-7 px-1.5 flex items-center justify-between shrink-0 bg-[#1a1a1a] border-b border-white/[0.06]">
<div className="flex items-center gap-0.5">
<button
type="button"
@@ -283,11 +278,7 @@ export const QuickAccessPanel: React.FC<QuickAccessPanelProps> = React.memo(({
disabled
? 'opacity-30 cursor-not-allowed bg-[#161616] text-[#8a8a8a]'
: active
- ? isVintage
- ? 'bg-[#337bb5] text-white border border-[#4e95cf] cursor-pointer'
- : 'bg-[var(--accent-subtle)] text-[var(--accent)] border border-[var(--accent-border)] cursor-pointer'
- : isVintage
- ? 'bg-[#2c2c2f] hover:bg-[#444448] text-[#d0d0d5] border border-[#232325] cursor-pointer'
+ ? 'bg-[var(--accent-subtle)] text-[var(--accent)] border border-[var(--accent-border)] cursor-pointer'
: 'bg-[#161616] hover:bg-[#2c2c2c] text-[#cccccc] hover:text-white border border-transparent cursor-pointer'
}`}
>
@@ -328,11 +319,7 @@ export const QuickAccessPanel: React.FC<QuickAccessPanelProps> = React.memo(({
key={item.id}
className={`flex items-center gap-1 rounded px-1.5 py-1 transition-colors ${
active
- ? isVintage
- ? 'bg-[#337bb5] text-white'
- : 'bg-[var(--accent-subtle)] text-[var(--accent)]'
- : isVintage
- ? 'bg-[#2c2c2f] hover:bg-[#444448] text-[#d0d0d5]'
+ ? 'bg-[var(--accent-subtle)] text-[var(--accent)]'
: 'bg-[#161616] hover:bg-[#2c2c2c] text-[#cccccc]'
}`}
>
diff --git a/src/components/RightSidebar.tsx b/src/components/RightSidebar.tsx
index 14dc9e3..d533d75 100644
--- a/src/components/RightSidebar.tsx
+++ b/src/components/RightSidebar.tsx
@@ -18,7 +18,6 @@ import {
Compass,
Link2,
SlidersHorizontal,
- Sparkles,
Frame,
Type,
MessageSquare,
@@ -1581,10 +1580,9 @@ export const RightSidebar: React.FC<RightSidebarProps> = React.memo(({
onOpenLayerStylesModal(targetLayer.id);
setContextMenu(null);
}}
- className="w-full text-left px-2.5 py-1 rounded hover:bg-[#2c2c2c] flex items-center gap-1.5 cursor-pointer"
+ className="w-full text-left px-2.5 py-1 rounded hover:bg-[#2c2c2c] cursor-pointer"
>
- <Sparkles className="w-3 h-3 text-[#8a8a8a]" />
- <span>Layer Styles...</span>
+ Layer Styles...
</button>
)}
diff --git a/src/components/SelectionOverlay.tsx b/src/components/SelectionOverlay.tsx
index 00db393..01e9eeb 100644
--- a/src/components/SelectionOverlay.tsx
+++ b/src/components/SelectionOverlay.tsx
@@ -6,14 +6,8 @@ import {
} from '../types/editor';
import {
X,
- Scaling,
- PaintBucket,
Trash2,
- Sparkles,
RotateCcw,
- Maximize2,
- Minimize2,
- Feather,
} from 'lucide-react';
import { maskToSvgPath } from '../utils/selectionUtils';
@@ -152,134 +146,113 @@ export const SelectionOverlay: React.FC<SelectionOverlayProps> = ({
}}
onPointerDown={(e) => e.stopPropagation()}
>
- <div className="bg-[#18191b] border border-[#33353b] rounded shadow-2xl px-2 py-1 flex items-center space-x-1 whitespace-nowrap text-xs text-[#cccccc]">
- {/* Expand */}
+ <div className="bg-[#202020]/95 backdrop-blur-md border border-white/[0.1] rounded-md shadow-2xl px-1.5 py-1 flex items-center space-x-1 whitespace-nowrap text-[11px] text-[#e5e5e5]">
<button
onClick={() => onExpandSelection?.(5)}
title="Expand Selection (+5px)"
- className="px-1.5 py-0.5 hover:text-white hover:bg-[#25272a] rounded flex items-center space-x-1 cursor-pointer transition-colors"
+ className="px-1.5 py-0.5 text-[#cccccc] hover:text-[#e5e5e5] hover:bg-[#2c2c2c] rounded cursor-pointer transition-colors"
>
- <Maximize2 className="w-3 h-3 text-cyan-400" />
- <span>Expand</span>
+ Expand
</button>
- {/* Contract */}
<button
onClick={() => onContractSelection?.(5)}
title="Contract Selection (-5px)"
- className="px-1.5 py-0.5 hover:text-white hover:bg-[#25272a] rounded flex items-center space-x-1 cursor-pointer transition-colors"
+ className="px-1.5 py-0.5 text-[#cccccc] hover:text-[#e5e5e5] hover:bg-[#2c2c2c] rounded cursor-pointer transition-colors"
>
- <Minimize2 className="w-3 h-3 text-cyan-400" />
- <span>Contract</span>
+ Contract
</button>
- {/* Feather */}
<button
onClick={() => onFeatherSelection?.(5)}
title="Feather Selection (5px)"
- className="px-1.5 py-0.5 hover:text-white hover:bg-[#25272a] rounded flex items-center space-x-1 cursor-pointer transition-colors"
+ className="px-1.5 py-0.5 text-[#cccccc] hover:text-[#e5e5e5] hover:bg-[#2c2c2c] rounded cursor-pointer transition-colors"
>
- <Feather className="w-3 h-3 text-cyan-400" />
- <span>Feather</span>
+ Feather
</button>
- <div className="w-px h-3.5 bg-[#33353b]" />
+ <div className="w-px h-3.5 bg-white/[0.08]" />
- {/* Invert */}
<button
onClick={onInvertSelection}
title="Invert Selection (Ctrl+Shift+I)"
- className="px-1.5 py-0.5 hover:text-white hover:bg-[#25272a] rounded flex items-center space-x-1 cursor-pointer transition-colors"
+ className="px-1.5 py-0.5 text-[#cccccc] hover:text-[#e5e5e5] hover:bg-[#2c2c2c] rounded cursor-pointer transition-colors"
>
- <RotateCcw className="w-3 h-3 text-amber-400" />
- <span>Invert</span>
+ Invert
</button>
- {/* Transform */}
<button
onClick={onTransformSelection}
title="Transform Selection (Ctrl+T)"
- className="px-1.5 py-0.5 hover:text-white hover:bg-[#25272a] rounded flex items-center space-x-1 cursor-pointer transition-colors"
+ className="px-1.5 py-0.5 text-[var(--accent)] hover:bg-[#2c2c2c] rounded font-medium cursor-pointer transition-colors"
>
- <Scaling className="w-3 h-3 text-emerald-400" />
- <span>Transform</span>
+ Transform
</button>
- {/* Deselect */}
<button
onClick={onDeselect}
title="Deselect (Ctrl+D)"
- className="p-1 hover:text-rose-400 hover:bg-[#25272a] rounded cursor-pointer transition-colors"
+ className="p-1 text-[#8a8a8a] hover:text-[#e5e5e5] hover:bg-[#2c2c2c] rounded cursor-pointer transition-colors"
>
- <X className="w-3.5 h-3.5 text-rose-400" />
+ <X className="w-3.5 h-3.5" />
</button>
</div>
</div>
- {/* 4. CSP-Style Selection Launcher Bar (Fixed at bottom center of viewport) */}
+ {/* 4. Selection Launcher Bar (Fixed at bottom center of viewport) */}
{createPortal(
<div
- className="fixed bottom-10 left-1/2 -translate-x-1/2 z-50 bg-[#1e1f22] border border-[#383a40] rounded shadow-2xl px-2 py-1.5 flex items-center space-x-1.5 select-none animate-in fade-in slide-in-from-bottom-2 duration-150"
+ className="fixed bottom-10 left-1/2 -translate-x-1/2 z-50 bg-[#202020]/95 backdrop-blur-md border border-white/[0.1] rounded-md shadow-2xl px-2 py-1 flex items-center space-x-1.5 select-none text-[11px]"
onPointerDown={(e) => e.stopPropagation()}
>
- {/* Deselect */}
<button
onClick={onDeselect}
title="Deselect (Ctrl+D)"
- className="p-1.5 text-[#999999] hover:text-white hover:bg-[#2b2d31] rounded transition-colors cursor-pointer flex items-center space-x-1 text-xs"
+ className="px-2 py-1 text-[#8a8a8a] hover:text-[#e5e5e5] hover:bg-[#2c2c2c] rounded transition-colors cursor-pointer"
>
- <X className="w-4 h-4 text-red-400" />
- <span className="hidden sm:inline">Deselect</span>
+ Deselect
</button>
- <div className="w-px h-4 bg-[#383a40]" />
+ <div className="w-px h-4 bg-white/[0.08]" />
- {/* Screen Tone Fill (CSP Halftone Fill) */}
<button
onClick={onFillScreentone}
- title="Fill Screentone into New Layer (CSP Tone Effect)"
- className="p-1.5 bg-[#293d45] hover:bg-[#344d57] text-[#5ce1e6] border border-[#3e5e6b] rounded transition-colors cursor-pointer flex items-center space-x-1.5 text-xs font-medium shadow-xs"
+ title="Fill Screentone into New Layer"
+ className="px-2 py-1 bg-[var(--accent-subtle)] hover:bg-[#2c2c2c] text-[var(--accent)] border border-[var(--accent-border)] rounded transition-colors cursor-pointer font-medium"
>
- <Sparkles className="w-4 h-4 text-[#5ce1e6]" />
- <span>Screentone Fill</span>
+ Screentone
</button>
- {/* Transform Selection (Ctrl+T) */}
<button
onClick={onTransformSelection}
title="Transform Selection (Ctrl+T)"
- className="p-1.5 text-[#cccccc] hover:text-white hover:bg-[#2b2d31] rounded transition-colors cursor-pointer flex items-center space-x-1 text-xs"
+ className="px-2 py-1 text-[#e5e5e5] hover:bg-[#2c2c2c] rounded transition-colors cursor-pointer"
>
- <Scaling className="w-4 h-4 text-cyan-400" />
- <span>Transform</span>
+ Transform
</button>
- {/* Fill with Foreground Color */}
<button
onClick={onFillColor}
title="Fill with Foreground Color (Alt+Del)"
- className="p-1.5 text-[#cccccc] hover:text-white hover:bg-[#2b2d31] rounded transition-colors cursor-pointer flex items-center space-x-1 text-xs"
+ className="px-2 py-1 text-[#e5e5e5] hover:bg-[#2c2c2c] rounded transition-colors cursor-pointer"
>
- <PaintBucket className="w-4 h-4 text-amber-400" />
- <span className="hidden sm:inline">Fill</span>
+ Fill
</button>
- {/* Clear Selection Pixels */}
<button
onClick={onClearSelection}
title="Clear / Delete Selected Pixels (Del)"
- className="p-1.5 text-[#cccccc] hover:text-red-400 hover:bg-[#2b2d31] rounded transition-colors cursor-pointer flex items-center space-x-1 text-xs"
+ className="p-1 text-[#8a8a8a] hover:text-rose-400 hover:bg-[#2c2c2c] rounded transition-colors cursor-pointer"
>
- <Trash2 className="w-4 h-4" />
+ <Trash2 className="w-3.5 h-3.5" />
</button>
- {/* Invert Selection */}
<button
onClick={onInvertSelection}
title="Invert Selection (Ctrl+Shift+I)"
- className="p-1.5 text-[#cccccc] hover:text-white hover:bg-[#2b2d31] rounded transition-colors cursor-pointer flex items-center space-x-1 text-xs"
+ className="p-1 text-[#8a8a8a] hover:text-[#e5e5e5] hover:bg-[#2c2c2c] rounded transition-colors cursor-pointer"
>
- <RotateCcw className="w-4 h-4" />
+ <RotateCcw className="w-3.5 h-3.5" />
</button>
</div>,
document.body
diff --git a/src/components/SettingsModal.tsx b/src/components/SettingsModal.tsx
index b1bd1b6..5586c15 100644
--- a/src/components/SettingsModal.tsx
+++ b/src/components/SettingsModal.tsx
@@ -379,40 +379,6 @@ export const SettingsModal: React.FC<SettingsModalProps> = ({
<div className="flex-1 p-5 overflow-y-auto bg-[#202020] space-y-5">
{activeTab === 'appearance' && (
<>
- <section className="space-y-2.5">
- <div>
- <h3 className="text-xs font-medium text-[#e5e5e5]">Interface Theme</h3>
- <p className="text-[11px] text-[#8a8a8a]">
- Switch between Modern dark chrome and Vintage Manga Studio beveled UI
- </p>
- </div>
- <div className="grid grid-cols-2 gap-1.5">
- {(
- [
- { id: 'modern', label: 'Modern Studio', desc: 'Flat dark + accent' },
- { id: 'vintage-manga', label: 'Vintage Manga', desc: 'Classic CSP bevel' },
- ] as const
- ).map((opt) => {
- const isSelected = localSettings.themePreset === opt.id;
- return (
- <button
- key={opt.id}
- type="button"
- onClick={() => handleChange('themePreset', opt.id)}
- className={`flex flex-col items-start px-3 py-2 rounded text-left transition-colors cursor-pointer ${
- isSelected
- ? 'bg-[#2c2c2c] text-[#e5e5e5] ring-1 ring-[var(--accent-border)]'
- : 'bg-[#161616] text-[#8a8a8a] hover:text-[#e5e5e5] hover:bg-[#2c2c2c]/60'
- }`}
- >
- <span className="text-xs font-medium">{opt.label}</span>
- <span className="text-[10px] text-[#8a8a8a]">{opt.desc}</span>
- </button>
- );
- })}
- </div>
- </section>
-
<section className="space-y-2.5">
<div className="flex items-center justify-between">
<div>
diff --git a/src/components/SimpleToneModal.tsx b/src/components/SimpleToneModal.tsx
index 39cc1df..0b5c76a 100644
--- a/src/components/SimpleToneModal.tsx
+++ b/src/components/SimpleToneModal.tsx
@@ -1,5 +1,5 @@
import React, { useState, useEffect, useRef } from 'react';
-import { X, Check, Sparkles } from 'lucide-react';
+import { X } from 'lucide-react';
import { HalftoneDotShape, applyScreentoneCPU } from '../utils/screentoneEngine';
export interface SimpleToneSettings {
@@ -123,21 +123,16 @@ export const SimpleToneModal: React.FC<SimpleToneModalProps> = ({
className="fixed inset-0 z-50 flex items-center justify-center bg-black/65 backdrop-blur-xs select-none"
onPointerDown={(e) => e.stopPropagation()}
>
- <div className="bg-[#1e1f22] border border-[#383a40] rounded-lg shadow-2xl w-96 flex flex-col overflow-hidden text-[#cccccc] animate-in fade-in zoom-in-95 duration-150">
+ <div className="bg-[#202020] border border-white/[0.1] rounded-lg shadow-2xl w-96 flex flex-col overflow-hidden text-[#e5e5e5]">
{/* Header */}
- <div className="px-4 py-3 bg-[#2b2d31] border-b border-[#383a40] flex items-center justify-between">
- <div className="flex items-center space-x-2">
- <Sparkles className="w-4 h-4 text-amber-400" />
- <h2 className="text-xs font-semibold text-white tracking-wide uppercase">
- Simple Tone Settings
- </h2>
- </div>
+ <div className="px-4 py-2.5 bg-[#1a1a1a] border-b border-white/[0.06] flex items-center justify-between">
+ <h2 className="text-xs font-medium text-[#e5e5e5]">Simple Tone Settings</h2>
<button
onClick={onClose}
- className="text-[#999999] hover:text-white p-1 rounded hover:bg-[#35373c] transition-colors"
+ className="text-[#8a8a8a] hover:text-[#e5e5e5] p-1 rounded hover:bg-[#2c2c2c] transition-colors cursor-pointer"
title="Cancel (Esc)"
>
- <X className="w-4 h-4" />
+ <X className="w-3.5 h-3.5" />
</button>
</div>
@@ -147,12 +142,12 @@ export const SimpleToneModal: React.FC<SimpleToneModalProps> = ({
<div className="flex gap-4">
{/* Swatch Preview */}
<div className="flex flex-col items-center">
- <span className="text-[10px] text-[#999999] mb-1 font-medium">Preview</span>
- <div className="w-[120px] h-[120px] rounded border border-[#383a40] bg-white overflow-hidden shadow-inner flex items-center justify-center">
+ <span className="text-[10px] text-[#8a8a8a] mb-1">Preview</span>
+ <div className="w-[120px] h-[120px] rounded border border-white/[0.08] bg-white overflow-hidden flex items-center justify-center">
<canvas ref={previewCanvasRef} className="w-full h-full" />
</div>
- <span className="text-[9px] text-[#777777] font-mono mt-1">
- {frequency}L • {densityType === 'specified' ? `${density}%` : 'Lum'}
+ <span className="text-[9px] text-[#8a8a8a] font-mono mt-1">
+ {frequency}L · {densityType === 'specified' ? `${density}%` : 'Lum'}
</span>
</div>
@@ -160,29 +155,25 @@ export const SimpleToneModal: React.FC<SimpleToneModalProps> = ({
<div className="flex-1 space-y-3">
{/* Dot Shape */}
<div>
- <label className="text-[10px] text-[#999999] font-medium block mb-1">
- Dot Shape:
- </label>
+ <label className="text-[10px] text-[#8a8a8a] block mb-1">Dot Shape</label>
<select
value={dotShape}
onChange={(e) => setDotShape(e.target.value as HalftoneDotShape)}
- className="w-full bg-[#252526] border border-[#3a3a3a] text-[#cccccc] text-xs rounded px-2 py-1 outline-none cursor-pointer hover:border-[#555555] focus:border-amber-400"
+ className="w-full bg-[#161616] border border-white/[0.08] text-[#e5e5e5] text-xs rounded px-2 py-1 cursor-pointer"
>
- <option value="circle">Circle (Standard CSP)</option>
- <option value="euclidean">Euclidean (Classic Halftone)</option>
+ <option value="circle">Circle (Standard)</option>
+ <option value="euclidean">Euclidean (Halftone)</option>
<option value="line">Line (Hatching)</option>
</select>
</div>
{/* Density Mode */}
<div>
- <label className="text-[10px] text-[#999999] font-medium block mb-1">
- Density Mode:
- </label>
+ <label className="text-[10px] text-[#8a8a8a] block mb-1">Density Mode</label>
<select
value={densityType}
onChange={(e) => setDensityType(e.target.value as 'specified' | 'image')}
- className="w-full bg-[#252526] border border-[#3a3a3a] text-[#cccccc] text-xs rounded px-2 py-1 outline-none cursor-pointer hover:border-[#555555] focus:border-amber-400"
+ className="w-full bg-[#161616] border border-white/[0.08] text-[#e5e5e5] text-xs rounded px-2 py-1 cursor-pointer"
>
<option value="specified">Use specified density</option>
<option value="image">Use image brightness</option>
@@ -192,8 +183,8 @@ export const SimpleToneModal: React.FC<SimpleToneModalProps> = ({
{/* Angle */}
<div>
<div className="flex items-center justify-between text-[10px] mb-1">
- <span className="text-[#999999] font-medium">Angle:</span>
- <span className="font-mono text-amber-300 font-bold">{angle}°</span>
+ <span className="text-[#8a8a8a]">Angle</span>
+ <span className="font-mono text-[#e5e5e5]">{angle}°</span>
</div>
<input
type="range"
@@ -202,16 +193,16 @@ export const SimpleToneModal: React.FC<SimpleToneModalProps> = ({
step="1"
value={angle}
onChange={(e) => setAngle(parseInt(e.target.value, 10))}
- className="w-full cursor-pointer h-1.5 accent-amber-400"
+ className="w-full"
/>
- <div className="flex items-center justify-between text-[8px] text-[#666666] font-mono mt-0.5">
+ <div className="flex items-center justify-between text-[9px] text-[#8a8a8a] font-mono mt-0.5">
{ANGLE_PRESETS.map((p) => (
<button
key={p}
type="button"
onClick={() => setAngle(p)}
- className={`hover:text-amber-300 transition-colors ${
- angle === p ? 'text-amber-400 font-bold' : ''
+ className={`hover:text-[#e5e5e5] transition-colors cursor-pointer ${
+ angle === p ? 'text-[var(--accent)] font-semibold' : ''
}`}
>
{p}°
@@ -224,9 +215,9 @@ export const SimpleToneModal: React.FC<SimpleToneModalProps> = ({
{/* Density Slider & Presets (when specified) */}
{densityType === 'specified' && (
- <div className="p-2.5 bg-[#252526] rounded border border-[#383a40]">
+ <div className="p-2.5 bg-[#161616] rounded border border-white/[0.06]">
<div className="flex items-center justify-between text-xs mb-1.5">
- <span className="text-[#cccccc] font-medium">Density:</span>
+ <span className="text-[#cccccc]">Density</span>
<div className="flex items-center space-x-1">
<input
type="number"
@@ -237,9 +228,9 @@ export const SimpleToneModal: React.FC<SimpleToneModalProps> = ({
const v = parseInt(e.target.value, 10);
if (!isNaN(v)) setDensity(Math.max(1, Math.min(100, v)));
}}
- className="w-12 bg-[#1e1f22] border border-[#383a40] text-amber-300 font-mono text-xs rounded px-1.5 py-0.5 text-right outline-none focus:border-amber-400"
+ className="w-12 bg-[#202020] border border-white/[0.08] text-[#e5e5e5] font-mono text-xs rounded px-1.5 py-0.5 text-right"
/>
- <span className="text-xs text-[#888888] font-mono">%</span>
+ <span className="text-xs text-[#8a8a8a] font-mono">%</span>
</div>
</div>
<input
@@ -249,16 +240,16 @@ export const SimpleToneModal: React.FC<SimpleToneModalProps> = ({
step="1"
value={density}
onChange={(e) => setDensity(parseInt(e.target.value, 10))}
- className="w-full cursor-pointer h-1.5 accent-amber-400 mb-1.5"
+ className="w-full mb-1.5"
/>
- <div className="flex items-center justify-between text-[9px] text-[#888888] font-mono">
+ <div className="flex items-center justify-between text-[9px] text-[#8a8a8a] font-mono">
{DENSITY_PRESETS.map((p) => (
<button
key={p}
type="button"
onClick={() => setDensity(p)}
- className={`hover:text-amber-300 px-1 py-0.5 rounded transition-colors ${
- density === p ? 'bg-amber-500/20 text-amber-400 font-bold' : ''
+ className={`hover:text-[#e5e5e5] px-1 py-0.5 rounded transition-colors cursor-pointer ${
+ density === p ? 'bg-[var(--accent-subtle)] text-[var(--accent)] font-semibold' : ''
}`}
>
{p}%
@@ -269,9 +260,9 @@ export const SimpleToneModal: React.FC<SimpleToneModalProps> = ({
)}
{/* Frequency (Lines / LPI) */}
- <div className="p-2.5 bg-[#252526] rounded border border-[#383a40]">
+ <div className="p-2.5 bg-[#161616] rounded border border-white/[0.06]">
<div className="flex items-center justify-between text-xs mb-1.5">
- <span className="text-[#cccccc] font-medium">Number of screen lines (LPI):</span>
+ <span className="text-[#cccccc]">Screen Frequency (LPI)</span>
<div className="flex items-center space-x-1">
<input
type="number"
@@ -283,9 +274,9 @@ export const SimpleToneModal: React.FC<SimpleToneModalProps> = ({
const v = parseFloat(e.target.value);
if (!isNaN(v)) setFrequency(Math.max(20, Math.min(85, v)));
}}
- className="w-12 bg-[#1e1f22] border border-[#383a40] text-amber-300 font-mono text-xs rounded px-1.5 py-0.5 text-right outline-none focus:border-amber-400"
+ className="w-12 bg-[#202020] border border-white/[0.08] text-[#e5e5e5] font-mono text-xs rounded px-1.5 py-0.5 text-right"
/>
- <span className="text-xs text-[#888888] font-mono">L</span>
+ <span className="text-xs text-[#8a8a8a] font-mono">L</span>
</div>
</div>
<input
@@ -295,16 +286,16 @@ export const SimpleToneModal: React.FC<SimpleToneModalProps> = ({
step="1"
value={frequency}
onChange={(e) => setFrequency(parseFloat(e.target.value))}
- className="w-full cursor-pointer h-1.5 accent-amber-400 mb-1.5"
+ className="w-full mb-1.5"
/>
- <div className="flex items-center justify-between text-[9px] text-[#888888] font-mono">
+ <div className="flex items-center justify-between text-[9px] text-[#8a8a8a] font-mono">
{FREQUENCY_PRESETS.map((p) => (
<button
key={p}
type="button"
onClick={() => setFrequency(p)}
- className={`hover:text-amber-300 px-1 py-0.5 rounded transition-colors ${
- frequency === p ? 'bg-amber-500/20 text-amber-400 font-bold' : ''
+ className={`hover:text-[#e5e5e5] px-1 py-0.5 rounded transition-colors cursor-pointer ${
+ frequency === p ? 'bg-[var(--accent-subtle)] text-[var(--accent)] font-semibold' : ''
}`}
>
{p}
@@ -315,11 +306,11 @@ export const SimpleToneModal: React.FC<SimpleToneModalProps> = ({
</div>
{/* Footer */}
- <div className="px-4 py-3 bg-[#2b2d31] border-t border-[#383a40] flex items-center justify-end space-x-2">
+ <div className="px-4 py-2.5 bg-[#1a1a1a] border-t border-white/[0.06] flex items-center justify-end space-x-2">
<button
type="button"
onClick={onClose}
- className="px-3 py-1.5 rounded bg-[#35373c] hover:bg-[#3f4147] text-[#cccccc] hover:text-white transition-colors cursor-pointer text-xs font-medium"
+ className="px-3 py-1.5 rounded bg-[#2c2c2c] hover:bg-[#383838] text-[#e5e5e5] transition-colors cursor-pointer text-xs"
>
Cancel
</button>
@@ -334,10 +325,9 @@ export const SimpleToneModal: React.FC<SimpleToneModalProps> = ({
densityType,
})
}
- className="px-4 py-1.5 rounded bg-amber-500 hover:bg-amber-400 text-black font-semibold transition-colors cursor-pointer text-xs flex items-center space-x-1 shadow-md"
+ className="px-4 py-1.5 rounded bg-[var(--accent)] text-[var(--accent-contrast)] hover:opacity-90 font-medium transition-opacity cursor-pointer text-xs"
>
- <Check className="w-3.5 h-3.5 stroke-[2.5]" />
- <span>OK</span>
+ OK
</button>
</div>
</div>
diff --git a/src/components/SpeechBalloonOverlay.tsx b/src/components/SpeechBalloonOverlay.tsx
index 46c4a4e..a8c82a8 100644
--- a/src/components/SpeechBalloonOverlay.tsx
+++ b/src/components/SpeechBalloonOverlay.tsx
@@ -1,11 +1,6 @@
import React, { useEffect, useRef, useState } from 'react';
import { SpeechBalloon } from '../types/editor';
import {
- MessageSquare,
- Sparkles,
- Cloud,
- Square,
- Check,
Trash2,
} from 'lucide-react';
import { getBalloonHandles, BalloonHandle, renderSpeechBalloon } from '../utils/balloonEngine';
@@ -316,7 +311,7 @@ export const SpeechBalloonOverlay: React.FC<SpeechBalloonOverlayProps> = ({
{/* Floating Balloon Inspector Panel */}
<div
- className="absolute pointer-events-auto bg-[#1e1f22] border border-[#383a40] rounded-md shadow-2xl p-2.5 w-72 text-xs text-[#cccccc] flex flex-col space-y-2 select-none"
+ className="absolute pointer-events-auto bg-[#202020]/95 backdrop-blur-md border border-white/[0.1] rounded-md shadow-2xl p-2.5 w-72 text-xs text-[#e5e5e5] flex flex-col space-y-2 select-none"
style={{
left: `${bounds.x + bounds.width + 15}px`,
top: `${bounds.y}px`,
@@ -325,24 +320,21 @@ export const SpeechBalloonOverlay: React.FC<SpeechBalloonOverlayProps> = ({
}}
onPointerDown={(e) => e.stopPropagation()}
>
- <div className="flex items-center justify-between border-b border-[#2b2d31] pb-1.5">
- <div className="flex items-center space-x-1.5 text-white font-medium">
- <MessageSquare className="w-3.5 h-3.5 text-cyan-400" />
- <span>Speech Balloon</span>
- </div>
+ <div className="flex items-center justify-between border-b border-white/[0.06] pb-1.5">
+ <span className="text-[#e5e5e5] font-medium">Speech Balloon</span>
<div className="flex items-center space-x-1">
<button
onClick={() => setActiveTab('shape')}
- className={`px-1.5 py-0.5 rounded text-[10px] ${
- activeTab === 'shape' ? 'bg-[#2b2d31] text-white' : 'text-[#888888]'
+ className={`px-1.5 py-0.5 rounded text-[10px] cursor-pointer ${
+ activeTab === 'shape' ? 'bg-[#2c2c2c] text-[#e5e5e5]' : 'text-[#8a8a8a]'
}`}
>
Shape
</button>
<button
onClick={() => setActiveTab('text')}
- className={`px-1.5 py-0.5 rounded text-[10px] ${
- activeTab === 'text' ? 'bg-[#2b2d31] text-white' : 'text-[#888888]'
+ className={`px-1.5 py-0.5 rounded text-[10px] cursor-pointer ${
+ activeTab === 'text' ? 'bg-[#2c2c2c] text-[#e5e5e5]' : 'text-[#8a8a8a]'
}`}
>
Text
@@ -353,65 +345,34 @@ export const SpeechBalloonOverlay: React.FC<SpeechBalloonOverlayProps> = ({
{activeTab === 'shape' ? (
<div className="space-y-2">
<div>
- <label className="text-[10px] text-[#888888] block mb-1">Shape Preset:</label>
+ <label className="text-[10px] text-[#8a8a8a] block mb-1">Shape Preset</label>
<div className="grid grid-cols-4 gap-1">
- <button
- onClick={() => onUpdateBalloon((p) => ({ ...p, shape: 'ellipse' }))}
- className={`p-1 rounded flex flex-col items-center border ${
- balloon.shape === 'ellipse'
- ? 'border-cyan-400 bg-cyan-500/10 text-cyan-300'
- : 'border-[#2e3036] text-[#888888] hover:text-white'
- }`}
- title="Ellipse (Standard)"
- >
- <div className="w-4 h-3 rounded-full border border-current my-0.5" />
- <span className="text-[9px]">Ellipse</span>
- </button>
-
- <button
- onClick={() => onUpdateBalloon((p) => ({ ...p, shape: 'rounded-rect' }))}
- className={`p-1 rounded flex flex-col items-center border ${
- balloon.shape === 'rounded-rect'
- ? 'border-cyan-400 bg-cyan-500/10 text-cyan-300'
- : 'border-[#2e3036] text-[#888888] hover:text-white'
- }`}
- title="Rounded Rectangle"
- >
- <Square className="w-3.5 h-3.5 my-0.5" />
- <span className="text-[9px]">Box</span>
- </button>
-
- <button
- onClick={() => onUpdateBalloon((p) => ({ ...p, shape: 'jagged-flash' }))}
- className={`p-1 rounded flex flex-col items-center border ${
- balloon.shape === 'jagged-flash'
- ? 'border-cyan-400 bg-cyan-500/10 text-cyan-300'
- : 'border-[#2e3036] text-[#888888] hover:text-white'
- }`}
- title="Jagged Flash (Shout / Action)"
- >
- <Sparkles className="w-3.5 h-3.5 my-0.5 text-amber-400" />
- <span className="text-[9px]">Flash</span>
- </button>
-
- <button
- onClick={() => onUpdateBalloon((p) => ({ ...p, shape: 'thought' }))}
- className={`p-1 rounded flex flex-col items-center border ${
- balloon.shape === 'thought'
- ? 'border-cyan-400 bg-cyan-500/10 text-cyan-300'
- : 'border-[#2e3036] text-[#888888] hover:text-white'
- }`}
- title="Thought Bubble (Cloud)"
- >
- <Cloud className="w-3.5 h-3.5 my-0.5 text-sky-400" />
- <span className="text-[9px]">Thought</span>
- </button>
+ {(
+ [
+ ['ellipse', 'Ellipse'],
+ ['rounded-rect', 'Box'],
+ ['jagged-flash', 'Flash'],
+ ['thought', 'Thought'],
+ ] as const
+ ).map(([shapeId, lbl]) => (
+ <button
+ key={shapeId}
+ onClick={() => onUpdateBalloon((p) => ({ ...p, shape: shapeId }))}
+ className={`py-1 rounded text-[10px] border cursor-pointer transition-colors ${
+ balloon.shape === shapeId
+ ? 'border-[var(--accent-border)] bg-[var(--accent-subtle)] text-[var(--accent)] font-medium'
+ : 'border-white/[0.06] bg-[#161616] text-[#8a8a8a] hover:text-[#e5e5e5]'
+ }`}
+ >
+ {lbl}
+ </button>
+ ))}
</div>
</div>
<div className="flex items-center justify-between text-[11px]">
- <span className="text-[#888888]">Border Width:</span>
- <div className="flex items-center space-x-1">
+ <span className="text-[#8a8a8a]">Border Width</span>
+ <div className="flex items-center space-x-1.5">
<input
type="range"
min={1}
@@ -420,9 +381,9 @@ export const SpeechBalloonOverlay: React.FC<SpeechBalloonOverlayProps> = ({
onChange={(e) =>
onUpdateBalloon((p) => ({ ...p, strokeWidth: Number(e.target.value) }))
}
- className="w-24 accent-cyan-400"
+ className="w-24"
/>
- <span className="font-mono text-cyan-400 w-6 text-right">
+ <span className="font-mono text-[#e5e5e5] w-6 text-right">
{balloon.strokeWidth}px
</span>
</div>
@@ -435,38 +396,38 @@ export const SpeechBalloonOverlay: React.FC<SpeechBalloonOverlayProps> = ({
onChange={(e) => onUpdateBalloon((p) => ({ ...p, text: e.target.value }))}
placeholder="Balloon dialogue text..."
rows={2}
- className="w-full bg-[#141517] text-white text-xs border border-[#383a40] rounded p-1.5 focus:border-cyan-500 focus:outline-none resize-none"
+ className="w-full bg-[#161616] text-[#e5e5e5] text-xs border border-white/[0.08] rounded p-1.5 resize-none"
/>
<div className="flex items-center justify-between">
- <span className="text-[11px] text-[#888888]">Direction:</span>
+ <span className="text-[11px] text-[#8a8a8a]">Direction</span>
<div className="flex space-x-1">
<button
onClick={() => onUpdateBalloon((p) => ({ ...p, vertical: false }))}
- className={`px-2 py-0.5 rounded text-[10px] ${
+ className={`px-2 py-0.5 rounded text-[10px] cursor-pointer ${
!balloon.vertical
- ? 'bg-cyan-500/20 text-cyan-300 border border-cyan-500/40'
- : 'bg-[#141517] text-[#888888]'
+ ? 'bg-[var(--accent-subtle)] text-[var(--accent)] border border-[var(--accent-border)]'
+ : 'bg-[#161616] text-[#8a8a8a]'
}`}
>
Horizontal
</button>
<button
onClick={() => onUpdateBalloon((p) => ({ ...p, vertical: true }))}
- className={`px-2 py-0.5 rounded text-[10px] ${
+ className={`px-2 py-0.5 rounded text-[10px] cursor-pointer ${
balloon.vertical
- ? 'bg-cyan-500/20 text-cyan-300 border border-cyan-500/40'
- : 'bg-[#141517] text-[#888888]'
+ ? 'bg-[var(--accent-subtle)] text-[var(--accent)] border border-[var(--accent-border)]'
+ : 'bg-[#161616] text-[#8a8a8a]'
}`}
>
- Vertical 縦
+ Vertical
</button>
</div>
</div>
<div className="flex items-center justify-between text-[11px]">
- <span className="text-[#888888]">Font Size:</span>
- <div className="flex items-center space-x-1">
+ <span className="text-[#8a8a8a]">Font Size</span>
+ <div className="flex items-center space-x-1.5">
<input
type="range"
min={12}
@@ -475,18 +436,18 @@ export const SpeechBalloonOverlay: React.FC<SpeechBalloonOverlayProps> = ({
onChange={(e) =>
onUpdateBalloon((p) => ({ ...p, fontSize: Number(e.target.value) }))
}
- className="w-24 accent-cyan-400"
+ className="w-24"
/>
- <span className="font-mono text-cyan-400 w-6 text-right">{balloon.fontSize}px</span>
+ <span className="font-mono text-[#e5e5e5] w-6 text-right">{balloon.fontSize}px</span>
</div>
</div>
</div>
)}
- <div className="flex items-center justify-between pt-1.5 border-t border-[#2b2d31]">
+ <div className="flex items-center justify-between pt-1.5 border-t border-white/[0.06]">
<button
onClick={onDeleteBalloon}
- className="p-1 text-rose-400 hover:bg-rose-500/20 rounded transition-colors"
+ className="p-1 text-[#8a8a8a] hover:text-rose-400 hover:bg-[#2c2c2c] rounded transition-colors cursor-pointer"
title="Delete Balloon"
>
<Trash2 className="w-3.5 h-3.5" />
@@ -494,10 +455,9 @@ export const SpeechBalloonOverlay: React.FC<SpeechBalloonOverlayProps> = ({
<button
onClick={onConfirmBalloon}
- className="px-2.5 py-1 bg-[#234b3e] hover:bg-[#2b604f] text-[#55eaab] border border-[#2e6e58] rounded text-xs font-semibold flex items-center space-x-1"
+ className="px-3 py-1 bg-[var(--accent)] text-[var(--accent-contrast)] hover:opacity-90 rounded text-xs font-medium transition-opacity cursor-pointer"
>
- <Check className="w-3.5 h-3.5" />
- <span>Apply Balloon</span>
+ Apply Balloon
</button>
</div>
</div>
diff --git a/src/components/StatusBar.tsx b/src/components/StatusBar.tsx
index b3ccaef..f82cfbc 100644
--- a/src/components/StatusBar.tsx
+++ b/src/components/StatusBar.tsx
@@ -36,7 +36,7 @@ export const StatusBar: React.FC<StatusBarProps> = React.memo(({
showCursorCoordinates = true,
showPressureInStatusBar = true,
hasOpenDocument = true,
- themePreset: _themePreset = 'vintage-manga',
+ themePreset: _themePreset = 'modern',
softProofSettings,
}) => {
const posTextRef = useRef<HTMLSpanElement>(null);
@@ -74,13 +74,12 @@ export const StatusBar: React.FC<StatusBarProps> = React.memo(({
};
}, []);
- if (_themePreset === 'modern') {
- return (
- <footer
- data-testid="status-bar"
- data-theme-preset="modern"
- className="h-7 bg-[#1a1a1a] border-t border-white/[0.06] px-3 text-white/70 flex items-center justify-between text-xs select-none z-20 shrink-0"
- >
+ return (
+ <footer
+ data-testid="status-bar"
+ data-theme-preset="modern"
+ className="h-7 bg-[#1a1a1a] border-t border-white/[0.06] px-3 text-white/70 flex items-center justify-between text-xs select-none z-20 shrink-0"
+ >
{/* Tool & Smoothing Status */}
<div className="flex items-center space-x-2">
<div className="bg-white/[0.04] border border-white/[0.06] px-2 py-0.5 rounded-md flex items-center space-x-2">
@@ -176,117 +175,6 @@ export const StatusBar: React.FC<StatusBarProps> = React.memo(({
</div>
</div>
</footer>
- );
- }
-
- return (
- <footer
- data-testid="status-bar"
- data-theme-preset="vintage-manga"
- className="h-7 bg-gradient-to-b from-[#464649] to-[#363638] border-t border-[#232325] px-2.5 text-[#b0b0b6] flex items-center justify-between text-xs select-none z-20 shrink-0 transition-colors"
- >
- {/* Tool & Smoothing Status */}
- <div className="flex items-center space-x-2">
- <div className="bg-[#2b2b2e] border border-[#202022] shadow-[inset_1px_1px_2px_rgba(0,0,0,0.5),0_1px_0_rgba(255,255,255,0.08)] px-2 py-0.5 rounded-[2px] flex items-center space-x-2">
- <span className="text-[#f0f0f4] capitalize font-medium">{tool}</span>
- <span className="text-[#4a4a4e]">|</span>
- {hasOpenDocument ? (
- <>
- <span
- className={`font-mono text-[10px] font-medium ${
- colorMode === 'monochrome'
- ? 'text-amber-400'
- : colorMode === 'grayscale'
- ? 'text-slate-300'
- : 'text-emerald-400'
- }`}
- title={`Active Document Color Mode: ${colorMode}`}
- >
- {colorMode === 'monochrome' ? 'Manga (1-bit)' : colorMode === 'grayscale' ? 'Grayscale' : 'Color (RGB)'}
- </span>
- {softProofSettings?.enabled && (
- <>
- <span className="text-[#4a4a4e]">|</span>
- <span
- className="text-cyan-400 font-mono text-[10px] font-medium"
- title={`CMYK Soft Proofing: ${softProofSettings.standard}${softProofSettings.gamutWarning ? ' (Gamut Warning ON)' : ''}`}
- >
- [CMYK Proof: {CMYK_STANDARD_LABELS[softProofSettings.standard] || 'US Web Coated'}]
- </span>
- </>
- )}
- </>
- ) : (
- <span className="text-[#77777d] italic text-[10px]">No active document</span>
- )}
- <span className="text-[#4a4a4e]">|</span>
- <span className="text-[11px] text-[#cccccc]">
- {brushSettings.smoothing ? 'Bézier: ON' : 'Direct'}
- </span>
- <span className="text-[#4a4a4e]">|</span>
- <span className="text-emerald-400 font-mono text-[11px]">
- Stab: {brushSettings.stabilization ?? 0}
- </span>
- </div>
-
- {/* Vintage Manga Studio Application & System Monitor */}
- <div className="hidden md:flex items-center space-x-2 bg-[#2b2b2e] border border-[#202022] shadow-[inset_1px_1px_2px_rgba(0,0,0,0.5),0_1px_0_rgba(255,255,255,0.08)] px-2 py-0.5 rounded-[2px] font-mono text-[10px] text-[#9999a0]">
- <span>Information:</span>
- <span className="text-[#7dd3fc]">System: 62%</span>
- <span className="text-emerald-400">Application: 100%</span>
- </div>
- </div>
-
- {/* Real-time Pointer Stats */}
- <div className="flex items-center space-x-2 font-mono text-xs">
- {/* Coordinates */}
- {showCursorCoordinates && (
- <div className="bg-[#2b2b2e] border border-[#202022] shadow-[inset_1px_1px_2px_rgba(0,0,0,0.5),0_1px_0_rgba(255,255,255,0.08)] px-2 py-0.5 rounded-[2px] flex items-center space-x-1.5">
- <span className="text-[#77777d]">Pos:</span>
- <span ref={posTextRef} className="text-[#cccccc] text-[11px]">
- — , —
- </span>
- </div>
- )}
-
- {/* Stylus Pressure Bar */}
- {showPressureInStatusBar && (
- <div className="bg-[#2b2b2e] border border-[#202022] shadow-[inset_1px_1px_2px_rgba(0,0,0,0.5),0_1px_0_rgba(255,255,255,0.08)] px-2 py-0.5 rounded-[2px] flex items-center space-x-2">
- <span className="text-[#77777d]">Pressure:</span>
- <div className="w-16 h-2.5 bg-[#1b1b1d] rounded-xs overflow-hidden border border-[#262629] shadow-inner">
- <div
- ref={pressureBarRef}
- className="h-full bg-gradient-to-r from-emerald-500 to-cyan-400 transition-all duration-75"
- style={{ width: `0%` }}
- />
- </div>
- <span ref={pressureTextRef} className="w-8 text-right text-[#cccccc] text-[10px]">0%</span>
- </div>
- )}
-
- {/* Rotation */}
- <div
- onClick={hasOpenDocument ? onResetRotation : undefined}
- onDoubleClick={hasOpenDocument ? onResetRotation : undefined}
- className={`bg-[#2b2b2e] border border-[#202022] shadow-[inset_1px_1px_2px_rgba(0,0,0,0.5),0_1px_0_rgba(255,255,255,0.08)] px-2 py-0.5 rounded-[2px] flex items-center space-x-1.5 ${
- hasOpenDocument ? 'cursor-pointer hover:text-white' : 'opacity-40 pointer-events-none'
- }`}
- title="Canvas Rotation (Click or Double-click to Reset 0°)"
- >
- <span className="text-[#77777d]">Angle:</span>
- <span className="text-[#cccccc] font-medium text-[11px]">{hasOpenDocument ? formatRotationDegrees(rotation) : '0°'}</span>
- </div>
-
- {/* Zoom */}
- <div
- className={`bg-[#2b2b2e] border border-[#202022] shadow-[inset_1px_1px_2px_rgba(0,0,0,0.5),0_1px_0_rgba(255,255,255,0.08)] px-2 py-0.5 rounded-[2px] flex items-center space-x-1.5 ${hasOpenDocument ? '' : 'opacity-40'}`}
- title="Canvas Zoom Level"
- >
- <span className="text-[#77777d]">Zoom:</span>
- <span className="text-[#cccccc] font-medium text-[11px]">{hasOpenDocument ? formatZoomPercent(zoom) : '—'}</span>
- </div>
- </div>
- </footer>
);
});
diff --git a/src/components/SubToolList.tsx b/src/components/SubToolList.tsx
index 3ecdda6..5fa2ad3 100644
--- a/src/components/SubToolList.tsx
+++ b/src/components/SubToolList.tsx
@@ -7,7 +7,6 @@ import {
Trash2,
Loader2,
FolderDown,
- Sparkles,
ChevronDown,
ChevronRight,
} from 'lucide-react';
@@ -270,7 +269,7 @@ export const SubToolList: React.FC<SubToolListProps> = React.memo(
className="w-3 h-3 object-contain shrink-0 brightness-125"
/>
) : (
- <Sparkles className="w-3 h-3 shrink-0 opacity-80" />
+ <Paintbrush className="w-3 h-3 shrink-0 opacity-70" />
)}
<span className="text-[11px] truncate leading-tight">{brush.name}</span>
</div>
diff --git a/src/components/SubViewPanel.tsx b/src/components/SubViewPanel.tsx
index b8c4047..e02a970 100644
--- a/src/components/SubViewPanel.tsx
+++ b/src/components/SubViewPanel.tsx
@@ -151,7 +151,6 @@ export interface SubViewPanelProps {
export const SubViewPanel: React.FC<SubViewPanelProps> = React.memo(
({ colorMode = 'color', themePreset = 'modern' }) => {
- const isVintage = themePreset === 'vintage-manga';
const items = useSubViewStore((s) => s.items);
const activeId = useSubViewStore((s) => s.activeId);
@@ -640,13 +639,11 @@ export const SubViewPanel: React.FC<SubViewPanelProps> = React.memo(
}
};
- const btnBase = isVintage
- ? 'h-5 px-1 rounded text-[10px] flex items-center justify-center text-[#d0d0d5] hover:text-white hover:bg-[#4e4e52] disabled:opacity-35 disabled:pointer-events-none transition-colors cursor-pointer'
- : 'h-5 px-1 rounded text-[10px] flex items-center justify-center text-[#a3a3a3] hover:text-[#f5f5f5] hover:bg-[#2c2c2c] disabled:opacity-35 disabled:pointer-events-none transition-colors cursor-pointer';
+ const btnBase =
+ 'h-5 px-1 rounded text-[10px] flex items-center justify-center text-[#a3a3a3] hover:text-[#f5f5f5] hover:bg-[#2c2c2c] disabled:opacity-35 disabled:pointer-events-none transition-colors cursor-pointer';
- const btnActive = isVintage
- ? 'bg-[#337bb5] text-white'
- : 'bg-[var(--accent-subtle)] text-[var(--accent)] ring-1 ring-inset ring-[var(--accent-border)]';
+ const btnActive =
+ 'bg-[var(--accent-subtle)] text-[var(--accent)] ring-1 ring-inset ring-[var(--accent-border)]';
const stageCursorClass = !activeItem?.src
? 'cursor-default'
@@ -663,9 +660,7 @@ export const SubViewPanel: React.FC<SubViewPanelProps> = React.memo(
onDragOver={handleDragOver}
onDragLeave={handleDragLeave}
onDrop={handleDrop}
- className={`flex flex-col h-full min-h-0 select-none relative ${
- isVintage ? 'bg-[#363638] text-[#e5e5e5]' : 'bg-[#202020] text-[#e5e5e5]'
- }`}
+ className="flex flex-col h-full min-h-0 select-none relative bg-[#202020] text-[#e5e5e5]"
>
{/* Hidden Local Image Inputs */}
<input
@@ -694,13 +689,7 @@ export const SubViewPanel: React.FC<SubViewPanelProps> = React.memo(
/>
{/* Top Bar: Reference Management (+, < >, index, list toggle, delete) */}
- <div
- className={`h-6 px-1 flex items-center justify-between gap-1 shrink-0 border-b ${
- isVintage
- ? 'bg-[#313134] border-[#232325]'
- : 'bg-[#1b1b1b] border-white/[0.06]'
- }`}
- >
+ <div className="h-6 px-1 flex items-center justify-between gap-1 shrink-0 border-b bg-[#1b1b1b] border-white/[0.06]">
<div className="flex items-center gap-0.5 min-w-0">
<button
type="button"
@@ -776,11 +765,7 @@ export const SubViewPanel: React.FC<SubViewPanelProps> = React.memo(
{showList && items.length > 0 && (
<div
data-testid="subview-list-drawer"
- className={`max-h-24 overflow-y-auto shrink-0 border-b px-1 py-0.5 flex flex-col gap-0.5 ${
- isVintage
- ? 'bg-[#2b2b2e] border-[#232325]'
- : 'bg-[#181818] border-white/[0.06]'
- }`}
+ className="max-h-24 overflow-y-auto shrink-0 border-b px-1 py-0.5 flex flex-col gap-0.5 bg-[#181818] border-white/[0.06]"
>
{items.map((item, idx) => {
const isSelected = item.id === activeItem?.id;
@@ -791,9 +776,7 @@ export const SubViewPanel: React.FC<SubViewPanelProps> = React.memo(
onClick={() => subViewStoreActions.selectImage(item.id)}
className={`flex items-center gap-1.5 px-1 py-0.5 rounded text-[10px] cursor-pointer ${
isSelected
- ? isVintage
- ? 'bg-[#337bb5] text-white'
- : 'bg-[#2c2c2c] text-[#f5f5f5]'
+ ? 'bg-[#2c2c2c] text-[#f5f5f5]'
: 'text-[#a3a3a3] hover:bg-[#242424]'
}`}
>
@@ -834,8 +817,6 @@ export const SubViewPanel: React.FC<SubViewPanelProps> = React.memo(
className={`relative flex-1 min-h-[76px] overflow-hidden flex items-center justify-center ${stageCursorClass} ${
isDragOverFiles
? 'ring-2 ring-inset ring-[var(--accent)] bg-[var(--accent-subtle)]'
- : isVintage
- ? 'bg-[#252527]'
: 'bg-[#141414]'
}`}
>
@@ -898,13 +879,7 @@ export const SubViewPanel: React.FC<SubViewPanelProps> = React.memo(
</div>
{/* Bottom Compact Control Bar (Strictly Local Sub View Transforms + Eyedropper Mode) */}
- <div
- className={`shrink-0 px-1.5 py-1 flex items-center justify-between gap-0.5 flex-wrap border-t ${
- isVintage
- ? 'bg-[#313134] border-[#232325]'
- : 'bg-[#1b1b1b] border-white/[0.06]'
- }`}
- >
+ <div className="shrink-0 px-1.5 py-1 flex items-center justify-between gap-0.5 flex-wrap border-t bg-[#1b1b1b] border-white/[0.06]">
{/* Zoom + Fit */}
<div className="flex items-center gap-0.5">
<button
diff --git a/src/components/TextEditorOverlay.tsx b/src/components/TextEditorOverlay.tsx
index 27e2536..dbb9e17 100644
--- a/src/components/TextEditorOverlay.tsx
+++ b/src/components/TextEditorOverlay.tsx
@@ -1,13 +1,11 @@
import React, { useRef, useState } from 'react';
import { TextSettings } from '../types/editor';
import {
- Check,
Bold,
Italic,
AlignLeft,
AlignCenter,
AlignRight,
- GripHorizontal,
} from 'lucide-react';
interface TextEditorOverlayProps {
@@ -130,7 +128,7 @@ export const TextEditorOverlay: React.FC<TextEditorOverlayProps> = ({
{/* Floating Tool Panel */}
<div
- className="w-80 bg-[#1e1f22] border border-[#383a40] rounded-md shadow-2xl overflow-hidden flex flex-col"
+ className="w-80 bg-[#202020]/95 backdrop-blur-md border border-white/[0.1] rounded-md shadow-2xl overflow-hidden flex flex-col"
style={{
transform: `scale(${(flipX ? -1 : 1) * (zoom > 0 ? 1 / zoom : 1)}, ${(flipY ? -1 : 1) * (zoom > 0 ? 1 / zoom : 1)})`,
transformOrigin: 'top left',
@@ -141,26 +139,23 @@ export const TextEditorOverlay: React.FC<TextEditorOverlayProps> = ({
onPointerDown={handleDragDown}
onPointerMove={handleDragMove}
onPointerUp={handleDragUp}
- className="bg-[#18191c] px-3 py-1.5 border-b border-[#2b2d31] flex items-center justify-between cursor-move text-xs text-[#999999]"
+ className="bg-[#1a1a1a] px-3 py-1.5 border-b border-white/[0.06] flex items-center justify-between cursor-move text-xs text-[#8a8a8a]"
>
- <div className="flex items-center space-x-1.5 font-medium text-white">
- <GripHorizontal className="w-3.5 h-3.5 text-[#777777]" />
- <span>Manga Text Tool</span>
- </div>
+ <span className="font-medium text-[#e5e5e5]">Text Tool</span>
<div className="flex items-center space-x-1">
<button
onClick={() => setActiveTab('text')}
- className={`px-2 py-0.5 rounded text-[11px] font-medium transition-colors ${
- activeTab === 'text' ? 'bg-[#2b2d31] text-white' : 'text-[#888888] hover:text-[#cccccc]'
+ className={`px-2 py-0.5 rounded text-[11px] font-medium transition-colors cursor-pointer ${
+ activeTab === 'text' ? 'bg-[#2c2c2c] text-[#e5e5e5]' : 'text-[#8a8a8a] hover:text-[#e5e5e5]'
}`}
>
Content
</button>
<button
onClick={() => setActiveTab('style')}
- className={`px-2 py-0.5 rounded text-[11px] font-medium transition-colors ${
- activeTab === 'style' ? 'bg-[#2b2d31] text-white' : 'text-[#888888] hover:text-[#cccccc]'
+ className={`px-2 py-0.5 rounded text-[11px] font-medium transition-colors cursor-pointer ${
+ activeTab === 'style' ? 'bg-[#2c2c2c] text-[#e5e5e5]' : 'text-[#8a8a8a] hover:text-[#e5e5e5]'
}`}
>
Style
@@ -252,8 +247,10 @@ export const TextEditorOverlay: React.FC<TextEditorOverlayProps> = ({
<button
onClick={() => onUpdateSettings((prev) => ({ ...prev, bold: !prev.bold }))}
title="Bold"
- className={`p-1.5 rounded transition-colors ${
- settings.bold ? 'bg-cyan-500/20 text-cyan-300 border border-cyan-500/40' : 'text-[#888888] hover:text-white hover:bg-[#2b2d31]'
+ className={`p-1.5 rounded transition-colors cursor-pointer ${
+ settings.bold
+ ? 'bg-[var(--accent-subtle)] text-[var(--accent)] border border-[var(--accent-border)]'
+ : 'text-[#8a8a8a] hover:text-[#e5e5e5] hover:bg-[#2c2c2c]'
}`}
>
<Bold className="w-3.5 h-3.5" />
@@ -261,8 +258,10 @@ export const TextEditorOverlay: React.FC<TextEditorOverlayProps> = ({
<button
onClick={() => onUpdateSettings((prev) => ({ ...prev, italic: !prev.italic }))}
title="Italic"
- className={`p-1.5 rounded transition-colors ${
- settings.italic ? 'bg-cyan-500/20 text-cyan-300 border border-cyan-500/40' : 'text-[#888888] hover:text-white hover:bg-[#2b2d31]'
+ className={`p-1.5 rounded transition-colors cursor-pointer ${
+ settings.italic
+ ? 'bg-[var(--accent-subtle)] text-[var(--accent)] border border-[var(--accent-border)]'
+ : 'text-[#8a8a8a] hover:text-[#e5e5e5] hover:bg-[#2c2c2c]'
}`}
>
<Italic className="w-3.5 h-3.5" />
@@ -270,12 +269,14 @@ export const TextEditorOverlay: React.FC<TextEditorOverlayProps> = ({
</div>
{/* Writing Direction (Horizontal vs Vertical Manga Tate-gaki) */}
- <div className="flex items-center space-x-1 bg-[#141517] p-0.5 rounded border border-[#2b2d31]">
+ <div className="flex items-center space-x-1 bg-[#161616] p-0.5 rounded border border-white/[0.06]">
<button
onClick={() => onUpdateSettings((prev) => ({ ...prev, writingMode: 'horizontal-tb' }))}
title="Horizontal Layout (Left-to-Right)"
- className={`px-1.5 py-0.5 rounded text-[10px] font-medium transition-colors ${
- settings.writingMode !== 'vertical-rl' ? 'bg-[#2b2d31] text-cyan-300' : 'text-[#888888] hover:text-white'
+ className={`px-1.5 py-0.5 rounded text-[10px] font-medium transition-colors cursor-pointer ${
+ settings.writingMode !== 'vertical-rl'
+ ? 'bg-[#2c2c2c] text-[#e5e5e5]'
+ : 'text-[#8a8a8a] hover:text-[#e5e5e5]'
}`}
>
Horiz
@@ -283,34 +284,36 @@ export const TextEditorOverlay: React.FC<TextEditorOverlayProps> = ({
<button
onClick={() => onUpdateSettings((prev) => ({ ...prev, writingMode: 'vertical-rl' }))}
title="Vertical Layout (Manga Tate-gaki: Right-to-Left columns)"
- className={`px-1.5 py-0.5 rounded text-[10px] font-medium transition-colors ${
- settings.writingMode === 'vertical-rl' ? 'bg-cyan-500/20 text-cyan-300 border border-cyan-500/40' : 'text-[#888888] hover:text-white'
+ className={`px-1.5 py-0.5 rounded text-[10px] font-medium transition-colors cursor-pointer ${
+ settings.writingMode === 'vertical-rl'
+ ? 'bg-[var(--accent-subtle)] text-[var(--accent)] border border-[var(--accent-border)]'
+ : 'text-[#8a8a8a] hover:text-[#e5e5e5]'
}`}
>
- Vert 縦
+ Vert
</button>
</div>
{/* Alignments */}
- <div className="flex items-center space-x-1 bg-[#141517] p-0.5 rounded border border-[#2b2d31]">
+ <div className="flex items-center space-x-1 bg-[#161616] p-0.5 rounded border border-white/[0.06]">
<button
onClick={() => onUpdateSettings((prev) => ({ ...prev, align: 'left' }))}
title="Align Left"
- className={`p-1 rounded ${settings.align === 'left' ? 'bg-[#2b2d31] text-white' : 'text-[#888888] hover:text-white'}`}
+ className={`p-1 rounded cursor-pointer ${settings.align === 'left' ? 'bg-[#2c2c2c] text-[#e5e5e5]' : 'text-[#8a8a8a] hover:text-[#e5e5e5]'}`}
>
<AlignLeft className="w-3 h-3" />
</button>
<button
onClick={() => onUpdateSettings((prev) => ({ ...prev, align: 'center' }))}
title="Align Center"
- className={`p-1 rounded ${settings.align === 'center' ? 'bg-[#2b2d31] text-white' : 'text-[#888888] hover:text-white'}`}
+ className={`p-1 rounded cursor-pointer ${settings.align === 'center' ? 'bg-[#2c2c2c] text-[#e5e5e5]' : 'text-[#8a8a8a] hover:text-[#e5e5e5]'}`}
>
<AlignCenter className="w-3 h-3" />
</button>
<button
onClick={() => onUpdateSettings((prev) => ({ ...prev, align: 'right' }))}
title="Align Right"
- className={`p-1 rounded ${settings.align === 'right' ? 'bg-[#2b2d31] text-white' : 'text-[#888888] hover:text-white'}`}
+ className={`p-1 rounded cursor-pointer ${settings.align === 'right' ? 'bg-[#2c2c2c] text-[#e5e5e5]' : 'text-[#8a8a8a] hover:text-[#e5e5e5]'}`}
>
<AlignRight className="w-3 h-3" />
</button>
@@ -364,21 +367,20 @@ export const TextEditorOverlay: React.FC<TextEditorOverlayProps> = ({
)}
{/* Footer Confirm / Cancel */}
- <div className="px-3 py-2 bg-[#18191c] border-t border-[#2b2d31] flex items-center justify-between">
- <span className="text-[10px] text-[#777777]">Ctrl+Enter to Apply</span>
+ <div className="px-3 py-2 bg-[#1a1a1a] border-t border-white/[0.06] flex items-center justify-between">
+ <span className="text-[10px] text-[#8a8a8a]">Ctrl+Enter to Apply</span>
<div className="flex items-center space-x-2">
<button
onClick={onCancel}
- className="px-2.5 py-1 bg-[#2b2d31] hover:bg-[#383a40] text-[#cccccc] rounded text-xs transition-colors cursor-pointer"
+ className="px-2.5 py-1 bg-[#2c2c2c] hover:bg-[#383838] text-[#e5e5e5] rounded text-xs transition-colors cursor-pointer"
>
Cancel
</button>
<button
onClick={onConfirm}
- className="px-3 py-1 bg-[#234b3e] hover:bg-[#2b604f] text-[#55eaab] border border-[#2e6e58] rounded text-xs font-semibold flex items-center space-x-1 transition-colors cursor-pointer"
+ className="px-3 py-1 bg-[var(--accent)] text-[var(--accent-contrast)] hover:opacity-90 rounded text-xs font-medium transition-opacity cursor-pointer"
>
- <Check className="w-3.5 h-3.5" />
- <span>Apply</span>
+ Apply
</button>
</div>
</div>
diff --git a/src/components/TonalCorrectionModal.tsx b/src/components/TonalCorrectionModal.tsx
index 7253e0f..7bf1184 100644
--- a/src/components/TonalCorrectionModal.tsx
+++ b/src/components/TonalCorrectionModal.tsx
@@ -1,5 +1,5 @@
import React, { useState, useEffect, useRef, useMemo } from 'react';
-import { X, RotateCcw, Check, SlidersHorizontal, Sparkles } from 'lucide-react';
+import { X } from 'lucide-react';
import {
TonalCorrectionType,
BrightnessContrastParams,
@@ -315,10 +315,9 @@ export const TonalCorrectionModal: React.FC<TonalCorrectionModalProps> = ({
{/* Floating Dialog */}
<div
- className="relative pointer-events-auto w-[360px] bg-[#252526] border border-[#3e3e3e] rounded-[4px] shadow-2xl flex flex-col text-xs text-[#cccccc] select-none"
+ className="relative pointer-events-auto w-[360px] bg-[#202020] border border-white/[0.1] rounded-lg shadow-2xl flex flex-col text-xs text-[#e5e5e5] select-none"
style={{
transform: `translate(${pos.x}px, ${pos.y}px)`,
- boxShadow: '0 12px 32px rgba(0, 0, 0, 0.6), 0 2px 8px rgba(0, 0, 0, 0.4)',
}}
>
{/* Draggable Title Header */}
@@ -326,16 +325,13 @@ export const TonalCorrectionModal: React.FC<TonalCorrectionModalProps> = ({
onPointerDown={handleDragPointerDown}
onPointerMove={handleDragPointerMove}
onPointerUp={handleDragPointerUp}
- className="h-9 px-3.5 bg-[#2d2d2d] border-b border-[#383838] flex items-center justify-between cursor-move rounded-t-[4px]"
+ className="h-9 px-3.5 bg-[#1a1a1a] border-b border-white/[0.06] flex items-center justify-between cursor-move rounded-t-lg"
>
- <div className="flex items-center space-x-2">
- <SlidersHorizontal className="w-3.5 h-3.5 text-[#5ce1e6]" />
- <span className="font-medium text-[#e0e0e0]">{getTitle()}</span>
- </div>
+ <span className="font-medium text-[#e5e5e5]">{getTitle()}</span>
<button
type="button"
onClick={onClose}
- className="p-1 rounded hover:bg-[#3e3e3e] text-[#888888] hover:text-white transition-colors"
+ className="p-1 rounded hover:bg-[#2c2c2c] text-[#8a8a8a] hover:text-[#e5e5e5] transition-colors cursor-pointer"
>
<X className="w-3.5 h-3.5" />
</button>
@@ -611,10 +607,9 @@ export const TonalCorrectionModal: React.FC<TonalCorrectionModalProps> = ({
<button
type="button"
onClick={handleAutoLevels}
- className="flex items-center space-x-1 text-[#5ce1e6] hover:underline"
+ className="text-[var(--accent)] hover:underline cursor-pointer"
>
- <Sparkles className="w-3 h-3" />
- <span>Auto</span>
+ Auto
</button>
</div>
<div className="grid grid-cols-3 gap-2">
@@ -751,25 +746,23 @@ export const TonalCorrectionModal: React.FC<TonalCorrectionModalProps> = ({
</div>
{/* Modal Footer Controls */}
- <div className="p-3 bg-[#2d2d2d] border-t border-[#383838] flex items-center justify-between rounded-b-[4px]">
+ <div className="px-3.5 py-2.5 bg-[#1a1a1a] border-t border-white/[0.06] flex items-center justify-between rounded-b-lg">
<div className="flex items-center space-x-3">
- <label className="flex items-center space-x-1.5 cursor-pointer text-[#cccccc] hover:text-white">
+ <label className="flex items-center space-x-1.5 cursor-pointer text-[#cccccc] hover:text-[#e5e5e5]">
<input
type="checkbox"
checked={preview}
onChange={(e) => setPreview(e.target.checked)}
- className="w-3.5 h-3.5 rounded bg-[#1e1e1e] border-[#3e3e3e] text-[#007acc] focus:ring-0"
/>
<span className="text-[11px]">Preview</span>
</label>
<button
type="button"
onClick={handleReset}
- className="flex items-center space-x-1 text-[11px] text-[#888888] hover:text-[#cccccc] transition-colors"
+ className="text-[11px] text-[#8a8a8a] hover:text-[#e5e5e5] transition-colors cursor-pointer"
title="Reset parameters"
>
- <RotateCcw className="w-3 h-3" />
- <span>Reset</span>
+ Reset
</button>
</div>
@@ -777,17 +770,16 @@ export const TonalCorrectionModal: React.FC<TonalCorrectionModalProps> = ({
<button
type="button"
onClick={onClose}
- className="px-3 py-1 bg-[#3a3a3c] hover:bg-[#454548] text-[#cccccc] hover:text-white rounded-[2px] text-xs transition-colors"
+ className="px-3 py-1 bg-[#2c2c2c] hover:bg-[#383838] text-[#e5e5e5] rounded text-xs transition-colors cursor-pointer"
>
Cancel
</button>
<button
type="button"
onClick={() => onApply(type, currentParams)}
- className="px-3 py-1 bg-[#007acc] hover:bg-[#0098ff] text-white rounded-[2px] text-xs font-medium flex items-center space-x-1 transition-colors shadow-sm"
+ className="px-3.5 py-1 bg-[var(--accent)] text-[var(--accent-contrast)] hover:opacity-90 rounded text-xs font-medium transition-opacity cursor-pointer"
>
- <Check className="w-3.5 h-3.5" />
- <span>OK</span>
+ OK
</button>
</div>
</div>
diff --git a/src/components/ToolPropertyInspector.tsx b/src/components/ToolPropertyInspector.tsx
index b0897c4..effaa75 100644
--- a/src/components/ToolPropertyInspector.tsx
+++ b/src/components/ToolPropertyInspector.tsx
@@ -21,7 +21,11 @@ import {
CspTipFlipMode,
CspTaperSettings,
CspSpraySettings,
+ ShapeKind,
+ ShapeDrawMode,
+ ShapeFillColorMode,
} from '../types/editor';
+import { isOpenShape } from '../utils/shapeEngine';
import { saveCustomBrushDebounced } from '../utils/brushStorage';
import { resolveBrushTipImage } from '../utils/brushOutline';
import { BUILTIN_BRUSHES } from '../utils/presetBrushes';
@@ -132,6 +136,7 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
const textSettings = useToolStore((s) => s.textSettings);
const frameSettings = useToolStore((s) => s.frameSettings);
const liquifySettings = useToolStore((s) => s.liquifySettings);
+ const shapeSettings = useToolStore((s) => s.shapeSettings);
const balloonSettings = useToolStore((s) => s.balloonSettings);
const vectorEditSettings = useToolStore((s) => s.vectorEditSettings);
const wandSettings = useToolStore((s) => s.wandSettings);
@@ -361,6 +366,270 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
);
}
+ if (currentTool === 'shape') {
+ const openShape = isOpenShape(shapeSettings.shape);
+ const shapeOptions: Array<{ id: ShapeKind; label: string }> = [
+ { id: 'rectangle', label: 'Rect' },
+ { id: 'rounded-rect', label: 'Rounded' },
+ { id: 'ellipse', label: 'Ellipse' },
+ { id: 'triangle', label: 'Triangle' },
+ { id: 'polygon', label: 'Polygon' },
+ { id: 'star', label: 'Star' },
+ { id: 'line', label: 'Line' },
+ { id: 'arrow', label: 'Arrow' },
+ ];
+ return (
+ <div className="p-2 space-y-3 overflow-y-auto flex-1">
+ <div className="px-0.5 text-[11px] font-medium text-[#e5e5e5]">Geometric Shape</div>
+
+ <div className="grid grid-cols-2 gap-1">
+ {shapeOptions.map((opt) => (
+ <button
+ key={opt.id}
+ type="button"
+ onClick={() => toolStoreActions.updateShapeSettings({ shape: opt.id })}
+ className={`px-2 py-1 rounded text-[11px] text-left transition-colors cursor-pointer ${
+ shapeSettings.shape === opt.id
+ ? 'bg-[#2c2c2c] text-[#e5e5e5] font-medium'
+ : 'text-[#8a8a8a] hover:text-[#e5e5e5] hover:bg-[#2c2c2c]/60'
+ }`}
+ >
+ {opt.label}
+ </button>
+ ))}
+ </div>
+
+ {!openShape && (
+ <div className="space-y-1">
+ <div className="text-[11px] text-[#8a8a8a]">Style</div>
+ <div className="grid grid-cols-3 gap-0.5 bg-[#161616] p-0.5 rounded">
+ {(['stroke', 'fill', 'both'] as ShapeDrawMode[]).map((m) => (
+ <button
+ key={m}
+ type="button"
+ onClick={() => toolStoreActions.updateShapeSettings({ mode: m })}
+ className={`py-1 rounded text-[10px] capitalize transition-colors cursor-pointer ${
+ shapeSettings.mode === m
+ ? 'bg-[#2c2c2c] text-[#e5e5e5] font-medium'
+ : 'text-[#8a8a8a] hover:text-[#e5e5e5]'
+ }`}
+ >
+ {m}
+ </button>
+ ))}
+ </div>
+ </div>
+ )}
+
+ {(openShape || shapeSettings.mode !== 'fill') && (
+ <CompactSlider
+ label="Stroke"
+ valueLabel={`${shapeSettings.strokeWidth}px`}
+ min={1}
+ max={120}
+ value={shapeSettings.strokeWidth}
+ onChange={(v) => toolStoreActions.updateShapeSettings({ strokeWidth: v })}
+ />
+ )}
+
+ <CompactSlider
+ label="Opacity"
+ valueLabel={`${Math.round(shapeSettings.opacity * 100)}%`}
+ min={5}
+ max={100}
+ value={Math.round(shapeSettings.opacity * 100)}
+ onChange={(v) => toolStoreActions.updateShapeSettings({ opacity: v / 100 })}
+ />
+
+ {!openShape && shapeSettings.mode !== 'stroke' && (
+ <div className="space-y-1.5">
+ <div className="text-[11px] text-[#8a8a8a]">Fill Color</div>
+ <div className="grid grid-cols-3 gap-0.5 bg-[#161616] p-0.5 rounded">
+ {(
+ [
+ ['primary', 'Primary'],
+ ['secondary', 'Sub'],
+ ['custom', 'Custom'],
+ ] as Array<[ShapeFillColorMode, string]>
+ ).map(([m, lbl]) => (
+ <button
+ key={m}
+ type="button"
+ onClick={() => toolStoreActions.updateShapeSettings({ fillColorMode: m })}
+ className={`py-1 rounded text-[10px] transition-colors cursor-pointer ${
+ shapeSettings.fillColorMode === m
+ ? 'bg-[#2c2c2c] text-[#e5e5e5] font-medium'
+ : 'text-[#8a8a8a] hover:text-[#e5e5e5]'
+ }`}
+ >
+ {lbl}
+ </button>
+ ))}
+ </div>
+ {shapeSettings.fillColorMode === 'custom' && (
+ <div className="flex items-center justify-between">
+ <span className="text-[10px] text-[#8a8a8a] font-mono">
+ {shapeSettings.customFillColor}
+ </span>
+ <input
+ type="color"
+ value={shapeSettings.customFillColor}
+ onChange={(e) =>
+ toolStoreActions.updateShapeSettings({ customFillColor: e.target.value })
+ }
+ className="w-6 h-5 bg-transparent border-0 cursor-pointer"
+ />
+ </div>
+ )}
+ </div>
+ )}
+
+ {shapeSettings.shape === 'rounded-rect' && (
+ <CompactSlider
+ label="Corner Radius"
+ valueLabel={`${shapeSettings.cornerRadius}px`}
+ min={0}
+ max={200}
+ value={shapeSettings.cornerRadius}
+ onChange={(v) => toolStoreActions.updateShapeSettings({ cornerRadius: v })}
+ />
+ )}
+
+ {(shapeSettings.shape === 'polygon' || shapeSettings.shape === 'star') && (
+ <CompactSlider
+ label={shapeSettings.shape === 'star' ? 'Points' : 'Sides'}
+ valueLabel={`${shapeSettings.polygonSides}`}
+ min={3}
+ max={12}
+ value={shapeSettings.polygonSides}
+ onChange={(v) => toolStoreActions.updateShapeSettings({ polygonSides: v })}
+ />
+ )}
+
+ {shapeSettings.shape === 'star' && (
+ <CompactSlider
+ label="Inner Ratio"
+ valueLabel={`${Math.round(shapeSettings.starInnerRatio * 100)}%`}
+ min={15}
+ max={85}
+ value={Math.round(shapeSettings.starInnerRatio * 100)}
+ onChange={(v) => toolStoreActions.updateShapeSettings({ starInnerRatio: v / 100 })}
+ />
+ )}
+
+ {(openShape || shapeSettings.mode !== 'fill') && (
+ <div className="space-y-2 pt-1 border-t border-[#2c2c2c]">
+ <label className="flex items-center justify-between text-[11px] text-[#8a8a8a] cursor-pointer">
+ <span>Dashed Line</span>
+ <input
+ type="checkbox"
+ checked={shapeSettings.dashed}
+ onChange={(e) =>
+ toolStoreActions.updateShapeSettings({ dashed: e.target.checked })
+ }
+ />
+ </label>
+ {shapeSettings.dashed && (
+ <>
+ <CompactSlider
+ label="Dash Length"
+ valueLabel={`${shapeSettings.dashLength}px`}
+ min={2}
+ max={100}
+ value={shapeSettings.dashLength}
+ onChange={(v) => toolStoreActions.updateShapeSettings({ dashLength: v })}
+ />
+ <CompactSlider
+ label="Dash Gap"
+ valueLabel={`${shapeSettings.dashGap}px`}
+ min={2}
+ max={100}
+ value={shapeSettings.dashGap}
+ onChange={(v) => toolStoreActions.updateShapeSettings({ dashGap: v })}
+ />
+ </>
+ )}
+
+ <div className="flex items-center justify-between text-[11px]">
+ <span className="text-[#8a8a8a]">Cap</span>
+ <select
+ value={shapeSettings.lineCap}
+ onChange={(e) =>
+ toolStoreActions.updateShapeSettings({
+ lineCap: e.target.value as 'round' | 'butt' | 'square',
+ })
+ }
+ className="px-1.5 py-0.5 text-[11px] bg-[#161616] text-[#e5e5e5] rounded cursor-pointer"
+ >
+ <option value="round">Round</option>
+ <option value="butt">Flat</option>
+ <option value="square">Square</option>
+ </select>
+ </div>
+
+ {!openShape && (
+ <div className="flex items-center justify-between text-[11px]">
+ <span className="text-[#8a8a8a]">Corner</span>
+ <select
+ value={shapeSettings.lineJoin}
+ onChange={(e) =>
+ toolStoreActions.updateShapeSettings({
+ lineJoin: e.target.value as 'miter' | 'round' | 'bevel',
+ })
+ }
+ className="px-1.5 py-0.5 text-[11px] bg-[#161616] text-[#e5e5e5] rounded cursor-pointer"
+ >
+ <option value="miter">Sharp</option>
+ <option value="round">Round</option>
+ <option value="bevel">Bevel</option>
+ </select>
+ </div>
+ )}
+ </div>
+ )}
+
+ <div className="space-y-1.5 pt-1 border-t border-[#2c2c2c]">
+ <label className="flex items-center justify-between text-[11px] text-[#8a8a8a] cursor-pointer">
+ <span>Anti-aliasing</span>
+ <input
+ type="checkbox"
+ checked={shapeSettings.antiAlias}
+ onChange={(e) =>
+ toolStoreActions.updateShapeSettings({ antiAlias: e.target.checked })
+ }
+ />
+ </label>
+ <label
+ className="flex items-center justify-between text-[11px] text-[#8a8a8a] cursor-pointer"
+ title="Lock 1:1 aspect ratio or 15° angle increments (or hold Shift while dragging)"
+ >
+ <span>Constrain (Shift)</span>
+ <input
+ type="checkbox"
+ checked={shapeSettings.constrainAspect}
+ onChange={(e) =>
+ toolStoreActions.updateShapeSettings({ constrainAspect: e.target.checked })
+ }
+ />
+ </label>
+ <label
+ className="flex items-center justify-between text-[11px] text-[#8a8a8a] cursor-pointer"
+ title="Draw symmetrically from center (or hold Alt while dragging)"
+ >
+ <span>From Center (Alt)</span>
+ <input
+ type="checkbox"
+ checked={shapeSettings.fromCenter}
+ onChange={(e) =>
+ toolStoreActions.updateShapeSettings({ fromCenter: e.target.checked })
+ }
+ />
+ </label>
+ </div>
+ </div>
+ );
+ }
+
if (currentTool === 'liquify') {
const activeMode = liquifySettings.mode ?? 'push';
return (
@@ -416,6 +685,19 @@ export const ToolPropertyInspector: React.FC<ToolPropertyInspectorProps> = React
}
/>
</label>
+ <label
+ className="flex items-center justify-between text-[11px] text-[#8a8a8a] cursor-pointer"
+ title="Apply Liquify simultaneously to all visible unlocked layers (or multi-selected layers / active folder)"
+ >
+ <span>Multi-layer</span>
+ <input
+ type="checkbox"
+ checked={liquifySettings.multiLayer ?? false}
+ onChange={(e) =>
+ toolStoreActions.updateLiquifySettings({ multiLayer: e.target.checked })
+ }
+ />
+ </label>
</div>
);
}
diff --git a/src/components/ToolStrip.tsx b/src/components/ToolStrip.tsx
index 3edb794..bf7946f 100644
--- a/src/components/ToolStrip.tsx
+++ b/src/components/ToolStrip.tsx
@@ -17,6 +17,7 @@ import {
MessageSquare,
Spline,
MousePointer2,
+ Shapes,
} from 'lucide-react';
import { ToolType } from '../types/editor';
import { LiquifyIcon } from './LiquifyIcon';
@@ -90,6 +91,7 @@ export const ToolStrip: React.FC<ToolStripProps> = React.memo(
dividerAfter: true,
},
{ id: 'fill', label: 'Fill (G)', icon: <PaintBucket className="w-3.5 h-3.5" /> },
+ { id: 'shape', label: 'Shapes (U)', icon: <Shapes className="w-3.5 h-3.5" /> },
{ id: 'object', label: 'Object (O)', icon: <MousePointer2 className="w-3.5 h-3.5" /> },
{ id: 'text', label: 'Text (T)', icon: <Type className="w-3.5 h-3.5" /> },
{ id: 'frame', label: 'Frame Border (F)', icon: <Frame className="w-3.5 h-3.5" /> },
diff --git a/src/components/TransformOverlay.tsx b/src/components/TransformOverlay.tsx
index 30fe49c..97f8be1 100644
--- a/src/components/TransformOverlay.tsx
+++ b/src/components/TransformOverlay.tsx
@@ -1,14 +1,9 @@
import React, { useRef, useLayoutEffect, useEffect, useMemo } from 'react';
import { TransformSession, Point2D, TransformMode } from '../types/editor';
import {
- Check,
- X,
FlipHorizontal,
FlipVertical,
RotateCcw,
- BoxSelect,
- Grid3X3,
- Square,
} from 'lucide-react';
import {
renderPerspectiveQuad,
@@ -651,7 +646,7 @@ export const TransformOverlay: React.FC<TransformOverlayProps> = ({
{/* 3. Floating Transform Toolbar (Pinned below transform boundary) */}
<div
- className="absolute z-40 bg-[#18191b] border border-[#33353b] rounded shadow-2xl px-2 py-1 flex items-center space-x-1.5 whitespace-nowrap select-none text-xs"
+ className="absolute z-40 bg-[#202020]/95 backdrop-blur-md border border-white/[0.1] rounded-md shadow-2xl px-1.5 py-1 flex items-center space-x-1.5 whitespace-nowrap select-none text-xs"
style={{
left: `${nonAffineBounds.minX + nonAffineBounds.width / 2}px`,
top: `${nonAffineBounds.maxY}px`,
@@ -661,61 +656,58 @@ export const TransformOverlay: React.FC<TransformOverlayProps> = ({
onPointerDown={(e) => e.stopPropagation()}
>
{/* Mode Switchers */}
- <div className="flex items-center space-x-0.5 bg-[#202226] p-0.5 rounded border border-[#2b2d31]">
+ <div className="flex items-center space-x-0.5 bg-[#161616] p-0.5 rounded border border-white/[0.06]">
<button
onClick={() => handleSwitchMode('affine')}
title="Free Transform (Affine Scale & Rotate)"
- className={`px-1.5 py-1 rounded text-[11px] font-medium flex items-center space-x-1 cursor-pointer transition-colors ${
+ className={`px-2 py-0.5 rounded text-[11px] font-medium cursor-pointer transition-colors ${
mode === 'affine'
- ? 'bg-[#293d45] text-[#5ce1e6] border border-[#3e5e6b]'
- : 'text-[#888888] hover:text-white'
+ ? 'bg-[var(--accent)] text-[var(--accent-contrast)]'
+ : 'text-[#8a8a8a] hover:text-[#e5e5e5]'
}`}
>
- <BoxSelect className="w-3.5 h-3.5" />
- <span>Free</span>
+ Free
</button>
<button
onClick={() => handleSwitchMode('perspective')}
title="Perspective Quad (4-Point Homography)"
- className={`px-1.5 py-1 rounded text-[11px] font-medium flex items-center space-x-1 cursor-pointer transition-colors ${
+ className={`px-2 py-0.5 rounded text-[11px] font-medium cursor-pointer transition-colors ${
mode === 'perspective'
- ? 'bg-[#293d45] text-[#5ce1e6] border border-[#3e5e6b]'
- : 'text-[#888888] hover:text-white'
+ ? 'bg-[var(--accent)] text-[var(--accent-contrast)]'
+ : 'text-[#8a8a8a] hover:text-[#e5e5e5]'
}`}
>
- <Square className="w-3.5 h-3.5" />
- <span>Perspective</span>
+ Perspective
</button>
<button
onClick={() => handleSwitchMode('mesh')}
title="Mesh Warp (Catmull-Rom Bezier Lattice)"
- className={`px-1.5 py-1 rounded text-[11px] font-medium flex items-center space-x-1 cursor-pointer transition-colors ${
+ className={`px-2 py-0.5 rounded text-[11px] font-medium cursor-pointer transition-colors ${
mode === 'mesh'
- ? 'bg-[#293d45] text-[#5ce1e6] border border-[#3e5e6b]'
- : 'text-[#888888] hover:text-white'
+ ? 'bg-[var(--accent)] text-[var(--accent-contrast)]'
+ : 'text-[#8a8a8a] hover:text-[#e5e5e5]'
}`}
>
- <Grid3X3 className="w-3.5 h-3.5" />
- <span>Mesh Warp</span>
+ Mesh
</button>
</div>
{/* Mesh Grid Density Selector (when in mesh mode) */}
{mode === 'mesh' && (
<>
- <div className="w-px h-4 bg-[#33353b]" />
- <div className="flex items-center space-x-1 text-[11px] text-[#aaaaaa]">
- <span>Grid:</span>
+ <div className="w-px h-4 bg-white/[0.08]" />
+ <div className="flex items-center space-x-1 text-[11px] text-[#8a8a8a]">
+ <span>Grid</span>
{[3, 4, 5, 6, 8].map((size) => (
<button
key={size}
onClick={() => handleChangeMeshGrid(size)}
className={`px-1 py-0.5 rounded cursor-pointer transition-colors ${
(session.meshCols || 4) === size
- ? 'bg-cyan-500/30 text-cyan-300 font-bold'
- : 'hover:text-white hover:bg-[#25272a]'
+ ? 'bg-[var(--accent-subtle)] text-[var(--accent)] font-medium'
+ : 'hover:text-[#e5e5e5] hover:bg-[#2c2c2c]'
}`}
>
{size}x{size}
@@ -725,36 +717,36 @@ export const TransformOverlay: React.FC<TransformOverlayProps> = ({
</>
)}
- <div className="w-px h-4 bg-[#33353b]" />
+ <div className="w-px h-4 bg-white/[0.08]" />
{/* Apply */}
<button
onClick={onApply}
title="Apply Transform (Enter)"
- className="px-2 py-1 bg-[#234b3e] hover:bg-[#2b604f] text-[#55eaab] border border-[#2e6e58] rounded text-xs font-semibold flex items-center space-x-1 cursor-pointer transition-colors"
+ className="px-2.5 py-1 bg-[var(--accent)] text-[var(--accent-contrast)] hover:opacity-90 rounded text-[11px] font-medium cursor-pointer transition-opacity"
>
- <Check className="w-3.5 h-3.5" />
- <span>Apply</span>
+ Apply
</button>
{/* Cancel */}
<button
onClick={onCancel}
title="Cancel Transform (Esc)"
- className="px-2 py-1 bg-[#3a2024] hover:bg-[#4d282e] text-[#f87171] border border-[#6b2c34] rounded text-xs font-semibold flex items-center space-x-1 cursor-pointer transition-colors"
+ className="px-2 py-1 bg-[#2c2c2c] hover:bg-[#383838] text-[#e5e5e5] rounded text-[11px] cursor-pointer transition-colors"
>
- <X className="w-3.5 h-3.5" />
- <span>Cancel</span>
+ Cancel
</button>
- <div className="w-px h-4 bg-[#33353b]" />
+ <div className="w-px h-4 bg-white/[0.08]" />
{/* Flip Horizontal */}
<button
onClick={handleFlipH}
title="Flip Horizontal"
- className={`p-1 text-[#8c9099] hover:text-white hover:bg-[#2b2d31] rounded transition-colors cursor-pointer ${
- session.flipH ? 'bg-cyan-500/20 text-cyan-300' : ''
+ className={`p-1 rounded transition-colors cursor-pointer ${
+ session.flipH
+ ? 'bg-[var(--accent-subtle)] text-[var(--accent)]'
+ : 'text-[#8a8a8a] hover:text-[#e5e5e5] hover:bg-[#2c2c2c]'
}`}
>
<FlipHorizontal className="w-3.5 h-3.5" />
@@ -764,8 +756,10 @@ export const TransformOverlay: React.FC<TransformOverlayProps> = ({
<button
onClick={handleFlipV}
title="Flip Vertical"
- className={`p-1 text-[#8c9099] hover:text-white hover:bg-[#2b2d31] rounded transition-colors cursor-pointer ${
- session.flipV ? 'bg-cyan-500/20 text-cyan-300' : ''
+ className={`p-1 rounded transition-colors cursor-pointer ${
+ session.flipV
+ ? 'bg-[var(--accent-subtle)] text-[var(--accent)]'
+ : 'text-[#8a8a8a] hover:text-[#e5e5e5] hover:bg-[#2c2c2c]'
}`}
>
<FlipVertical className="w-3.5 h-3.5" />
@@ -775,7 +769,7 @@ export const TransformOverlay: React.FC<TransformOverlayProps> = ({
<button
onClick={handleReset}
title="Reset Transform"
- className="p-1 text-[#8c9099] hover:text-white hover:bg-[#2b2d31] rounded transition-colors cursor-pointer"
+ className="p-1 text-[#8a8a8a] hover:text-[#e5e5e5] hover:bg-[#2c2c2c] rounded transition-colors cursor-pointer"
>
<RotateCcw className="w-3.5 h-3.5" />
</button>
diff --git a/src/components/WebtoonExportModal.tsx b/src/components/WebtoonExportModal.tsx
index b3119c8..5b78cc2 100644
--- a/src/components/WebtoonExportModal.tsx
+++ b/src/components/WebtoonExportModal.tsx
@@ -1,5 +1,5 @@
import React, { useState } from 'react';
-import { X, Archive, Download, Loader2 } from 'lucide-react';
+import { X, Loader2 } from 'lucide-react';
import {
exportWebtoonChapterZip,
exportWebtoonChapterZipFromRenderer,
@@ -92,55 +92,52 @@ export const WebtoonExportModal: React.FC<WebtoonExportModalProps> = ({
};
return (
- <div className="fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-xs select-none">
- <div className="w-[460px] bg-[#222327] border border-[#3b3d45] rounded-lg shadow-2xl overflow-hidden flex flex-col text-[#cccccc] font-sans">
+ <div className="fixed inset-0 z-50 flex items-center justify-center bg-black/65 backdrop-blur-xs select-none">
+ <div className="w-[460px] bg-[#202020] border border-white/[0.1] rounded-lg shadow-2xl overflow-hidden flex flex-col text-[#e5e5e5] font-sans">
{/* Header */}
- <div className="px-4 py-3 bg-[#1a1b1e] border-b border-[#2e3036] flex items-center justify-between">
- <div className="flex items-center space-x-2">
- <Archive className="w-4 h-4 text-emerald-400" />
- <h2 className="text-sm font-semibold text-white">Webtoon Chapter Slicer Exporter</h2>
- </div>
+ <div className="px-4 py-2.5 bg-[#1a1a1a] border-b border-white/[0.06] flex items-center justify-between">
+ <h2 className="text-xs font-medium text-[#e5e5e5]">Webtoon Chapter Slicer</h2>
{!isExporting && (
<button
onClick={onClose}
- className="p-1 rounded text-[#888888] hover:text-white hover:bg-[#2b2d31] transition-colors"
+ className="p-1 rounded text-[#8a8a8a] hover:text-[#e5e5e5] hover:bg-[#2c2c2c] transition-colors cursor-pointer"
>
- <X className="w-4 h-4" />
+ <X className="w-3.5 h-3.5" />
</button>
)}
</div>
{/* Content */}
<div className="p-4 space-y-4 text-xs">
- <div className="bg-[#18191c] p-3 rounded border border-[#2e3036] space-y-1">
+ <div className="bg-[#161616] p-3 rounded border border-white/[0.06] space-y-1">
<div className="flex justify-between">
- <span className="text-[#888888]">Canvas Dimensions:</span>
- <span className="font-mono text-white">{canvasWidth} × {canvasHeight} px</span>
+ <span className="text-[#8a8a8a]">Canvas Dimensions</span>
+ <span className="font-mono text-[#e5e5e5]">{canvasWidth} × {canvasHeight} px</span>
</div>
<div className="flex justify-between">
- <span className="text-[#888888]">Total Slices:</span>
- <span className="font-mono text-emerald-400 font-semibold">{totalSlices} sequential tiles</span>
+ <span className="text-[#8a8a8a]">Total Slices</span>
+ <span className="font-mono text-[var(--accent)] font-medium">{totalSlices} tiles</span>
</div>
<div className="flex justify-between">
- <span className="text-[#888888]">Tile Dimensions:</span>
- <span className="font-mono text-white">{canvasWidth} × {sliceHeight} px</span>
+ <span className="text-[#8a8a8a]">Tile Dimensions</span>
+ <span className="font-mono text-[#e5e5e5]">{canvasWidth} × {sliceHeight} px</span>
</div>
</div>
<div className="space-y-1.5">
<div className="flex justify-between">
- <label className="text-[11px] text-[#aaaaaa] font-medium">Slice Tile Height:</label>
- <span className="font-mono text-cyan-400">{sliceHeight}px</span>
+ <label className="text-[11px] text-[#8a8a8a]">Slice Tile Height</label>
+ <span className="font-mono text-[#e5e5e5]">{sliceHeight}px</span>
</div>
- <div className="flex space-x-2">
+ <div className="flex space-x-1.5">
{[800, 1024, 1280, 1920].map((h) => (
<button
key={h}
onClick={() => setSliceHeight(h)}
- className={`flex-1 py-1 rounded text-xs border cursor-pointer font-medium transition-colors ${
+ className={`flex-1 py-1 rounded text-xs border cursor-pointer transition-colors ${
sliceHeight === h
- ? 'bg-cyan-500/20 text-cyan-300 border-cyan-500/40'
- : 'bg-[#18191c] border-[#33353b] text-[#888888] hover:text-white'
+ ? 'bg-[var(--accent-subtle)] text-[var(--accent)] border-[var(--accent-border)] font-medium'
+ : 'bg-[#161616] border-white/[0.06] text-[#8a8a8a] hover:text-[#e5e5e5] hover:bg-[#2c2c2c]'
}`}
>
{h}px
@@ -150,24 +147,24 @@ export const WebtoonExportModal: React.FC<WebtoonExportModalProps> = ({
</div>
<div className="space-y-1.5">
- <label className="text-[11px] text-[#aaaaaa] font-medium">Output Format:</label>
- <div className="grid grid-cols-2 gap-2">
+ <label className="text-[11px] text-[#8a8a8a]">Output Format</label>
+ <div className="grid grid-cols-2 gap-1.5">
<button
onClick={() => setFormat('jpg')}
- className={`py-1.5 rounded text-xs border cursor-pointer font-medium transition-colors ${
+ className={`py-1.5 rounded text-xs border cursor-pointer transition-colors ${
format === 'jpg'
- ? 'bg-emerald-500/20 text-emerald-300 border-emerald-500/40'
- : 'bg-[#18191c] border-[#33353b] text-[#888888] hover:text-white'
+ ? 'bg-[var(--accent-subtle)] text-[var(--accent)] border-[var(--accent-border)] font-medium'
+ : 'bg-[#161616] border-white/[0.06] text-[#8a8a8a] hover:text-[#e5e5e5] hover:bg-[#2c2c2c]'
}`}
>
- JPEG (Standard Webtoon)
+ JPEG (Standard)
</button>
<button
onClick={() => setFormat('png')}
- className={`py-1.5 rounded text-xs border cursor-pointer font-medium transition-colors ${
+ className={`py-1.5 rounded text-xs border cursor-pointer transition-colors ${
format === 'png'
- ? 'bg-emerald-500/20 text-emerald-300 border-emerald-500/40'
- : 'bg-[#18191c] border-[#33353b] text-[#888888] hover:text-white'
+ ? 'bg-[var(--accent-subtle)] text-[var(--accent)] border-[var(--accent-border)] font-medium'
+ : 'bg-[#161616] border-white/[0.06] text-[#8a8a8a] hover:text-[#e5e5e5] hover:bg-[#2c2c2c]'
}`}
>
PNG (Lossless)
@@ -178,8 +175,8 @@ export const WebtoonExportModal: React.FC<WebtoonExportModalProps> = ({
{format === 'jpg' && (
<div className="space-y-1.5">
<div className="flex justify-between text-[11px]">
- <span className="text-[#aaaaaa]">JPEG Compression Quality:</span>
- <span className="font-mono text-cyan-400">{quality}%</span>
+ <span className="text-[#8a8a8a]">JPEG Quality</span>
+ <span className="font-mono text-[#e5e5e5]">{quality}%</span>
</div>
<input
type="range"
@@ -187,23 +184,23 @@ export const WebtoonExportModal: React.FC<WebtoonExportModalProps> = ({
max={100}
value={quality}
onChange={(e) => setQuality(Number(e.target.value))}
- className="w-full accent-cyan-400"
+ className="w-full"
/>
</div>
)}
{isExporting && progress && (
- <div className="space-y-2 pt-2 border-t border-[#2e3036]">
+ <div className="space-y-2 pt-2 border-t border-white/[0.06]">
<div className="flex justify-between text-[11px]">
- <span className="text-white flex items-center space-x-1.5">
- <Loader2 className="w-3.5 h-3.5 animate-spin text-emerald-400" />
+ <span className="text-[#e5e5e5] flex items-center space-x-1.5">
+ <Loader2 className="w-3.5 h-3.5 animate-spin text-[var(--accent)]" />
<span>Slicing tile {progress.current} of {progress.total}...</span>
</span>
- <span className="font-mono text-emerald-400">{progress.percent}%</span>
+ <span className="font-mono text-[#e5e5e5]">{progress.percent}%</span>
</div>
- <div className="w-full bg-[#18191c] h-2 rounded-full overflow-hidden border border-[#33353b]">
+ <div className="w-full bg-[#161616] h-1.5 rounded-full overflow-hidden border border-white/[0.06]">
<div
- className="bg-emerald-500 h-full transition-all duration-150"
+ className="bg-[var(--accent)] h-full transition-all duration-150"
style={{ width: `${progress.percent}%` }}
/>
</div>
@@ -212,11 +209,11 @@ export const WebtoonExportModal: React.FC<WebtoonExportModalProps> = ({
</div>
{/* Footer */}
- <div className="px-4 py-3 bg-[#1a1b1e] border-t border-[#2e3036] flex items-center justify-end space-x-2">
+ <div className="px-4 py-2.5 bg-[#1a1a1a] border-t border-white/[0.06] flex items-center justify-end space-x-2">
{!isExporting && (
<button
onClick={onClose}
- className="px-3 py-1.5 bg-[#2b2d31] hover:bg-[#383a40] text-[#cccccc] rounded text-xs transition-colors cursor-pointer"
+ className="px-3 py-1.5 bg-[#2c2c2c] hover:bg-[#383838] text-[#e5e5e5] rounded text-xs transition-colors cursor-pointer"
>
Cancel
</button>
@@ -224,14 +221,9 @@ export const WebtoonExportModal: React.FC<WebtoonExportModalProps> = ({
<button
onClick={handleStartExport}
disabled={isExporting}
- className={`px-3.5 py-1.5 rounded text-xs font-semibold flex items-center space-x-1.5 transition-colors cursor-pointer ${
- isExporting
- ? 'bg-[#1e382d] text-[#777777] cursor-not-allowed'
- : 'bg-[#1b4e3b] hover:bg-[#23634b] text-[#55eaab] border border-[#2a7a5c]'
- }`}
+ className="px-3.5 py-1.5 rounded text-xs font-medium bg-[var(--accent)] text-[var(--accent-contrast)] hover:opacity-90 transition-opacity cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed"
>
- <Download className="w-3.5 h-3.5" />
- <span>{isExporting ? 'Packaging ZIP...' : `Export ${totalSlices} Tiles (.ZIP)`}</span>
+ {isExporting ? 'Packaging ZIP...' : `Export ${totalSlices} Tiles (.ZIP)`}
</button>
</div>
</div>
diff --git a/src/hooks/drawing/useDrawingHistory.ts b/src/hooks/drawing/useDrawingHistory.ts
index b24070a..d169ceb 100644
--- a/src/hooks/drawing/useDrawingHistory.ts
+++ b/src/hooks/drawing/useDrawingHistory.ts
@@ -13,6 +13,7 @@ import {
import {
SparseTileGrid,
globalTileGrid,
+ parseTileKey,
releaseTemporaryCanvas,
} from '../../utils/tileEngine';
import { UndoCacheManager, globalUndoCache } from '../../utils/undoCache';
@@ -448,21 +449,37 @@ export function useDrawingHistory({
} else if (deltas && deltas.length > 0) {
grid.applyTileDeltas(deltas, 'undo');
- if (isToneStep && sourceCanvas) {
- grid.renderLayerToCanvas(targetLayerId, sourceCanvas, item.dirtyRect);
- if (canvas && targetLayer) {
- applyLayerEffects(
- sourceCanvas,
- canvas,
- targetLayer,
- dimensionsRef.current.dpi ?? 600,
- item.dirtyRect
- );
+ const affectedLayerIds = new Set<string>();
+ for (const d of deltas) {
+ affectedLayerIds.add(parseTileKey(d.key).layerId);
+ }
+ if (affectedLayerIds.size === 0) {
+ affectedLayerIds.add(targetLayerId);
+ }
+ for (const lid of affectedLayerIds) {
+ const lCanvas = layerCanvasesRef.current.get(lid) || null;
+ const lSourceCanvas = layerSourceCanvasesRef?.current?.get(lid);
+ const lLayer = layersRef.current?.find((l) => l.id === lid);
+ const lIsTone = Boolean(lLayer?.toneEnabled && lSourceCanvas);
+ if (lIsTone && lSourceCanvas) {
+ grid.renderLayerToCanvas(lid, lSourceCanvas, item.dirtyRect);
+ if (lCanvas && lLayer) {
+ applyLayerEffects(
+ lSourceCanvas,
+ lCanvas,
+ lLayer,
+ dimensionsRef.current.dpi ?? 600,
+ item.dirtyRect
+ );
+ }
+ } else if (lCanvas) {
+ grid.renderLayerToCanvas(lid, lCanvas, item.dirtyRect);
+ if (lSourceCanvas) {
+ grid.renderLayerToCanvas(lid, lSourceCanvas, item.dirtyRect);
+ }
}
- } else if (canvas) {
- grid.renderLayerToCanvas(targetLayerId, canvas, item.dirtyRect);
- if (sourceCanvas) {
- grid.renderLayerToCanvas(targetLayerId, sourceCanvas, item.dirtyRect);
+ if (lid !== targetLayerId) {
+ onUpdateLayerThumbnail(lid);
}
}
} else if (isToneStep && sourceCanvas) {
@@ -586,21 +603,37 @@ export function useDrawingHistory({
} else if (deltas && deltas.length > 0) {
grid.applyTileDeltas(deltas, 'redo');
- if (isToneStep && sourceCanvas) {
- grid.renderLayerToCanvas(targetLayerId, sourceCanvas, item.dirtyRect);
- if (canvas && targetLayer) {
- applyLayerEffects(
- sourceCanvas,
- canvas,
- targetLayer,
- dimensionsRef.current.dpi ?? 600,
- item.dirtyRect
- );
+ const affectedLayerIds = new Set<string>();
+ for (const d of deltas) {
+ affectedLayerIds.add(parseTileKey(d.key).layerId);
+ }
+ if (affectedLayerIds.size === 0) {
+ affectedLayerIds.add(targetLayerId);
+ }
+ for (const lid of affectedLayerIds) {
+ const lCanvas = layerCanvasesRef.current.get(lid) || null;
+ const lSourceCanvas = layerSourceCanvasesRef?.current?.get(lid);
+ const lLayer = layersRef.current?.find((l) => l.id === lid);
+ const lIsTone = Boolean(lLayer?.toneEnabled && lSourceCanvas);
+ if (lIsTone && lSourceCanvas) {
+ grid.renderLayerToCanvas(lid, lSourceCanvas, item.dirtyRect);
+ if (lCanvas && lLayer) {
+ applyLayerEffects(
+ lSourceCanvas,
+ lCanvas,
+ lLayer,
+ dimensionsRef.current.dpi ?? 600,
+ item.dirtyRect
+ );
+ }
+ } else if (lCanvas) {
+ grid.renderLayerToCanvas(lid, lCanvas, item.dirtyRect);
+ if (lSourceCanvas) {
+ grid.renderLayerToCanvas(lid, lSourceCanvas, item.dirtyRect);
+ }
}
- } else if (canvas) {
- grid.renderLayerToCanvas(targetLayerId, canvas, item.dirtyRect);
- if (sourceCanvas) {
- grid.renderLayerToCanvas(targetLayerId, sourceCanvas, item.dirtyRect);
+ if (lid !== targetLayerId) {
+ onUpdateLayerThumbnail(lid);
}
}
} else if (isToneStep && sourceCanvas) {
diff --git a/src/hooks/drawing/useShapeAndFillTools.ts b/src/hooks/drawing/useShapeAndFillTools.ts
index cb66f09..8b55c75 100644
--- a/src/hooks/drawing/useShapeAndFillTools.ts
+++ b/src/hooks/drawing/useShapeAndFillTools.ts
@@ -1,4 +1,4 @@
-import React, { useState, useRef, useCallback } from 'react';
+import React, { useState, useRef, useCallback, useEffect } from 'react';
import {
CanvasColorMode,
CanvasDimensions,
@@ -6,18 +6,27 @@ import {
ComicFrame,
FrameDivideMode,
LayerItem,
+ ShapeDragPreview,
SpeechBalloon,
TextLayerData,
TextSettings,
+ TileDelta,
} from '../../types/editor';
import { documentStore } from '../../utils/documentStore';
+import { TileFormat } from '../../utils/tileEngine';
import {
executeFloodFill,
compositeVisibleLayers,
compositeReferenceLayers,
executeLassoFill,
} from '../../utils/floodFill';
-import { applyLiquifyStep, createLiquifySelectionMask, DirtyRect } from '../../utils/liquifyEngine';
+import {
+ applyLiquifyStep,
+ createLiquifySelectionMask,
+ resolveLiquifyTargetLayers,
+ DirtyRect,
+} from '../../utils/liquifyEngine';
+import { rasterizeShapeToCanvas, resolveShapeFillColor } from '../../utils/shapeEngine';
import { applyLayerEffects } from '../../utils/layerEffectsEngine';
import { createSelectionMask } from '../../utils/tonalEngine';
import { get2DContext, sampleCompositedColor } from '../../utils/canvasUtils';
@@ -53,9 +62,11 @@ export interface UseShapeAndFillToolsParams {
layers: LayerItem[];
activeLayer: LayerItem | undefined;
activeLayerId: string;
+ selectedLayerIds?: string[];
selection: CanvasSelection | null;
layerCanvasesRef: React.MutableRefObject<Map<string, HTMLCanvasElement>>;
layerSourceCanvasesRef: React.MutableRefObject<Map<string, HTMLCanvasElement>>;
+ materializeLayerCanvas?: (layerId: string) => HTMLCanvasElement | null;
isLayerEffectivelyVisible: (layer: LayerItem) => boolean;
getEffectiveOpacity: (layer: LayerItem) => number;
getActiveCanvas: () => HTMLCanvasElement | null;
@@ -87,6 +98,7 @@ export interface UseShapeAndFillToolsResult {
activeBalloon: SpeechBalloon | null;
setActiveBalloon: React.Dispatch<React.SetStateAction<SpeechBalloon | null>>;
frameDragPreview: FrameDragPreview | null;
+ shapeDragPreview: ShapeDragPreview | null;
openLayerForEditing: (layer: LayerItem) => boolean;
isPipetteSamplingRef: React.MutableRefObject<boolean>;
handleSampleColor: (pt: { x: number; y: number }) => void;
@@ -105,15 +117,39 @@ export interface UseShapeAndFillToolsResult {
) => boolean;
}
+interface LiquifyLayerSession {
+ layer: LayerItem;
+ layerId: string;
+ isTone: boolean;
+ sourceCanvas?: HTMLCanvasElement;
+ displayCanvas: HTMLCanvasElement;
+ workCanvas: HTMLCanvasElement;
+ initialImageData: ImageData | null;
+ beforeTileSnapshot: Map<string, { format: TileFormat; data: Uint8Array | null }>;
+ dirtyRect: DirtyRect | null;
+}
+
+function mergeDirtyRects(a: DirtyRect | null, b: DirtyRect | null): DirtyRect | null {
+ if (!a) return b ? { ...b } : null;
+ if (!b) return a;
+ const minX = Math.min(a.x, b.x);
+ const minY = Math.min(a.y, b.y);
+ const maxX = Math.max(a.x + a.width, b.x + b.width);
+ const maxY = Math.max(a.y + a.height, b.y + b.height);
+ return { x: minX, y: minY, width: maxX - minX, height: maxY - minY };
+}
+
export function useShapeAndFillTools({
dimensions,
colorMode,
layers,
activeLayer,
activeLayerId,
+ selectedLayerIds = [],
selection,
layerCanvasesRef,
layerSourceCanvasesRef,
+ materializeLayerCanvas,
isLayerEffectivelyVisible,
getEffectiveOpacity,
getActiveCanvas,
@@ -132,10 +168,68 @@ export function useShapeAndFillTools({
const [activeBalloon, setActiveBalloon] = useState<SpeechBalloon | null>(null);
const [editingBalloonLayerId, setEditingBalloonLayerId] = useState<string | null>(null);
const [frameDragPreview, setFrameDragPreview] = useState<FrameDragPreview | null>(null);
+ const [shapeDragPreview, setShapeDragPreview] = useState<ShapeDragPreview | null>(null);
const isPipetteSamplingRef = useRef<boolean>(false);
const lassoFillPointsRef = useRef<Array<{ x: number; y: number }>>([]);
const frameStartRef = useRef<{ x: number; y: number } | null>(null);
+ const shapeDragRef = useRef<{
+ start: { x: number; y: number };
+ end: { x: number; y: number };
+ shiftKey: boolean;
+ altKey: boolean;
+ spaceHeld: boolean;
+ } | null>(null);
+
+ useEffect(() => {
+ if (!shapeDragPreview) return;
+ const handleKeyDown = (ev: KeyboardEvent) => {
+ if (!shapeDragRef.current) return;
+ if (ev.key === 'Escape') {
+ ev.preventDefault();
+ shapeDragRef.current = null;
+ setShapeDragPreview(null);
+ return;
+ }
+ if (ev.key === ' ' || ev.code === 'Space') {
+ shapeDragRef.current.spaceHeld = true;
+ }
+ if (ev.key === 'Shift' || ev.key === 'Alt') {
+ shapeDragRef.current.shiftKey = ev.shiftKey;
+ shapeDragRef.current.altKey = ev.altKey;
+ setShapeDragPreview({
+ start: { ...shapeDragRef.current.start },
+ end: { ...shapeDragRef.current.end },
+ shiftKey: ev.shiftKey,
+ altKey: ev.altKey,
+ settings: useToolStore.getState().shapeSettings,
+ });
+ }
+ };
+ const handleKeyUp = (ev: KeyboardEvent) => {
+ if (!shapeDragRef.current) return;
+ if (ev.key === ' ' || ev.code === 'Space') {
+ shapeDragRef.current.spaceHeld = false;
+ }
+ if (ev.key === 'Shift' || ev.key === 'Alt') {
+ shapeDragRef.current.shiftKey = ev.shiftKey;
+ shapeDragRef.current.altKey = ev.altKey;
+ setShapeDragPreview({
+ start: { ...shapeDragRef.current.start },
+ end: { ...shapeDragRef.current.end },
+ shiftKey: ev.shiftKey,
+ altKey: ev.altKey,
+ settings: useToolStore.getState().shapeSettings,
+ });
+ }
+ };
+ window.addEventListener('keydown', handleKeyDown);
+ window.addEventListener('keyup', handleKeyUp);
+ return () => {
+ window.removeEventListener('keydown', handleKeyDown);
+ window.removeEventListener('keyup', handleKeyUp);
+ };
+ }, [shapeDragPreview]);
const openLayerForEditing = useCallback(
(layer: LayerItem): boolean => {
@@ -183,9 +277,7 @@ export function useShapeAndFillTools({
const isLiquifyingRef = useRef<boolean>(false);
const prevLiquifyPointRef = useRef<{ x: number; y: number } | null>(null);
- const liquifyBeforeImageDataRef = useRef<ImageData | null>(null);
- const liquifyInitialImageDataRef = useRef<ImageData | null>(null);
- const liquifyDirtyRectRef = useRef<DirtyRect | null>(null);
+ const liquifySessionsRef = useRef<LiquifyLayerSession[]>([]);
const liquifyRafIdRef = useRef<number | null>(null);
const liquifyLastPointerPosRef = useRef<{
pt: { x: number; y: number };
@@ -270,69 +362,83 @@ export function useShapeAndFillTools({
setEditingBalloonLayerId(null);
}, [editingBalloonLayerId, deleteLayer]);
- const startLiquifyLoop = useCallback(
- (canvas: HTMLCanvasElement, sourceCanvas: HTMLCanvasElement | undefined, isTone: boolean) => {
- if (liquifyRafIdRef.current) cancelAnimationFrame(liquifyRafIdRef.current);
-
- const tick = () => {
- if (!isLiquifyingRef.current || !liquifyLastPointerPosRef.current) {
- liquifyRafIdRef.current = null;
- return;
+ const syncLiquifySessionDirty = useCallback(
+ (session: LiquifyLayerSession, dirty: DirtyRect) => {
+ if (dirty.width <= 0 || dirty.height <= 0) return;
+ session.dirtyRect = mergeDirtyRects(session.dirtyRect, dirty);
+ const grid = documentStore.getActiveTileGrid();
+ const isMono =
+ colorMode === 'monochrome' || session.layer.expressionColor === 'monochrome';
+ const targetFormat: TileFormat = isMono ? 'monochrome-1bit' : 'color-32bit';
+
+ if (session.isTone && session.sourceCanvas) {
+ applyLayerEffects(
+ session.sourceCanvas,
+ session.displayCanvas,
+ session.layer,
+ dimensions.dpi ?? 600,
+ dirty
+ );
+ const sCtx = get2DContext(session.sourceCanvas);
+ if (sCtx) {
+ const subData = sCtx.getImageData(dirty.x, dirty.y, dirty.width, dirty.height);
+ grid.writeImageData(session.layerId, subData, dirty.x, dirty.y, targetFormat);
+ }
+ } else {
+ const dCtx = get2DContext(session.workCanvas);
+ if (dCtx) {
+ const subData = dCtx.getImageData(dirty.x, dirty.y, dirty.width, dirty.height);
+ grid.writeImageData(session.layerId, subData, dirty.x, dirty.y, targetFormat);
}
- const { pt, pressure } = liquifyLastPointerPosRef.current;
- const liquifySettings = useToolStore.getState().liquifySettings;
+ }
+ },
+ [colorMode, dimensions.dpi]
+ );
+
+ const startLiquifyLoop = useCallback(() => {
+ if (liquifyRafIdRef.current) cancelAnimationFrame(liquifyRafIdRef.current);
+
+ const tick = () => {
+ if (
+ !isLiquifyingRef.current ||
+ !liquifyLastPointerPosRef.current ||
+ liquifySessionsRef.current.length === 0
+ ) {
+ liquifyRafIdRef.current = null;
+ return;
+ }
+ const { pt, pressure } = liquifyLastPointerPosRef.current;
+ const liquifySettings = useToolStore.getState().liquifySettings;
+ let anyDirty = false;
+
+ for (const session of liquifySessionsRef.current) {
const dirty = applyLiquifyStep({
- canvas,
- sourceCanvas: isTone ? sourceCanvas : undefined,
+ canvas: session.workCanvas,
+ sourceCanvas: session.isTone ? session.sourceCanvas : undefined,
cx: pt.x,
cy: pt.y,
prevX: pt.x,
prevY: pt.y,
settings: liquifySettings,
pressure,
- initialImageData: liquifyInitialImageDataRef.current,
+ initialImageData: session.initialImageData,
selectionMask: liquifySelectionMaskRef.current,
});
-
if (dirty) {
- if (activeLayer?.toneEnabled && sourceCanvas) {
- const displayCanvas = layerCanvasesRef.current.get(activeLayerId);
- if (displayCanvas) {
- applyLayerEffects(
- sourceCanvas,
- displayCanvas,
- activeLayer,
- dimensions.dpi ?? 600,
- dirty
- );
- }
- } else {
- const dCtx = get2DContext(canvas);
- if (dCtx && dirty.width > 0 && dirty.height > 0) {
- const subData = dCtx.getImageData(dirty.x, dirty.y, dirty.width, dirty.height);
- const isMono =
- colorMode === 'monochrome' || activeLayer?.expressionColor === 'monochrome';
- documentStore
- .getActiveTileGrid()
- .writeImageData(
- activeLayerId,
- subData,
- dirty.x,
- dirty.y,
- isMono ? 'monochrome-1bit' : 'color-32bit'
- );
- }
- }
- documentStore.getActiveTileGrid().notifyChange(true);
+ syncLiquifySessionDirty(session, dirty);
+ anyDirty = true;
}
+ }
- liquifyRafIdRef.current = requestAnimationFrame(tick);
- };
+ if (anyDirty) {
+ documentStore.getActiveTileGrid().notifyChange(true);
+ }
liquifyRafIdRef.current = requestAnimationFrame(tick);
- },
- [activeLayer, activeLayerId, colorMode, dimensions.dpi, layerCanvasesRef]
- );
+ };
+
+ liquifyRafIdRef.current = requestAnimationFrame(tick);
+ }, [syncLiquifySessionDirty]);
const handleShapeFillPointerDown = useCallback(
(e: React.PointerEvent<HTMLElement>, pt: { x: number; y: number }): boolean => {
@@ -343,6 +449,7 @@ export function useShapeAndFillTools({
textSettings,
balloonSettings,
liquifySettings,
+ shapeSettings,
} = useToolStore.getState();
if (tool === 'pipette') {
@@ -357,37 +464,122 @@ export function useShapeAndFillTools({
return true;
}
- if (tool === 'liquify') {
+ if (tool === 'shape') {
e.preventDefault();
if (
!activeLayer ||
+ activeLayer.type !== 'raster' ||
activeLayer.locked ||
- (activeLayer && !isLayerEffectivelyVisible(activeLayer))
+ !isLayerEffectivelyVisible(activeLayer)
) {
+ showToast?.('Select an unlocked, visible raster layer to draw shapes');
return true;
}
- const targetLayerId = activeLayerId;
- const isTone = Boolean(
- activeLayer?.toneEnabled && layerSourceCanvasesRef.current?.get(targetLayerId)
+ try {
+ (e.target as HTMLElement).setPointerCapture(e.pointerId);
+ } catch {
+ // Ignore pointer capture errors
+ }
+ shapeDragRef.current = {
+ start: pt,
+ end: pt,
+ shiftKey: e.shiftKey,
+ altKey: e.altKey,
+ spaceHeld: false,
+ };
+ setShapeDragPreview({
+ start: pt,
+ end: pt,
+ shiftKey: e.shiftKey,
+ altKey: e.altKey,
+ settings: shapeSettings,
+ });
+ return true;
+ }
+
+ if (tool === 'liquify') {
+ e.preventDefault();
+ const isMulti = Boolean(liquifySettings.multiLayer);
+ const targetLayers = resolveLiquifyTargetLayers(
+ layers,
+ activeLayer,
+ selectedLayerIds,
+ isLayerEffectivelyVisible,
+ isMulti
);
- const sourceCanvas = layerSourceCanvasesRef.current?.get(targetLayerId);
- const displayCanvas = layerCanvasesRef.current.get(targetLayerId);
- const canvas = isTone && sourceCanvas ? sourceCanvas : displayCanvas;
- if (!canvas) return true;
+ if (targetLayers.length === 0) {
+ return true;
+ }
- const ctx = get2DContext(canvas);
- if (!ctx) return true;
+ const grid = documentStore.getActiveTileGrid();
+ const needInitialImage = liquifySettings.mode === 'reconstruct';
+ const sessions: LiquifyLayerSession[] = [];
+
+ for (const layer of targetLayers) {
+ const targetId = layer.id;
+ const displayCanvas =
+ layerCanvasesRef.current.get(targetId) ?? materializeLayerCanvas?.(targetId) ?? null;
+ if (!displayCanvas) continue;
+
+ const sourceCanvas = layerSourceCanvasesRef.current?.get(targetId);
+ const isTone = Boolean(layer.toneEnabled && sourceCanvas);
+ const workCanvas = isTone && sourceCanvas ? sourceCanvas : displayCanvas;
+
+ // Skip strictly blank layers in multi-layer mode to avoid wasted work
+ if (
+ isMulti &&
+ targetLayers.length > 1 &&
+ (workCanvas as unknown as { __isBlank?: boolean }).__isBlank &&
+ !grid.hasLayerTiles(targetId)
+ ) {
+ continue;
+ }
+
+ const ctx = get2DContext(workCanvas);
+ if (!ctx) continue;
+
+ const isMono = colorMode === 'monochrome' || layer.expressionColor === 'monochrome';
+ const targetFormat: TileFormat = isMono ? 'monochrome-1bit' : 'color-32bit';
+ if (
+ !grid.hasLayerTiles(targetId) &&
+ !(workCanvas as unknown as { __isBlank?: boolean }).__isBlank
+ ) {
+ grid.ingestCanvas(targetId, workCanvas, targetFormat);
+ }
+
+ const beforeTileSnapshot = grid.snapshotTilesInRect(targetId, {
+ x: 0,
+ y: 0,
+ width: workCanvas.width,
+ height: workCanvas.height,
+ });
+ const initialImageData = needInitialImage
+ ? ctx.getImageData(0, 0, workCanvas.width, workCanvas.height)
+ : null;
+
+ sessions.push({
+ layer,
+ layerId: targetId,
+ isTone,
+ sourceCanvas,
+ displayCanvas,
+ workCanvas,
+ initialImageData,
+ beforeTileSnapshot,
+ dirtyRect: null,
+ });
+ }
+
+ if (sessions.length === 0) return true;
isLiquifyingRef.current = true;
prevLiquifyPointRef.current = pt;
- liquifyBeforeImageDataRef.current = ctx.getImageData(0, 0, canvas.width, canvas.height);
- liquifyInitialImageDataRef.current = liquifyBeforeImageDataRef.current;
+ liquifySessionsRef.current = sessions;
liquifySelectionMaskRef.current = createLiquifySelectionMask(
selection,
- canvas.width,
- canvas.height
+ sessions[0].workCanvas.width,
+ sessions[0].workCanvas.height
);
- liquifyDirtyRectRef.current = null;
liquifyLastPointerPosRef.current = { pt, pressure: e.pressure || 1.0 };
try {
@@ -404,45 +596,29 @@ export function useShapeAndFillTools({
mode === 'twirl-ccw' ||
mode === 'reconstruct'
) {
- const dirty = applyLiquifyStep({
- canvas,
- sourceCanvas: isTone ? sourceCanvas : undefined,
- cx: pt.x,
- cy: pt.y,
- prevX: pt.x,
- prevY: pt.y,
- settings: liquifySettings,
- pressure: e.pressure || 1.0,
- initialImageData: liquifyInitialImageDataRef.current,
- selectionMask: liquifySelectionMaskRef.current,
- });
- if (dirty) {
- liquifyDirtyRectRef.current = dirty;
- if (activeLayer?.toneEnabled && sourceCanvas && displayCanvas) {
- applyLayerEffects(
- sourceCanvas,
- displayCanvas,
- activeLayer,
- dimensions.dpi ?? 600,
- dirty
- );
- } else if (dirty.width > 0 && dirty.height > 0) {
- const subData = ctx.getImageData(dirty.x, dirty.y, dirty.width, dirty.height);
- const isMono =
- colorMode === 'monochrome' || activeLayer?.expressionColor === 'monochrome';
- documentStore
- .getActiveTileGrid()
- .writeImageData(
- targetLayerId,
- subData,
- dirty.x,
- dirty.y,
- isMono ? 'monochrome-1bit' : 'color-32bit'
- );
+ let anyDirty = false;
+ for (const session of sessions) {
+ const dirty = applyLiquifyStep({
+ canvas: session.workCanvas,
+ sourceCanvas: session.isTone ? session.sourceCanvas : undefined,
+ cx: pt.x,
+ cy: pt.y,
+ prevX: pt.x,
+ prevY: pt.y,
+ settings: liquifySettings,
+ pressure: e.pressure || 1.0,
+ initialImageData: session.initialImageData,
+ selectionMask: liquifySelectionMaskRef.current,
+ });
+ if (dirty) {
+ syncLiquifySessionDirty(session, dirty);
+ anyDirty = true;
}
- documentStore.getActiveTileGrid().notifyChange(true);
}
- startLiquifyLoop(canvas, sourceCanvas, isTone);
+ if (anyDirty) {
+ grid.notifyChange(true);
+ }
+ startLiquifyLoop();
}
return true;
}
@@ -586,13 +762,16 @@ export function useShapeAndFillTools({
handleSampleColor,
activeLayer,
activeLayerId,
+ selectedLayerIds,
isLayerEffectivelyVisible,
layerSourceCanvasesRef,
layerCanvasesRef,
+ materializeLayerCanvas,
selection,
dimensions,
colorMode,
startLiquifyLoop,
+ syncLiquifySessionDirty,
getActiveCanvas,
layers,
updateLayerThumbnail,
@@ -604,7 +783,7 @@ export function useShapeAndFillTools({
const handleShapeFillPointerMove = useCallback(
(e: React.PointerEvent<HTMLElement>): boolean => {
- const { tool, fillSettings, liquifySettings } = useToolStore.getState();
+ const { tool, fillSettings, liquifySettings, shapeSettings } = useToolStore.getState();
if (tool === 'pipette') {
if (isPipetteSamplingRef.current) {
@@ -614,109 +793,79 @@ export function useShapeAndFillTools({
return true;
}
+ if (tool === 'shape') {
+ if (!shapeDragRef.current) return true;
+ const pt = getCanvasCoords(e);
+ if (shapeDragRef.current.spaceHeld) {
+ const dx = pt.x - shapeDragRef.current.end.x;
+ const dy = pt.y - shapeDragRef.current.end.y;
+ shapeDragRef.current.start = {
+ x: shapeDragRef.current.start.x + dx,
+ y: shapeDragRef.current.start.y + dy,
+ };
+ }
+ shapeDragRef.current.end = pt;
+ shapeDragRef.current.shiftKey = e.shiftKey;
+ shapeDragRef.current.altKey = e.altKey;
+ setShapeDragPreview({
+ start: { ...shapeDragRef.current.start },
+ end: { ...pt },
+ shiftKey: e.shiftKey,
+ altKey: e.altKey,
+ settings: shapeSettings,
+ });
+ return true;
+ }
+
if (tool === 'liquify') {
- if (!isLiquifyingRef.current) return true;
+ if (!isLiquifyingRef.current || liquifySessionsRef.current.length === 0) return true;
const pt = getCanvasCoords(e);
const pressure = e.pressure || 1.0;
liquifyLastPointerPosRef.current = { pt, pressure };
- const targetLayerId = activeLayerId;
- const isTone = Boolean(
- activeLayer?.toneEnabled && layerSourceCanvasesRef.current?.get(targetLayerId)
- );
- const sourceCanvas = layerSourceCanvasesRef.current?.get(targetLayerId);
- const displayCanvas = layerCanvasesRef.current.get(targetLayerId);
- const canvas = isTone && sourceCanvas ? sourceCanvas : displayCanvas;
- if (!canvas) return true;
-
const prev = prevLiquifyPointRef.current || pt;
const dist = Math.hypot(pt.x - prev.x, pt.y - prev.y);
const stepDist = Math.max(2, (liquifySettings.size / 2) * 0.25);
const numSteps = Math.max(1, Math.ceil(dist / stepDist));
-
- let overallDirty: DirtyRect | null = null;
- for (let i = 1; i <= numSteps; i++) {
- const t = i / numSteps;
- const cx = prev.x + (pt.x - prev.x) * t;
- const cy = prev.y + (pt.y - prev.y) * t;
- const px = prev.x + (pt.x - prev.x) * ((i - 1) / numSteps);
- const py = prev.y + (pt.y - prev.y) * ((i - 1) / numSteps);
-
- const dirty = applyLiquifyStep({
- canvas,
- sourceCanvas: isTone ? sourceCanvas : undefined,
- cx,
- cy,
- prevX: px,
- prevY: py,
- settings: liquifySettings,
- pressure,
- initialImageData: liquifyInitialImageDataRef.current,
- selectionMask: liquifySelectionMaskRef.current,
- });
-
- if (dirty) {
- if (!overallDirty) {
- overallDirty = { ...dirty };
- } else {
- const minX = Math.min(overallDirty.x, dirty.x);
- const minY = Math.min(overallDirty.y, dirty.y);
- const maxX = Math.max(overallDirty.x + overallDirty.width, dirty.x + dirty.width);
- const maxY = Math.max(overallDirty.y + overallDirty.height, dirty.y + dirty.height);
- overallDirty = { x: minX, y: minY, width: maxX - minX, height: maxY - minY };
+ let anyDirty = false;
+
+ for (const session of liquifySessionsRef.current) {
+ let layerDirty: DirtyRect | null = null;
+ for (let i = 1; i <= numSteps; i++) {
+ const t = i / numSteps;
+ const cx = prev.x + (pt.x - prev.x) * t;
+ const cy = prev.y + (pt.y - prev.y) * t;
+ const px = prev.x + (pt.x - prev.x) * ((i - 1) / numSteps);
+ const py = prev.y + (pt.y - prev.y) * ((i - 1) / numSteps);
+
+ const dirty = applyLiquifyStep({
+ canvas: session.workCanvas,
+ sourceCanvas: session.isTone ? session.sourceCanvas : undefined,
+ cx,
+ cy,
+ prevX: px,
+ prevY: py,
+ settings: liquifySettings,
+ pressure,
+ initialImageData: session.initialImageData,
+ selectionMask: liquifySelectionMaskRef.current,
+ });
+
+ if (dirty) {
+ layerDirty = mergeDirtyRects(layerDirty, dirty);
}
}
+
+ if (layerDirty) {
+ syncLiquifySessionDirty(session, layerDirty);
+ anyDirty = true;
+ }
}
prevLiquifyPointRef.current = pt;
- if (overallDirty) {
- if (activeLayer?.toneEnabled && sourceCanvas && displayCanvas) {
- applyLayerEffects(
- sourceCanvas,
- displayCanvas,
- activeLayer,
- dimensions.dpi ?? 600,
- overallDirty
- );
- } else if (overallDirty.width > 0 && overallDirty.height > 0) {
- const cCtx = get2DContext(canvas);
- if (cCtx) {
- const subData = cCtx.getImageData(
- overallDirty.x,
- overallDirty.y,
- overallDirty.width,
- overallDirty.height
- );
- const isMono =
- colorMode === 'monochrome' || activeLayer?.expressionColor === 'monochrome';
- documentStore
- .getActiveTileGrid()
- .writeImageData(
- targetLayerId,
- subData,
- overallDirty.x,
- overallDirty.y,
- isMono ? 'monochrome-1bit' : 'color-32bit'
- );
- }
- }
+ if (anyDirty) {
documentStore.getActiveTileGrid().notifyChange(true);
- if (!liquifyDirtyRectRef.current) {
- liquifyDirtyRectRef.current = overallDirty;
- } else {
- const cur = liquifyDirtyRectRef.current;
- const minX = Math.min(cur.x, overallDirty.x);
- const minY = Math.min(cur.y, overallDirty.y);
- const maxX = Math.max(cur.x + cur.width, overallDirty.x + overallDirty.width);
- const maxY = Math.max(cur.y + cur.height, overallDirty.y + overallDirty.height);
- liquifyDirtyRectRef.current = {
- x: minX,
- y: minY,
- width: maxX - minX,
- height: maxY - minY,
- };
- }
}
return true;
}
@@ -738,22 +887,20 @@ export function useShapeAndFillTools({
return false;
},
- [
- getCanvasCoords,
- handleSampleColor,
- activeLayerId,
- activeLayer,
- layerSourceCanvasesRef,
- layerCanvasesRef,
- dimensions.dpi,
- colorMode,
- ]
+ [getCanvasCoords, handleSampleColor, syncLiquifySessionDirty]
);
const handleShapeFillPointerUp = useCallback(
(e: React.PointerEvent<HTMLElement>, pt: { x: number; y: number }): boolean => {
- const { tool, primaryColor, fillSettings, frameSettings, liquifySettings } =
- useToolStore.getState();
+ const {
+ tool,
+ primaryColor,
+ secondaryColor,
+ fillSettings,
+ frameSettings,
+ liquifySettings,
+ shapeSettings,
+ } = useToolStore.getState();
if (tool === 'pipette') {
try {
@@ -768,6 +915,105 @@ export function useShapeAndFillTools({
return true;
}
+ if (tool === 'shape') {
+ try {
+ (e.target as HTMLElement).releasePointerCapture(e.pointerId);
+ } catch {
+ // Ignore release errors
+ }
+ const drag = shapeDragRef.current;
+ shapeDragRef.current = null;
+ setShapeDragPreview(null);
+ if (!drag) return true;
+
+ const canvas = getActiveCanvas();
+ if (
+ !canvas ||
+ !activeLayer ||
+ activeLayer.type !== 'raster' ||
+ activeLayer.locked ||
+ !isLayerEffectivelyVisible(activeLayer)
+ ) {
+ return true;
+ }
+
+ const sourceCanvas = layerSourceCanvasesRef.current?.get(activeLayerId);
+ const isTone = Boolean(activeLayer.toneEnabled && sourceCanvas);
+ const workCanvas = isTone && sourceCanvas ? sourceCanvas : canvas;
+ const ctx = get2DContext(workCanvas);
+ if (!ctx) return true;
+
+ const isMono =
+ colorMode === 'monochrome' || activeLayer.expressionColor === 'monochrome';
+ const targetFormat: TileFormat = isMono ? 'monochrome-1bit' : 'color-32bit';
+ const grid = documentStore.getActiveTileGrid();
+ if (
+ !grid.hasLayerTiles(activeLayerId) &&
+ !(workCanvas as unknown as { __isBlank?: boolean }).__isBlank
+ ) {
+ grid.ingestCanvas(activeLayerId, workCanvas, targetFormat);
+ }
+ const beforeSnapshot = grid.snapshotTilesInRect(activeLayerId, {
+ x: 0,
+ y: 0,
+ width: workCanvas.width,
+ height: workCanvas.height,
+ });
+
+ const fillColor = resolveShapeFillColor(shapeSettings, primaryColor, secondaryColor);
+ const finalPreview: ShapeDragPreview = {
+ start: drag.start,
+ end: pt,
+ shiftKey: e.shiftKey || drag.shiftKey,
+ altKey: e.altKey || drag.altKey,
+ settings: shapeSettings,
+ };
+
+ const dirty = rasterizeShapeToCanvas(
+ canvas,
+ finalPreview,
+ primaryColor,
+ fillColor,
+ selection,
+ colorMode,
+ isMono,
+ isTone ? sourceCanvas : null
+ );
+
+ if (dirty && dirty.width > 0 && dirty.height > 0) {
+ (canvas as unknown as { __isBlank?: boolean }).__isBlank = false;
+ if (sourceCanvas) {
+ (sourceCanvas as unknown as { __isBlank?: boolean }).__isBlank = false;
+ }
+ if (isTone && sourceCanvas) {
+ applyLayerEffects(
+ sourceCanvas,
+ canvas,
+ activeLayer,
+ dimensions.dpi ?? 600,
+ dirty
+ );
+ }
+ const subData = ctx.getImageData(dirty.x, dirty.y, dirty.width, dirty.height);
+ grid.writeImageData(activeLayerId, subData, dirty.x, dirty.y, targetFormat);
+ const deltas = grid.computeDeltasFromSnapshot(beforeSnapshot, activeLayerId, dirty);
+ const shapeName =
+ shapeSettings.shape.charAt(0).toUpperCase() + shapeSettings.shape.slice(1);
+ pushHistoryStep(
+ 'shape',
+ `Shape: ${shapeName}`,
+ null,
+ null,
+ activeLayerId,
+ dirty,
+ deltas.length > 0 ? deltas : undefined
+ );
+ grid.notifyChange(true);
+ updateLayerThumbnail(activeLayerId, true);
+ }
+ return true;
+ }
+
if (tool === 'liquify') {
try {
(e.target as HTMLElement).releasePointerCapture(e.pointerId);
@@ -782,36 +1028,50 @@ export function useShapeAndFillTools({
if (isLiquifyingRef.current) {
isLiquifyingRef.current = false;
- const targetLayerId = activeLayerId;
- const isTone = Boolean(
- activeLayer?.toneEnabled && layerSourceCanvasesRef.current?.get(targetLayerId)
- );
- const sourceCanvas = layerSourceCanvasesRef.current?.get(targetLayerId);
- const displayCanvas = layerCanvasesRef.current.get(targetLayerId);
- const canvas = isTone && sourceCanvas ? sourceCanvas : displayCanvas;
-
- if (canvas && liquifyBeforeImageDataRef.current) {
- const ctx = get2DContext(canvas);
- const afterImageData = ctx?.getImageData(0, 0, canvas.width, canvas.height);
- if (afterImageData) {
- const modeLabel =
- liquifySettings.mode.charAt(0).toUpperCase() + liquifySettings.mode.slice(1);
- pushHistoryStep(
- 'liquify',
- `Liquify: ${modeLabel}`,
- liquifyBeforeImageDataRef.current,
- afterImageData,
- targetLayerId
- );
- documentStore.getActiveTileGrid().notifyChange(true);
- updateLayerThumbnail(targetLayerId, true);
+ const sessions = liquifySessionsRef.current;
+ const grid = documentStore.getActiveTileGrid();
+ const allDeltas: TileDelta[] = [];
+ let combinedDirty: DirtyRect | null = null;
+ let modifiedCount = 0;
+ let primaryTargetId = activeLayerId;
+
+ for (const session of sessions) {
+ if (!session.dirtyRect) continue;
+ modifiedCount++;
+ primaryTargetId = session.layerId;
+ combinedDirty = mergeDirtyRects(combinedDirty, session.dirtyRect);
+ const deltas = grid.computeDeltasFromSnapshot(
+ session.beforeTileSnapshot,
+ session.layerId,
+ session.dirtyRect
+ );
+ for (const d of deltas) {
+ allDeltas.push(d);
}
+ updateLayerThumbnail(session.layerId, true);
+ }
+
+ if (allDeltas.length > 0) {
+ const modeLabel =
+ liquifySettings.mode.charAt(0).toUpperCase() + liquifySettings.mode.slice(1);
+ const stepLabel =
+ modifiedCount > 1
+ ? `Liquify (${modifiedCount} layers): ${modeLabel}`
+ : `Liquify: ${modeLabel}`;
+ pushHistoryStep(
+ 'liquify',
+ stepLabel,
+ null,
+ null,
+ primaryTargetId,
+ combinedDirty ?? undefined,
+ allDeltas
+ );
+ grid.notifyChange(true);
}
- liquifyBeforeImageDataRef.current = null;
- liquifyInitialImageDataRef.current = null;
+ liquifySessionsRef.current = [];
liquifySelectionMaskRef.current = null;
- liquifyDirtyRectRef.current = null;
prevLiquifyPointRef.current = null;
liquifyLastPointerPosRef.current = null;
}
@@ -941,6 +1201,8 @@ export function useShapeAndFillTools({
updateLayerThumbnail,
getActiveCanvas,
dimensions.dpi,
+ selection,
+ colorMode,
createFrameFolder,
divideFrameFolder,
showToast,
@@ -953,6 +1215,7 @@ export function useShapeAndFillTools({
activeBalloon,
setActiveBalloon,
frameDragPreview,
+ shapeDragPreview,
openLayerForEditing,
isPipetteSamplingRef,
handleSampleColor,
diff --git a/src/hooks/useCanvasNavigation.ts b/src/hooks/useCanvasNavigation.ts
index bb2d382..27f1fc8 100644
--- a/src/hooks/useCanvasNavigation.ts
+++ b/src/hooks/useCanvasNavigation.ts
@@ -69,6 +69,43 @@ export const ZOOM_PRESETS = [
export const ROTATE_CURSOR_SVG = `data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32" fill="none"><path d="M16 5 A11 11 0 0 1 27 16 A11 11 0 0 1 24.5 22.5" stroke="%23ffffff" stroke-width="3.5" stroke-linecap="round"/><path d="M16 5 A11 11 0 0 1 27 16 A11 11 0 0 1 24.5 22.5" stroke="%231a1a1a" stroke-width="2" stroke-linecap="round"/><polygon points="25.5,18 28.5,24 22,24" fill="%231a1a1a" stroke="%23ffffff" stroke-width="1.5"/><path d="M16 27 A11 11 0 0 1 5 16 A11 11 0 0 1 7.5 9.5" stroke="%23ffffff" stroke-width="3.5" stroke-linecap="round"/><path d="M16 27 A11 11 0 0 1 5 16 A11 11 0 0 1 7.5 9.5" stroke="%231a1a1a" stroke-width="2" stroke-linecap="round"/><polygon points="6.5,14 3.5,8 10,8" fill="%231a1a1a" stroke="%23ffffff" stroke-width="1.5"/><circle cx="16" cy="16" r="2" fill="%231a1a1a" stroke="%23ffffff" stroke-width="1.5"/></svg>`;
export const ROTATE_CURSOR_CSS = `url('${ROTATE_CURSOR_SVG}') 16 16, crosshair`;
+export const ROTATION_CENTER_DAMP_RADIUS = 64;
+
+/**
+ * Computes a continuous, branch-cut-free signed angular delta (degrees) between two
+ * pointer positions around a pivot, with smooth radial damping near the pivot center
+ * to eliminate atan2 singularity jumps.
+ */
+export function computeSmoothRotationDelta(
+ prevX: number,
+ prevY: number,
+ curX: number,
+ curY: number,
+ centerX: number,
+ centerY: number
+): number {
+ const v1x = prevX - centerX;
+ const v1y = prevY - centerY;
+ const v2x = curX - centerX;
+ const v2y = curY - centerY;
+
+ const r1 = Math.hypot(v1x, v1y);
+ const r2 = Math.hypot(v2x, v2y);
+ if (r1 < 1e-4 || r2 < 1e-4) return 0;
+
+ const cross = v1x * v2y - v1y * v2x;
+ const dot = v1x * v2x + v1y * v2y;
+ const rawDeg = Math.atan2(cross, dot) * (180 / Math.PI);
+
+ const minR = Math.min(r1, r2);
+ if (minR >= ROTATION_CENTER_DAMP_RADIUS) {
+ return rawDeg;
+ }
+ const t = Math.max(0, Math.min(1, minR / ROTATION_CENTER_DAMP_RADIUS));
+ const smoothGain = t * t * (3 - 2 * t);
+ return rawDeg * smoothGain;
+}
+
export function formatZoomPercent(zoom: number): string {
const safeZoom = Number.isFinite(zoom) ? zoom : 1.0;
const percent = safeZoom * 100;
@@ -264,17 +301,19 @@ export function useCanvasNavigation({
});
const rotateStartRef = useRef<{
- initialPointerAngle: number;
- lastPointerAngle: number;
+ lastX: number;
+ lastY: number;
startCanvasRotation: number;
totalAngleDelta: number;
+ targetRotation: number;
startPan: { x: number; y: number };
center: { x: number; y: number };
}>({
- initialPointerAngle: 0,
- lastPointerAngle: 0,
+ lastX: 0,
+ lastY: 0,
startCanvasRotation: 0,
totalAngleDelta: 0,
+ targetRotation: 0,
startPan: { x: 0, y: 0 },
center: { x: 0, y: 0 },
});
@@ -637,13 +676,13 @@ export function useCanvasNavigation({
const px = e.clientX - rect.left;
const py = e.clientY - rect.top;
- const initialAngle = Math.atan2(py - vc.y, px - vc.x) * (180 / Math.PI);
rotateStartRef.current = {
- initialPointerAngle: initialAngle,
- lastPointerAngle: initialAngle,
+ lastX: px,
+ lastY: py,
startCanvasRotation: rotationRef.current,
totalAngleDelta: 0,
+ targetRotation: rotationRef.current,
startPan: { ...panRef.current },
center: vc,
};
@@ -919,13 +958,61 @@ export function useCanvasNavigation({
};
}, [isPanning, scheduleCameraBroadcast, broadcastCameraImmediate, commitNavStateImmediate]);
- // Rotating pointermove: broadcasts directly to DOM/WebGL via rAF; commits React state only on pointerup
+ // Rotating pointermove: damped radial delta + frame-rate-independent rAF smoothing across all angles
useEffect(() => {
if (!isRotating) return;
let cachedRect: DOMRect | null = viewportRef.current
? viewportRef.current.getBoundingClientRect()
: null;
+ let smoothRafId: number | null = null;
+ let lastFrameTs = performance.now();
+
+ const applyRotationToCamera = (angleDeg: number) => {
+ const { center: vc, startCanvasRotation, startPan } = rotateStartRef.current;
+ rotationRef.current = angleDeg;
+ const dRad = ((angleDeg - startCanvasRotation) * Math.PI) / 180;
+ const cos = Math.cos(dRad);
+ const sin = Math.sin(dRad);
+ const rx = startPan.x - vc.x;
+ const ry = startPan.y - vc.y;
+ panRef.current = {
+ x: vc.x + rx * cos - ry * sin,
+ y: vc.y + rx * sin + ry * cos,
+ };
+ };
+
+ const stepSmoothRotation = (now: number) => {
+ smoothRafId = null;
+ if (!isRotatingRef.current) return;
+
+ const dt = Math.min(0.05, Math.max(0.001, (now - lastFrameTs) / 1000));
+ lastFrameTs = now;
+
+ const target = rotateStartRef.current.targetRotation;
+ const current = rotationRef.current;
+ const diff = target - current;
+
+ if (Math.abs(diff) < 0.01) {
+ if (current !== target) {
+ applyRotationToCamera(target);
+ emitCameraToSubscribers();
+ }
+ return;
+ }
+
+ const alpha = 1 - Math.exp(-dt * 28);
+ applyRotationToCamera(current + diff * alpha);
+ emitCameraToSubscribers();
+ smoothRafId = requestAnimationFrame(stepSmoothRotation);
+ };
+
+ const ensureSmoothLoop = () => {
+ if (smoothRafId === null) {
+ lastFrameTs = performance.now();
+ smoothRafId = requestAnimationFrame(stepSmoothRotation);
+ }
+ };
const handleWindowPointerMove = (e: PointerEvent) => {
if (!isRotatingRef.current) return;
@@ -937,40 +1024,37 @@ export function useCanvasNavigation({
const px = e.clientX - cachedRect.left;
const py = e.clientY - cachedRect.top;
- const curAngle = Math.atan2(py - vc.y, px - vc.x) * (180 / Math.PI);
- let diff = curAngle - rotateStartRef.current.lastPointerAngle;
- if (diff > 180) diff -= 360;
- if (diff < -180) diff += 360;
-
- rotateStartRef.current.lastPointerAngle = curAngle;
+ const diff = computeSmoothRotationDelta(
+ rotateStartRef.current.lastX,
+ rotateStartRef.current.lastY,
+ px,
+ py,
+ vc.x,
+ vc.y
+ );
+
+ rotateStartRef.current.lastX = px;
+ rotateStartRef.current.lastY = py;
rotateStartRef.current.totalAngleDelta += diff;
- let newRotation =
+ let nextTarget =
rotateStartRef.current.startCanvasRotation + rotateStartRef.current.totalAngleDelta;
if (e.altKey || e.ctrlKey) {
- newRotation = Math.round(newRotation / 15) * 15;
- } else {
- const nearestCardinal = Math.round(newRotation / 90) * 90;
- if (Math.abs(newRotation - nearestCardinal) <= 2.5) {
- newRotation = nearestCardinal;
- }
+ nextTarget = Math.round(nextTarget / 15) * 15;
}
- rotationRef.current = newRotation;
-
- const dRad = ((newRotation - rotateStartRef.current.startCanvasRotation) * Math.PI) / 180;
- const rx = rotateStartRef.current.startPan.x - vc.x;
- const ry = rotateStartRef.current.startPan.y - vc.y;
- panRef.current = {
- x: vc.x + rx * Math.cos(dRad) - ry * Math.sin(dRad),
- y: vc.y + rx * Math.sin(dRad) + ry * Math.cos(dRad),
- };
- scheduleCameraBroadcast();
+ rotateStartRef.current.targetRotation = nextTarget;
+ ensureSmoothLoop();
};
const handleWindowPointerUp = () => {
+ if (smoothRafId !== null) {
+ cancelAnimationFrame(smoothRafId);
+ smoothRafId = null;
+ }
isRotatingRef.current = false;
+ applyRotationToCamera(rotateStartRef.current.targetRotation);
broadcastCameraImmediate();
setIsRotating(false);
commitNavStateImmediate();
@@ -982,17 +1066,20 @@ export function useCanvasNavigation({
const prevCursor = document.body.style.cursor;
const prevUserSelect = document.body.style.userSelect;
- document.body.style.cursor = 'crosshair';
+ document.body.style.cursor = ROTATE_CURSOR_CSS;
document.body.style.userSelect = 'none';
return () => {
+ if (smoothRafId !== null) {
+ cancelAnimationFrame(smoothRafId);
+ }
window.removeEventListener('pointermove', handleWindowPointerMove);
window.removeEventListener('pointerup', handleWindowPointerUp);
window.removeEventListener('pointercancel', handleWindowPointerUp);
document.body.style.cursor = prevCursor;
document.body.style.userSelect = prevUserSelect;
};
- }, [isRotating, scheduleCameraBroadcast, broadcastCameraImmediate, commitNavStateImmediate]);
+ }, [isRotating, emitCameraToSubscribers, broadcastCameraImmediate, commitNavStateImmediate]);
// Scrubby Zoom pointermove (default Ctrl+Space+Drag): zero-rerender via rAF camera broadcast
useEffect(() => {
diff --git a/src/services/multiplayerService.ts b/src/services/multiplayerService.ts
index 76004eb..d414bfb 100644
--- a/src/services/multiplayerService.ts
+++ b/src/services/multiplayerService.ts
@@ -386,6 +386,7 @@ class MultiplayerService {
'balloon',
'vector-edit',
'liquify',
+ 'shape',
];
switch (code) {
@@ -780,6 +781,7 @@ class MultiplayerService {
'balloon',
'vector-edit',
'liquify',
+ 'shape',
];
const toolIdx = Math.max(0, TOOL_TYPES_LIST.indexOf(this.pendingCursor.tool));
view.setFloat32(offset, this.pendingCursor.x, true);
diff --git a/src/stores/useToolStore.ts b/src/stores/useToolStore.ts
index 219f56e..a7944f1 100644
--- a/src/stores/useToolStore.ts
+++ b/src/stores/useToolStore.ts
@@ -10,7 +10,9 @@ import {
BalloonSettings,
VectorEditSettings,
LiquifySettings,
+ ShapeSettings,
} from '../types/editor';
+import { DEFAULT_SHAPE_SETTINGS } from '../utils/shapeEngine';
import {
saveBrushSettingsDebounced,
getEffectiveBrushSettings,
@@ -48,6 +50,7 @@ export interface ToolStoreState {
balloonSettings: BalloonSettings;
vectorEditSettings: VectorEditSettings;
liquifySettings: LiquifySettings;
+ shapeSettings: ShapeSettings;
}
const DEFAULT_RECENT_COLORS = [
@@ -85,21 +88,35 @@ function createInitialBrushSettings(): { presetId: BrushPresetId; brushSettings:
}
function loadInitialLiquifySettings(): LiquifySettings {
+ const defaults: LiquifySettings = {
+ mode: 'push',
+ size: 80,
+ strength: 50,
+ hardness: 50,
+ usePressure: true,
+ multiLayer: false,
+ };
try {
if (typeof localStorage !== 'undefined') {
const saved = localStorage.getItem('sora_paint_liquify_settings');
- if (saved) return JSON.parse(saved) as LiquifySettings;
+ if (saved) return { ...defaults, ...(JSON.parse(saved) as Partial<LiquifySettings>) };
}
} catch {
// Ignore storage errors
}
- return {
- mode: 'push',
- size: 80,
- strength: 50,
- hardness: 50,
- usePressure: true,
- };
+ return defaults;
+}
+
+function loadInitialShapeSettings(): ShapeSettings {
+ try {
+ if (typeof localStorage !== 'undefined') {
+ const saved = localStorage.getItem('sora_paint_shape_settings');
+ if (saved) return { ...DEFAULT_SHAPE_SETTINGS, ...(JSON.parse(saved) as Partial<ShapeSettings>) };
+ }
+ } catch {
+ // Ignore storage errors
+ }
+ return { ...DEFAULT_SHAPE_SETTINGS };
}
const createInitialToolState = (): ToolStoreState => {
@@ -170,6 +187,7 @@ const createInitialToolState = (): ToolStoreState => {
simplifyTolerance: 2.0,
},
liquifySettings: loadInitialLiquifySettings(),
+ shapeSettings: loadInitialShapeSettings(),
};
};
@@ -514,4 +532,12 @@ export const toolStoreActions = {
return { liquifySettings: next };
});
},
+
+ updateShapeSettings(patch: Partial<ShapeSettings>): void {
+ useToolStore.setState((prev) => {
+ const next = { ...prev.shapeSettings, ...patch };
+ safeLocalStorageSetItem('sora_paint_shape_settings', JSON.stringify(next), 'shape settings');
+ return { shapeSettings: next };
+ });
+ },
};
diff --git a/src/types/editor.ts b/src/types/editor.ts
index ccb1510..7fbee84 100644
--- a/src/types/editor.ts
+++ b/src/types/editor.ts
@@ -1,5 +1,12 @@
import { PerspectiveRuler } from './perspective';
import type { SparseTileGrid } from '../utils/tileEngine';
+export type {
+ ShapeKind,
+ ShapeDrawMode,
+ ShapeFillColorMode,
+ ShapeSettings,
+ ShapeDragPreview,
+} from '../utils/shapeEngine';
export type ToolType =
| 'brush'
@@ -12,6 +19,7 @@ export type ToolType =
| 'select-pen'
| 'select-eraser'
| 'fill'
+ | 'shape'
| 'text'
| 'frame'
| 'balloon'
@@ -367,6 +375,7 @@ export type HistoryActionType =
| 'clear'
| 'transform'
| 'fill'
+ | 'shape'
| 'text'
| 'balloon'
| 'frame'
@@ -396,6 +405,7 @@ export interface LiquifySettings {
strength: number;
hardness: number;
usePressure: boolean;
+ multiLayer?: boolean;
}
export type FillMethod = 'refer-all' | 'refer-active' | 'refer-reference' | 'lasso';
diff --git a/src/types/settings.ts b/src/types/settings.ts
index dc25148..f2cf278 100644
--- a/src/types/settings.ts
+++ b/src/types/settings.ts
@@ -21,7 +21,7 @@ export interface ResizeCanvasOptions {
backgroundColor?: string;
}
-export type ThemePreset = 'vintage-manga' | 'modern';
+export type ThemePreset = 'modern';
export type ModernAccentColor = 'neutral' | 'blue' | 'burgundy' | 'green' | 'purple' | 'orange' | 'custom';
@@ -384,7 +384,7 @@ export function loadAppSettings(): AppSettings {
const legacyName = localStorage.getItem('sora_paint_nickname') || '';
if (raw) {
const parsed = JSON.parse(raw);
- const validTheme: ThemePreset = parsed.themePreset === 'vintage-manga' ? 'vintage-manga' : 'modern';
+ const validTheme: ThemePreset = 'modern';
const validAccent: ModernAccentColor = [
'neutral',
'blue',
diff --git a/src/utils/__tests__/multiLayerLiquify.test.ts b/src/utils/__tests__/multiLayerLiquify.test.ts
new file mode 100644
index 0000000..3fc17ad
--- /dev/null
+++ b/src/utils/__tests__/multiLayerLiquify.test.ts
@@ -0,0 +1,81 @@
+import { describe, it, expect } from 'vitest';
+import { LayerItem } from '../../types/editor';
+import { resolveLiquifyTargetLayers } from '../liquifyEngine';
+
+function makeLayer(overrides: Partial<LayerItem> & { id: string }): LayerItem {
+ return {
+ name: overrides.id,
+ type: 'raster',
+ visible: true,
+ opacity: 1,
+ blendMode: 'normal',
+ locked: false,
+ parentId: null,
+ ...overrides,
+ };
+}
+
+describe('Multi-layer Liquify target resolution', () => {
+ const folder = makeLayer({ id: 'folder-1', type: 'folder' });
+ const lockedFolder = makeLayer({ id: 'folder-locked', type: 'folder', locked: true });
+ const l1 = makeLayer({ id: 'layer-1', parentId: 'folder-1' });
+ const l2 = makeLayer({ id: 'layer-2', parentId: 'folder-1' });
+ const l3 = makeLayer({ id: 'layer-3' });
+ const lHidden = makeLayer({ id: 'layer-hidden', visible: false });
+ const lLocked = makeLayer({ id: 'layer-locked', locked: true });
+ const lInLockedFolder = makeLayer({ id: 'layer-in-locked', parentId: 'folder-locked' });
+ const lBg = makeLayer({ id: 'layer-bg', locked: true });
+ const lText = makeLayer({ id: 'layer-text', type: 'text' });
+
+ const allLayers = [
+ folder,
+ l1,
+ l2,
+ lockedFolder,
+ lInLockedFolder,
+ l3,
+ lHidden,
+ lLocked,
+ lText,
+ lBg,
+ ];
+ const isVisible = (l: LayerItem) => l.visible;
+
+ it('targets only the active layer when multiLayer is false', () => {
+ const res = resolveLiquifyTargetLayers(allLayers, l1, ['layer-1', 'layer-2'], isVisible, false);
+ expect(res.map((l) => l.id)).toEqual(['layer-1']);
+
+ const lockedRes = resolveLiquifyTargetLayers(allLayers, lLocked, [], isVisible, false);
+ expect(lockedRes).toEqual([]);
+ });
+
+ it('targets all visible unlocked raster layers when multiLayer is true and single layer is active', () => {
+ const res = resolveLiquifyTargetLayers(allLayers, l1, ['layer-1'], isVisible, true);
+ expect(res.map((l) => l.id)).toEqual(['layer-1', 'layer-2', 'layer-3']);
+ });
+
+ it('targets only visible unlocked descendants when active layer is a folder in multi-layer mode', () => {
+ const res = resolveLiquifyTargetLayers(allLayers, folder, ['folder-1'], isVisible, true);
+ expect(res.map((l) => l.id)).toEqual(['layer-1', 'layer-2']);
+ });
+
+ it('targets explicitly multi-selected layers (expanding selected folders) in multi-layer mode', () => {
+ const res = resolveLiquifyTargetLayers(
+ allLayers,
+ l1,
+ ['layer-1', 'layer-3', 'layer-locked'],
+ isVisible,
+ true
+ );
+ expect(res.map((l) => l.id)).toEqual(['layer-1', 'layer-3']);
+
+ const folderMulti = resolveLiquifyTargetLayers(
+ allLayers,
+ folder,
+ ['folder-1', 'layer-3'],
+ isVisible,
+ true
+ );
+ expect(folderMulti.map((l) => l.id)).toEqual(['layer-1', 'layer-2', 'layer-3']);
+ });
+});
diff --git a/src/utils/__tests__/navigation.test.ts b/src/utils/__tests__/navigation.test.ts
index d207229..9227431 100644
--- a/src/utils/__tests__/navigation.test.ts
+++ b/src/utils/__tests__/navigation.test.ts
@@ -6,6 +6,7 @@ import {
ZOOM_PRESETS,
formatZoomPercent,
VIEWPORT_FIT_PADDING,
+ computeSmoothRotationDelta,
} from '../../hooks/useCanvasNavigation';
function createMockViewport(width: number, height: number): HTMLDivElement {
@@ -71,4 +72,22 @@ describe('Canvas Navigation & Adaptive Zoom Engine', () => {
expect(calculateAdaptiveZoom({ width: 0, height: 0 }, viewport)).toBe(1.0);
expect(calculateAdaptiveZoom({ width: 1000, height: 1000 }, null)).toBe(1.0);
});
+
+ it('computes continuous rotation deltas across 180-deg boundary and damps center singularities', () => {
+ // Crossing the -180/+180 branch cut at radius 150px
+ const cx = 500;
+ const cy = 400;
+ const d1 = computeSmoothRotationDelta(cx - 150, cy - 10, cx - 150, cy + 10, cx, cy);
+ expect(d1).toBeLessThan(0);
+ expect(Math.abs(d1)).toBeCloseTo(7.628, 2);
+
+ // Exact 90 deg rotation outside damping radius
+ const d90 = computeSmoothRotationDelta(cx + 120, cy, cx, cy + 120, cx, cy);
+ expect(d90).toBeCloseTo(90, 4);
+
+ // Near center (r=10px), delta is smoothly damped instead of snapping wildly
+ const dNearCenter = computeSmoothRotationDelta(cx + 10, cy, cx, cy + 10, cx, cy);
+ expect(dNearCenter).toBeGreaterThan(0);
+ expect(dNearCenter).toBeLessThan(10);
+ });
});
diff --git a/src/utils/__tests__/settings.test.ts b/src/utils/__tests__/settings.test.ts
index 4e82615..b68dd21 100644
--- a/src/utils/__tests__/settings.test.ts
+++ b/src/utils/__tests__/settings.test.ts
@@ -35,7 +35,7 @@ describe('settings theme & accent system', () => {
expect(resolveModernAccentColor(settings.modernAccent)).toBe(DEFAULT_ACCENT_HEX);
});
- it('correctly loads and persists modern theme with presets', () => {
+ it('correctly loads and persists modern theme with presets and coerces legacy vintage-manga', () => {
saveAppSettings({
...DEFAULT_APP_SETTINGS,
themePreset: 'modern',
@@ -45,6 +45,12 @@ describe('settings theme & accent system', () => {
const loaded = loadAppSettings();
expect(loaded.themePreset).toBe('modern');
expect(loaded.modernAccent).toBe('burgundy');
+
+ localStorage.setItem(
+ 'ink_studio_app_settings',
+ JSON.stringify({ themePreset: 'vintage-manga', modernAccent: 'blue' })
+ );
+ expect(loadAppSettings().themePreset).toBe('modern');
});
it('correctly resolves preset accent hex codes', () => {
diff --git a/src/utils/__tests__/shapeEngine.test.ts b/src/utils/__tests__/shapeEngine.test.ts
new file mode 100644
index 0000000..406879f
--- /dev/null
+++ b/src/utils/__tests__/shapeEngine.test.ts
@@ -0,0 +1,171 @@
+import { describe, it, expect, vi } from 'vitest';
+import {
+ DEFAULT_SHAPE_SETTINGS,
+ ShapeSettings,
+ computeShapeGeometry,
+ buildPolygonVertices,
+ buildStarVertices,
+ buildShapeSvgPaths,
+ resolveShapeFillColor,
+ drawShapeToContext,
+} from '../shapeEngine';
+
+describe('shapeEngine', () => {
+ it('computes unconstrained and Shift-constrained rectangle / square geometry', () => {
+ const base: ShapeSettings = { ...DEFAULT_SHAPE_SETTINGS, shape: 'rectangle' };
+ const rect = computeShapeGeometry({ x: 10, y: 20 }, { x: 110, y: 70 }, base, false, false);
+ expect(rect.x).toBe(10);
+ expect(rect.y).toBe(20);
+ expect(rect.width).toBe(100);
+ expect(rect.height).toBe(50);
+
+ const square = computeShapeGeometry({ x: 10, y: 20 }, { x: 110, y: 70 }, base, true, false);
+ expect(square.width).toBe(100);
+ expect(square.height).toBe(100);
+ });
+
+ it('supports Alt (from-center) symmetry for closed shapes', () => {
+ const base: ShapeSettings = { ...DEFAULT_SHAPE_SETTINGS, shape: 'ellipse' };
+ const centered = computeShapeGeometry({ x: 100, y: 100 }, { x: 140, y: 120 }, base, false, true);
+ expect(centered.x).toBe(60);
+ expect(centered.y).toBe(80);
+ expect(centered.width).toBe(80);
+ expect(centered.height).toBe(40);
+ });
+
+ it('snaps line angles to 15-degree increments when Shift is held', () => {
+ const lineSettings: ShapeSettings = { ...DEFAULT_SHAPE_SETTINGS, shape: 'line' };
+ // ~42 deg should snap to 45 deg
+ const snapped = computeShapeGeometry({ x: 0, y: 0 }, { x: 100, y: 90 }, lineSettings, true, false);
+ expect(snapped.angleDeg).toBeCloseTo(45, 3);
+ expect(snapped.x2).toBeCloseTo(snapped.y2, 3);
+ });
+
+ it('builds valid polygon and star vertices', () => {
+ const hex = buildPolygonVertices(0, 0, 100, 100, 6);
+ expect(hex).toHaveLength(6);
+ expect(hex[0].x).toBeCloseTo(50, 4);
+ expect(hex[0].y).toBeCloseTo(0, 4);
+
+ const star = buildStarVertices(0, 0, 100, 100, 5, 0.5);
+ expect(star).toHaveLength(10);
+ });
+
+ it('generates SVG preview paths for all supported geometric shapes', () => {
+ const kinds = [
+ 'line',
+ 'arrow',
+ 'rectangle',
+ 'rounded-rect',
+ 'ellipse',
+ 'triangle',
+ 'polygon',
+ 'star',
+ ] as const;
+
+ for (const shape of kinds) {
+ const res = buildShapeSvgPaths({
+ start: { x: 10, y: 10 },
+ end: { x: 110, y: 90 },
+ shiftKey: false,
+ altKey: false,
+ settings: { ...DEFAULT_SHAPE_SETTINGS, shape },
+ });
+ expect(res.mainPath.length).toBeGreaterThan(5);
+ if (shape === 'arrow') {
+ expect(res.arrowHeadPath).toBeTruthy();
+ }
+ }
+ });
+
+ it('resolves fill color modes accurately', () => {
+ expect(
+ resolveShapeFillColor({ ...DEFAULT_SHAPE_SETTINGS, fillColorMode: 'primary' }, '#111111', '#eeeeee')
+ ).toBe('#111111');
+ expect(
+ resolveShapeFillColor({ ...DEFAULT_SHAPE_SETTINGS, fillColorMode: 'secondary' }, '#111111', '#eeeeee')
+ ).toBe('#eeeeee');
+ expect(
+ resolveShapeFillColor(
+ { ...DEFAULT_SHAPE_SETTINGS, fillColorMode: 'custom', customFillColor: '#ff0055' },
+ '#111111',
+ '#eeeeee'
+ )
+ ).toBe('#ff0055');
+ });
+
+ it('applies dashed line patterns and fill/stroke modes on CanvasRenderingContext2D', () => {
+ const setLineDash = vi.fn();
+ const stroke = vi.fn();
+ const fill = vi.fn();
+ const ctx = {
+ save: vi.fn(),
+ restore: vi.fn(),
+ beginPath: vi.fn(),
+ moveTo: vi.fn(),
+ lineTo: vi.fn(),
+ closePath: vi.fn(),
+ rect: vi.fn(),
+ ellipse: vi.fn(),
+ quadraticCurveTo: vi.fn(),
+ setLineDash,
+ stroke,
+ fill,
+ globalAlpha: 1,
+ lineWidth: 1,
+ lineCap: 'round',
+ lineJoin: 'miter',
+ strokeStyle: '',
+ fillStyle: '',
+ } as unknown as CanvasRenderingContext2D;
+
+ drawShapeToContext(
+ ctx,
+ {
+ start: { x: 0, y: 0 },
+ end: { x: 80, y: 40 },
+ shiftKey: false,
+ altKey: false,
+ settings: {
+ ...DEFAULT_SHAPE_SETTINGS,
+ shape: 'line',
+ dashed: true,
+ dashLength: 12,
+ dashGap: 6,
+ },
+ },
+ '#000000',
+ '#ffffff'
+ );
+
+ expect(setLineDash).toHaveBeenCalledWith([12, 6]);
+ expect(stroke).toHaveBeenCalledTimes(1);
+ expect(fill).not.toHaveBeenCalled();
+
+ setLineDash.mockClear();
+ stroke.mockClear();
+ fill.mockClear();
+
+ drawShapeToContext(
+ ctx,
+ {
+ start: { x: 0, y: 0 },
+ end: { x: 80, y: 80 },
+ shiftKey: false,
+ altKey: false,
+ settings: {
+ ...DEFAULT_SHAPE_SETTINGS,
+ shape: 'triangle',
+ mode: 'both',
+ dashed: false,
+ },
+ },
+ '#000000',
+ '#ff0000'
+ );
+
+ expect(setLineDash).toHaveBeenCalledWith([]);
+ expect(fill).toHaveBeenCalledTimes(1);
+ expect(stroke).toHaveBeenCalledTimes(1);
+ });
+});
diff --git a/src/utils/__tests__/workspaceDock.test.tsx b/src/utils/__tests__/workspaceDock.test.tsx
index 25817d8..f36eb33 100644
--- a/src/utils/__tests__/workspaceDock.test.tsx
+++ b/src/utils/__tests__/workspaceDock.test.tsx
@@ -389,7 +389,7 @@ describe('Activated Components (BrushSizePalette, StatusBar, DocumentTabBar) in
dom.cleanup();
});
- it('renders BrushSizePalette, StatusBar (live pointer-stat + rotation reset), and DocumentTabBar (dirty *) in modern and vintage-manga themes', () => {
+ it('renders BrushSizePalette, StatusBar (live pointer-stat + rotation reset), and DocumentTabBar (dirty *) in modern theme', () => {
const onSelectSize = vi.fn();
const onResetRotation = vi.fn();
const onCloseDocument = vi.fn();
@@ -428,7 +428,7 @@ describe('Activated Components (BrushSizePalette, StatusBar, DocumentTabBar) in
},
];
- for (const theme of ['modern', 'vintage-manga'] as const) {
+ for (const theme of ['modern'] as const) {
act(() => {
if (!root) root = createRoot(dom.container as unknown as Element);
root.render(
diff --git a/src/utils/liquifyEngine.ts b/src/utils/liquifyEngine.ts
index 99cf1b9..7ab1f93 100644
--- a/src/utils/liquifyEngine.ts
+++ b/src/utils/liquifyEngine.ts
@@ -1,4 +1,4 @@
-import { CanvasSelection } from '../types/editor';
+import { CanvasSelection, LayerItem, isFolderLikeLayer } from '../types/editor';
export type LiquifyMode =
| 'push'
@@ -16,6 +16,7 @@ export interface LiquifySettings {
strength: number; // 1 to 100
hardness: number; // 0 to 100
usePressure: boolean;
+ multiLayer?: boolean;
}
export interface DirtyRect {
@@ -572,3 +573,83 @@ export function createLiquifySelectionMask(
return null;
}
+
+function isLayerOrAncestorLocked(layer: LayerItem, layerMap: Map<string, LayerItem>): boolean {
+ let current: LayerItem | undefined = layer;
+ let guard = 0;
+ while (current && guard < 32) {
+ if (current.locked) return true;
+ if (!current.parentId) break;
+ current = layerMap.get(current.parentId);
+ guard++;
+ }
+ return false;
+}
+
+function isDescendantOfAny(
+ layer: LayerItem,
+ ancestorIds: Set<string>,
+ layerMap: Map<string, LayerItem>
+): boolean {
+ let parentId: string | null | undefined = layer.parentId;
+ let guard = 0;
+ while (parentId && guard < 32) {
+ if (ancestorIds.has(parentId)) return true;
+ parentId = layerMap.get(parentId)?.parentId;
+ guard++;
+ }
+ return false;
+}
+
+/**
+ * Resolves the raster layers targeted by a Liquify stroke.
+ * - Single-layer mode: active layer only (if visible, unlocked raster).
+ * - Multi-layer mode:
+ * - If 2+ layers are explicitly selected: all visible, unlocked raster layers in that selection
+ * (expanding any selected folders to their descendants).
+ * - Else if activeLayer is a folder/frame-folder: all visible, unlocked raster descendants.
+ * - Else: all visible, unlocked raster layers in the document.
+ */
+export function resolveLiquifyTargetLayers(
+ layers: LayerItem[],
+ activeLayer: LayerItem | undefined,
+ selectedLayerIds: string[],
+ isLayerEffectivelyVisible: (layer: LayerItem) => boolean,
+ multiLayer: boolean
+): LayerItem[] {
+ const layerMap = new Map<string, LayerItem>();
+ for (const l of layers) {
+ layerMap.set(l.id, l);
+ }
+
+ const isEditableRaster = (l: LayerItem): boolean =>
+ l.type === 'raster' &&
+ isLayerEffectivelyVisible(l) &&
+ !isLayerOrAncestorLocked(l, layerMap);
+
+ if (!multiLayer) {
+ return activeLayer && isEditableRaster(activeLayer) ? [activeLayer] : [];
+ }
+
+ if (selectedLayerIds.length > 1) {
+ const selectedSet = new Set(selectedLayerIds);
+ const selectedFolders = new Set(
+ layers.filter((l) => selectedSet.has(l.id) && isFolderLikeLayer(l)).map((l) => l.id)
+ );
+ return layers.filter(
+ (l) =>
+ isEditableRaster(l) &&
+ (selectedSet.has(l.id) ||
+ (selectedFolders.size > 0 && isDescendantOfAny(l, selectedFolders, layerMap)))
+ );
+ }
+
+ if (activeLayer && isFolderLikeLayer(activeLayer)) {
+ const folderSet = new Set([activeLayer.id]);
+ return layers.filter(
+ (l) => isEditableRaster(l) && isDescendantOfAny(l, folderSet, layerMap)
+ );
+ }
+
+ return layers.filter(isEditableRaster);
+}
diff --git a/src/utils/shapeEngine.ts b/src/utils/shapeEngine.ts
new file mode 100644
index 0000000..9388917
--- /dev/null
+++ b/src/utils/shapeEngine.ts
@@ -0,0 +1,530 @@
+import { CanvasColorMode, CanvasSelection, DirtyRect } from '../types/editor';
+import { createSelectionMask } from './tonalEngine';
+
+export type ShapeKind =
+ | 'line'
+ | 'rectangle'
+ | 'rounded-rect'
+ | 'ellipse'
+ | 'triangle'
+ | 'polygon'
+ | 'star'
+ | 'arrow';
+
+export type ShapeDrawMode = 'stroke' | 'fill' | 'both';
+export type ShapeFillColorMode = 'primary' | 'secondary' | 'custom';
+
+export interface ShapeSettings {
+ shape: ShapeKind;
+ mode: ShapeDrawMode;
+ strokeWidth: number;
+ opacity: number;
+ fillColorMode: ShapeFillColorMode;
+ customFillColor: string;
+ dashed: boolean;
+ dashLength: number;
+ dashGap: number;
+ lineCap: 'round' | 'butt' | 'square';
+ lineJoin: 'miter' | 'round' | 'bevel';
+ cornerRadius: number;
+ polygonSides: number;
+ starInnerRatio: number;
+ antiAlias: boolean;
+ fromCenter: boolean;
+ constrainAspect: boolean;
+}
+
+export interface ShapeDragPreview {
+ start: { x: number; y: number };
+ end: { x: number; y: number };
+ shiftKey: boolean;
+ altKey: boolean;
+ settings: ShapeSettings;
+}
+
+export interface ComputedShapeGeometry {
+ x1: number;
+ y1: number;
+ x2: number;
+ y2: number;
+ x: number;
+ y: number;
+ width: number;
+ height: number;
+ length: number;
+ angleDeg: number;
+}
+
+export const DEFAULT_SHAPE_SETTINGS: ShapeSettings = {
+ shape: 'rectangle',
+ mode: 'stroke',
+ strokeWidth: 4,
+ opacity: 1,
+ fillColorMode: 'secondary',
+ customFillColor: '#ffffff',
+ dashed: false,
+ dashLength: 14,
+ dashGap: 8,
+ lineCap: 'round',
+ lineJoin: 'miter',
+ cornerRadius: 16,
+ polygonSides: 6,
+ starInnerRatio: 0.45,
+ antiAlias: true,
+ fromCenter: false,
+ constrainAspect: false,
+};
+
+export function isOpenShape(shape: ShapeKind): boolean {
+ return shape === 'line' || shape === 'arrow';
+}
+
+export function resolveShapeFillColor(
+ settings: ShapeSettings,
+ primaryColor: string,
+ secondaryColor: string
+): string {
+ if (settings.fillColorMode === 'primary') return primaryColor;
+ if (settings.fillColorMode === 'secondary') return secondaryColor;
+ return settings.customFillColor || secondaryColor;
+}
+
+export function computeShapeGeometry(
+ start: { x: number; y: number },
+ end: { x: number; y: number },
+ settings: ShapeSettings,
+ shiftKey: boolean,
+ altKey: boolean
+): ComputedShapeGeometry {
+ const constrain = shiftKey || settings.constrainAspect;
+ const centered = altKey || settings.fromCenter;
+
+ let dx = end.x - start.x;
+ let dy = end.y - start.y;
+
+ if (isOpenShape(settings.shape)) {
+ if (constrain) {
+ const len = Math.hypot(dx, dy);
+ if (len > 0) {
+ const angle = Math.atan2(dy, dx);
+ const snapped = Math.round(angle / (Math.PI / 12)) * (Math.PI / 12);
+ dx = Math.cos(snapped) * len;
+ dy = Math.sin(snapped) * len;
+ }
+ }
+ const x1 = centered ? start.x - dx : start.x;
+ const y1 = centered ? start.y - dy : start.y;
+ const x2 = start.x + dx;
+ const y2 = start.y + dy;
+ const length = Math.hypot(x2 - x1, y2 - y1);
+ const angleDeg = ((Math.atan2(y2 - y1, x2 - x1) * 180) / Math.PI + 360) % 360;
+ return {
+ x1,
+ y1,
+ x2,
+ y2,
+ x: Math.min(x1, x2),
+ y: Math.min(y1, y2),
+ width: Math.abs(x2 - x1),
+ height: Math.abs(y2 - y1),
+ length,
+ angleDeg,
+ };
+ }
+
+ if (constrain) {
+ const side = Math.max(Math.abs(dx), Math.abs(dy));
+ dx = (dx < 0 ? -1 : 1) * side;
+ dy = (dy < 0 ? -1 : 1) * side;
+ }
+
+ const x1 = centered ? start.x - dx : start.x;
+ const y1 = centered ? start.y - dy : start.y;
+ const x2 = start.x + dx;
+ const y2 = start.y + dy;
+
+ const x = Math.min(x1, x2);
+ const y = Math.min(y1, y2);
+ const width = Math.abs(x2 - x1);
+ const height = Math.abs(y2 - y1);
+
+ return {
+ x1,
+ y1,
+ x2,
+ y2,
+ x,
+ y,
+ width,
+ height,
+ length: Math.hypot(width, height),
+ angleDeg: 0,
+ };
+}
+
+export function buildPolygonVertices(
+ x: number,
+ y: number,
+ width: number,
+ height: number,
+ sides: number
+): Array<{ x: number; y: number }> {
+ const n = Math.max(3, Math.min(12, Math.round(sides)));
+ const cx = x + width / 2;
+ const cy = y + height / 2;
+ const rx = width / 2;
+ const ry = height / 2;
+ const pts: Array<{ x: number; y: number }> = [];
+ for (let i = 0; i < n; i++) {
+ const angle = -Math.PI / 2 + (i * Math.PI * 2) / n;
+ pts.push({
+ x: cx + Math.cos(angle) * rx,
+ y: cy + Math.sin(angle) * ry,
+ });
+ }
+ return pts;
+}
+
+export function buildStarVertices(
+ x: number,
+ y: number,
+ width: number,
+ height: number,
+ points: number,
+ innerRatio: number
+): Array<{ x: number; y: number }> {
+ const n = Math.max(3, Math.min(12, Math.round(points)));
+ const ratio = Math.max(0.15, Math.min(0.85, innerRatio));
+ const cx = x + width / 2;
+ const cy = y + height / 2;
+ const rx = width / 2;
+ const ry = height / 2;
+ const pts: Array<{ x: number; y: number }> = [];
+ for (let i = 0; i < n * 2; i++) {
+ const isInner = i % 2 === 1;
+ const scale = isInner ? ratio : 1;
+ const angle = -Math.PI / 2 + (i * Math.PI) / n;
+ pts.push({
+ x: cx + Math.cos(angle) * rx * scale,
+ y: cy + Math.sin(angle) * ry * scale,
+ });
+ }
+ return pts;
+}
+
+export function buildArrowHeadPoints(
+ x1: number,
+ y1: number,
+ x2: number,
+ y2: number,
+ strokeWidth: number
+): { left: { x: number; y: number }; right: { x: number; y: number }; headLen: number } {
+ const len = Math.hypot(x2 - x1, y2 - y1);
+ const headLen = Math.min(len * 0.45, Math.max(12, strokeWidth * 3.5));
+ const angle = Math.atan2(y2 - y1, x2 - x1);
+ const spread = Math.PI / 6;
+ return {
+ headLen,
+ left: {
+ x: x2 - headLen * Math.cos(angle - spread),
+ y: y2 - headLen * Math.sin(angle - spread),
+ },
+ right: {
+ x: x2 - headLen * Math.cos(angle + spread),
+ y: y2 - headLen * Math.sin(angle + spread),
+ },
+ };
+}
+
+function traceShapePath(
+ ctx: CanvasRenderingContext2D,
+ geom: ComputedShapeGeometry,
+ settings: ShapeSettings
+): void {
+ const { x, y, width, height, x1, y1, x2, y2 } = geom;
+
+ ctx.beginPath();
+ switch (settings.shape) {
+ case 'line': {
+ ctx.moveTo(x1, y1);
+ ctx.lineTo(x2, y2);
+ break;
+ }
+ case 'arrow': {
+ ctx.moveTo(x1, y1);
+ ctx.lineTo(x2, y2);
+ break;
+ }
+ case 'rectangle': {
+ ctx.rect(x, y, width, height);
+ break;
+ }
+ case 'rounded-rect': {
+ const r = Math.min(Math.max(0, settings.cornerRadius), width / 2, height / 2);
+ ctx.moveTo(x + r, y);
+ ctx.lineTo(x + width - r, y);
+ ctx.quadraticCurveTo(x + width, y, x + width, y + r);
+ ctx.lineTo(x + width, y + height - r);
+ ctx.quadraticCurveTo(x + width, y + height, x + width - r, y + height);
+ ctx.lineTo(x + r, y + height);
+ ctx.quadraticCurveTo(x, y + height, x, y + height - r);
+ ctx.lineTo(x, y + r);
+ ctx.quadraticCurveTo(x, y, x + r, y);
+ ctx.closePath();
+ break;
+ }
+ case 'ellipse': {
+ ctx.ellipse(x + width / 2, y + height / 2, width / 2, height / 2, 0, 0, Math.PI * 2);
+ ctx.closePath();
+ break;
+ }
+ case 'triangle': {
+ ctx.moveTo(x + width / 2, y);
+ ctx.lineTo(x + width, y + height);
+ ctx.lineTo(x, y + height);
+ ctx.closePath();
+ break;
+ }
+ case 'polygon': {
+ const pts = buildPolygonVertices(x, y, width, height, settings.polygonSides);
+ if (pts.length > 0) {
+ ctx.moveTo(pts[0].x, pts[0].y);
+ for (let i = 1; i < pts.length; i++) ctx.lineTo(pts[i].x, pts[i].y);
+ ctx.closePath();
+ }
+ break;
+ }
+ case 'star': {
+ const pts = buildStarVertices(
+ x,
+ y,
+ width,
+ height,
+ settings.polygonSides,
+ settings.starInnerRatio
+ );
+ if (pts.length > 0) {
+ ctx.moveTo(pts[0].x, pts[0].y);
+ for (let i = 1; i < pts.length; i++) ctx.lineTo(pts[i].x, pts[i].y);
+ ctx.closePath();
+ }
+ break;
+ }
+ }
+}
+
+export function buildShapeSvgPaths(preview: ShapeDragPreview): {
+ geom: ComputedShapeGeometry;
+ mainPath: string;
+ arrowHeadPath?: string;
+} {
+ const geom = computeShapeGeometry(
+ preview.start,
+ preview.end,
+ preview.settings,
+ preview.shiftKey,
+ preview.altKey
+ );
+ const { x, y, width, height, x1, y1, x2, y2 } = geom;
+ const s = preview.settings;
+
+ switch (s.shape) {
+ case 'line':
+ return { geom, mainPath: `M ${x1} ${y1} L ${x2} ${y2}` };
+ case 'arrow': {
+ const head = buildArrowHeadPoints(x1, y1, x2, y2, s.strokeWidth);
+ return {
+ geom,
+ mainPath: `M ${x1} ${y1} L ${x2} ${y2}`,
+ arrowHeadPath: `M ${head.left.x} ${head.left.y} L ${x2} ${y2} L ${head.right.x} ${head.right.y}`,
+ };
+ }
+ case 'rectangle':
+ return {
+ geom,
+ mainPath: `M ${x} ${y} H ${x + width} V ${y + height} H ${x} Z`,
+ };
+ case 'rounded-rect': {
+ const r = Math.min(Math.max(0, s.cornerRadius), width / 2, height / 2);
+ return {
+ geom,
+ mainPath:
+ `M ${x + r} ${y} H ${x + width - r} Q ${x + width} ${y} ${x + width} ${y + r} ` +
+ `V ${y + height - r} Q ${x + width} ${y + height} ${x + width - r} ${y + height} ` +
+ `H ${x + r} Q ${x} ${y + height} ${x} ${y + height - r} ` +
+ `V ${y + r} Q ${x} ${y} ${x + r} ${y} Z`,
+ };
+ }
+ case 'ellipse': {
+ const rx = width / 2;
+ const ry = height / 2;
+ const cx = x + rx;
+ const cy = y + ry;
+ if (rx <= 0 || ry <= 0) return { geom, mainPath: '' };
+ return {
+ geom,
+ mainPath: `M ${cx - rx} ${cy} A ${rx} ${ry} 0 1 0 ${cx + rx} ${cy} A ${rx} ${ry} 0 1 0 ${cx - rx} ${cy} Z`,
+ };
+ }
+ case 'triangle':
+ return {
+ geom,
+ mainPath: `M ${x + width / 2} ${y} L ${x + width} ${y + height} L ${x} ${y + height} Z`,
+ };
+ case 'polygon': {
+ const pts = buildPolygonVertices(x, y, width, height, s.polygonSides);
+ return {
+ geom,
+ mainPath:
+ pts.map((p, idx) => `${idx === 0 ? 'M' : 'L'} ${p.x} ${p.y}`).join(' ') + ' Z',
+ };
+ }
+ case 'star': {
+ const pts = buildStarVertices(x, y, width, height, s.polygonSides, s.starInnerRatio);
+ return {
+ geom,
+ mainPath:
+ pts.map((p, idx) => `${idx === 0 ? 'M' : 'L'} ${p.x} ${p.y}`).join(' ') + ' Z',
+ };
+ }
+ }
+}
+
+export function drawShapeToContext(
+ ctx: CanvasRenderingContext2D,
+ preview: ShapeDragPreview,
+ strokeColor: string,
+ fillColor: string
+): ComputedShapeGeometry {
+ const geom = computeShapeGeometry(
+ preview.start,
+ preview.end,
+ preview.settings,
+ preview.shiftKey,
+ preview.altKey
+ );
+ const s = preview.settings;
+ const open = isOpenShape(s.shape);
+ const shouldFill = !open && (s.mode === 'fill' || s.mode === 'both');
+ const shouldStroke = open || s.mode === 'stroke' || s.mode === 'both';
+
+ ctx.save();
+ ctx.globalAlpha = Math.max(0.01, Math.min(1, s.opacity));
+ ctx.lineWidth = Math.max(1, s.strokeWidth);
+ ctx.lineCap = s.lineCap;
+ ctx.lineJoin = s.lineJoin;
+ ctx.strokeStyle = strokeColor;
+ ctx.fillStyle = fillColor;
+
+ if (s.dashed) {
+ ctx.setLineDash([Math.max(1, s.dashLength), Math.max(1, s.dashGap)]);
+ } else {
+ ctx.setLineDash([]);
+ }
+
+ traceShapePath(ctx, geom, s);
+ if (shouldFill) {
+ ctx.fill();
+ }
+ if (shouldStroke) {
+ ctx.stroke();
+ }
+
+ if (s.shape === 'arrow' && geom.length > 1) {
+ const head = buildArrowHeadPoints(geom.x1, geom.y1, geom.x2, geom.y2, s.strokeWidth);
+ ctx.setLineDash([]);
+ ctx.beginPath();
+ ctx.moveTo(head.left.x, head.left.y);
+ ctx.lineTo(geom.x2, geom.y2);
+ ctx.lineTo(head.right.x, head.right.y);
+ ctx.stroke();
+ }
+
+ ctx.restore();
+ return geom;
+}
+
+/**
+ * Rasterizes a geometric shape onto targetCanvas (and optional sourceCanvas for screentone layers),
+ * respecting selection mask and monochrome/binary anti-aliasing settings.
+ */
+export function rasterizeShapeToCanvas(
+ targetCanvas: HTMLCanvasElement,
+ preview: ShapeDragPreview,
+ strokeColor: string,
+ fillColor: string,
+ selection: CanvasSelection | null,
+ colorMode: CanvasColorMode,
+ isMonoLayer: boolean,
+ sourceCanvas?: HTMLCanvasElement | null
+): DirtyRect | null {
+ const geom = computeShapeGeometry(
+ preview.start,
+ preview.end,
+ preview.settings,
+ preview.shiftKey,
+ preview.altKey
+ );
+ if (geom.length < 1 && geom.width < 1 && geom.height < 1) {
+ return null;
+ }
+
+ const cw = targetCanvas.width;
+ const ch = targetCanvas.height;
+ const pad = Math.ceil(
+ Math.max(preview.settings.strokeWidth * 4, preview.settings.shape === 'arrow' ? 40 : 12)
+ );
+ const rx = Math.max(0, Math.floor(geom.x - pad));
+ const ry = Math.max(0, Math.floor(geom.y - pad));
+ const maxX = Math.min(cw, Math.ceil(geom.x + geom.width + pad));
+ const maxY = Math.min(ch, Math.ceil(geom.y + geom.height + pad));
+ const rw = maxX - rx;
+ const rh = maxY - ry;
+ if (rw <= 0 || rh <= 0) return null;
+
+ const off = document.createElement('canvas');
+ off.width = rw;
+ off.height = rh;
+ const offCtx = off.getContext('2d', { willReadFrequently: true });
+ if (!offCtx) return null;
+
+ offCtx.save();
+ offCtx.translate(-rx, -ry);
+ drawShapeToContext(offCtx, preview, strokeColor, fillColor);
+ offCtx.restore();
+
+ const binaryEdges = !preview.settings.antiAlias || colorMode === 'monochrome' || isMonoLayer;
+ const selMask = selection ? createSelectionMask(selection, cw, ch) : null;
+
+ if (binaryEdges || selMask) {
+ const img = offCtx.getImageData(0, 0, rw, rh);
+ const d = img.data;
+ for (let y = 0; y < rh; y++) {
+ const gy = ry + y;
+ for (let x = 0; x < rw; x++) {
+ const idx = (y * rw + x) * 4;
+ if (selMask) {
+ const gx = rx + x;
+ const m = selMask[gy * cw + gx];
+ if (m === 0) {
+ d[idx + 3] = 0;
+ continue;
+ } else if (m < 255) {
+ d[idx + 3] = Math.round((d[idx + 3] * m) / 255);
+ }
+ }
+ if (binaryEdges) {
+ d[idx + 3] = d[idx + 3] >= 128 ? 255 : 0;
+ }
+ }
+ }
+ offCtx.putImageData(img, 0, 0);
+ }
+
+ const dest = sourceCanvas ?? targetCanvas;
+ const destCtx = dest.getContext('2d');
+ if (!destCtx) return null;
+ destCtx.drawImage(off, rx, ry);
+
+ return { x: rx, y: ry, width: rw, height: rh };
+}
diff --git a/src/utils/shortcutManager.ts b/src/utils/shortcutManager.ts
index 5e1228a..bf6a779 100644
--- a/src/utils/shortcutManager.ts
+++ b/src/utils/shortcutManager.ts
@@ -130,6 +130,15 @@ export const DEFAULT_COMMANDS: readonly CommandDefinition[] = [
toolId: 'fill',
springLoaded: true,
},
+ {
+ id: 'tool.shape',
+ label: 'Geometric Shapes',
+ description: 'Draw lines, rectangles, ellipses, triangles, polygons, stars, and arrows',
+ category: 'Tools',
+ defaultShortcut: 'U',
+ toolId: 'shape',
+ springLoaded: true,
+ },
{
id: 'tool.text',
label: 'Text Tool',