Compare commits

...

4 Commits

Author SHA1 Message Date
ry.yamafuji
7cef531565 バージョンを追加 2025-06-10 03:00:20 +09:00
ry.yamafuji
5e4d7943ec 2度保存できない問題を解消 2025-06-10 02:59:26 +09:00
ry.yamafuji
4a7160e97e release2 2025-06-10 02:49:20 +09:00
ry.yamafuji
9d0be6411a release 2025-06-07 23:08:43 +09:00
6 changed files with 21 additions and 7 deletions

View File

@ -2,6 +2,8 @@
VSCodeで画像に赤丸マークや注釈を直感的に描き込める拡張機能です。
![logo](readme/images/logo.png)
---
## 主な特徴

View File

@ -2,6 +2,8 @@
# ImageMarkPengent
![logo](readme/images/logo.png)
A VSCode extension for intuitively drawing red circle marks and annotations directly on images.
---

View File

@ -3,7 +3,9 @@
"displayName": "ImageMarkPengent",
"description": "",
"license": "MIT",
"version": "1.0.0-alpha",
"version": "1.0.2",
"publisher": "PengentAIRyohYA",
"icon": "readme/images/logo.png",
"engines": {
"vscode": "^1.99.0"
},

BIN
readme/images/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 KiB

View File

@ -89,6 +89,9 @@ export function getWebviewContent(imageSrc: string): string {
let markColor = colorPicker.value;
let markLineWidth = parseInt(lineWidthSelect.value, 10);
// VS Code API を一度だけ取得
const vscode = window.acquireVsCodeApi ? window.acquireVsCodeApi() : null;
// UIイベント
moveBtn.onclick = () => setMode('move');
selectBtn.onclick = () => setMode('select');
@ -118,6 +121,7 @@ export function getWebviewContent(imageSrc: string): string {
draw();
};
saveBtn.onclick = () => {
console.log('Save button onclick fired!');
// 元画像サイズのオフスクリーンcanvasで保存
const offCanvas = document.createElement('canvas');
offCanvas.width = img.width;
@ -130,9 +134,13 @@ export function getWebviewContent(imageSrc: string): string {
drawEllipseRaw(offCtx, mark.x1, mark.y1, mark.x2, mark.y2, mark.color, mark.lineWidth);
}
const dataUrl = offCanvas.toDataURL('image/png');
if (window.acquireVsCodeApi) {
const vscode = window.acquireVsCodeApi();
console.log('Data URL created, checking VSCode API...');
if (vscode) {
console.log('VSCode API available, sending message...');
vscode.postMessage({ type: 'save-image', dataUrl });
console.log('Message sent to extension');
} else {
console.log('VSCode API not available!');
}
};