Skip to content

Commit afee909

Browse files
authored
Merge pull request #177 from kwnt-dev/fix/#176_pdf-depth-label-overflow
fix: PDFプレビュー画面の表示改善
2 parents 696851f + 15ae058 commit afee909

2 files changed

Lines changed: 35 additions & 17 deletions

File tree

app/admin/pdf-preview/page.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,7 @@ function PDFPreviewContent() {
242242

243243
link.click();
244244
URL.revokeObjectURL(downloadUrl);
245+
toast.success("PDFダウンロードを開始しました");
245246
};
246247

247248
/**
@@ -268,9 +269,14 @@ function PDFPreviewContent() {
268269
};
269270

270271
return (
271-
<div className="p-8">
272-
<div className="mb-6 flex gap-4">
273-
<button onClick={handleDownloadPDF}>PDFダウンロード</button>
272+
<div className="p-8 flex flex-col items-center">
273+
<div className="flex justify-end gap-4 mb-4 w-full">
274+
<button
275+
onClick={handleDownloadPDF}
276+
className="px-4 py-2 bg-gray-700 text-white rounded hover:bg-gray-800"
277+
>
278+
PDFダウンロード
279+
</button>
274280
{/* ダッシュボードから?send=trueで遷移してきた場合のみ送信ボタンを表示 */}
275281
{isSendMode && sessionIds && (
276282
<button

components/greens/GreenCardPDFExport.tsx

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -194,20 +194,32 @@ export default function GreenCardPDFExport({
194194
/>
195195

196196
{/* 奥行き数字 */}
197-
{currentPin && (
198-
<Text
199-
text={`${Math.round(holeData.origin.y - currentPin.y)}`}
200-
fontSize={450}
201-
x={currentPin.x <= 30 ? ydToPx(45) : ydToPx(15)}
202-
y={ydToPx(currentPin.y)}
203-
offsetY={100}
204-
align="center"
205-
width={600}
206-
offsetX={300}
207-
fontStyle="bold"
208-
fill="#000000"
209-
/>
210-
)}
197+
{currentPin &&
198+
(() => {
199+
const depthFontSize = 450;
200+
const baseY = ydToPx(currentPin.y);
201+
// はみ出る分だけ上にずらしてキャンバス内に収める
202+
const bottomEdge = baseY - 100 + depthFontSize;
203+
const textY =
204+
bottomEdge > CANVAS_SIZE
205+
? baseY - (bottomEdge - CANVAS_SIZE)
206+
: baseY;
207+
208+
return (
209+
<Text
210+
text={`${Math.round(holeData.origin.y - currentPin.y)}`}
211+
fontSize={depthFontSize}
212+
x={currentPin.x <= 30 ? ydToPx(45) : ydToPx(15)}
213+
y={textY}
214+
offsetY={100}
215+
align="center"
216+
width={600}
217+
offsetX={300}
218+
fontStyle="bold"
219+
fill="#000000"
220+
/>
221+
);
222+
})()}
211223

212224
{/* 中心線上の表示「C」 */}
213225
{currentPin && currentPin.x === 30 && (

0 commit comments

Comments
 (0)