Skip to content

Commit d8fe1ae

Browse files
zichen0116zzcncubic-dev-ai[bot]
authored
feat: add pattern copy and paste
* feat: add pattern copy and paste * Update frontend/src/components/ContributionCalendar.tsx add Cmd+C Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com> * Update frontend/src/components/ContributionCalendar.tsx add Cmd+V Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com> * fix: paste overlay and preset character conflict bug * docs: update readme_zh paste instructions --------- Co-authored-by: zzcn <[email protected]> Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
1 parent 6d77c71 commit d8fe1ae

File tree

7 files changed

+401
-28
lines changed

7 files changed

+401
-28
lines changed

README_zh.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
- 绘画过程中右键可以切换画笔和橡皮擦
2121
- 可以调节画笔的强度
22+
- **复制粘贴功能**:点击"复制模式"按钮进入复制模式,在日历上拖选一块区域后按 `Ctrl+C` 复制,软件会弹出"复制成功"提示。复制后,被选中区域的图案会跟随鼠标移动作为预览,你可以左键点击或按 `Ctrl+V` 粘贴到目标位置,右键取消粘贴预览。按`Ctrl+V`可以快速恢复上次复制的图案
2223

2324
### Windows/Linux
2425

frontend/package-lock.json

Lines changed: 0 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/package.json.md5

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
153cd7df260dced80347a928f3d27668
1+
cf7eeb812cadce6dc9108a9563da0e8c

frontend/src/components/CalendarControls.tsx

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ type Props = {
2020
isGeneratingRepo?: boolean;
2121
onExportContributions?: () => void;
2222
onImportContributions?: () => void;
23+
// 复制模式
24+
copyMode?: boolean;
25+
onCopyModeToggle?: () => void;
2326
// 字符预览相关
2427
onStartCharacterPreview?: (char: string) => void;
2528
previewMode?: boolean;
@@ -43,6 +46,9 @@ export const CalendarControls: React.FC<Props> = ({
4346
isGeneratingRepo,
4447
onExportContributions,
4548
onImportContributions,
49+
// 复制模式
50+
copyMode = false,
51+
onCopyModeToggle,
4652
// 字符预览相关
4753
onStartCharacterPreview,
4854
previewMode,
@@ -338,7 +344,7 @@ export const CalendarControls: React.FC<Props> = ({
338344

339345
{/* Row 3: remaining actions */}
340346
<div className="flex w-full flex-col gap-2">
341-
<div className="grid grid-cols-1 gap-2 sm:grid-cols-3">
347+
<div className="grid grid-cols-1 gap-2 sm:grid-cols-4">
342348
<button
343349
type="button"
344350
onClick={onFillAllGreen}
@@ -355,6 +361,19 @@ export const CalendarControls: React.FC<Props> = ({
355361
>
356362
{t('buttons.reset')}
357363
</button>
364+
<button
365+
type="button"
366+
onClick={() => onCopyModeToggle?.()}
367+
className={clsx(
368+
'w-full rounded-none px-4 py-2 text-sm font-medium transition-colors duration-200',
369+
copyMode
370+
? 'bg-black text-white'
371+
: 'border border-black bg-white text-black hover:bg-gray-100'
372+
)}
373+
title={t('titles.copyMode') || 'Ctrl+C复制选定区域'}
374+
>
375+
{t('buttons.copyMode')}
376+
</button>
358377
<button
359378
type="button"
360379
onClick={handleOpenRemoteRepoModal}

frontend/src/components/ContributionCalendar.module.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,12 @@
154154
animation: pulse 1.5s infinite;
155155
}
156156

157+
// 选择状态样式 - 只加边框,保持原有颜色
158+
&.selection {
159+
outline: 2px solid #2563eb !important;
160+
outline-offset: 1px;
161+
}
162+
157163
@keyframes pulse {
158164
0% {
159165
opacity: 1;

0 commit comments

Comments
 (0)