Skip to content

Commit 812ed15

Browse files
committed
fix: PDF出力の奥行き数字が下端で見切れる問題を修正
1 parent 696851f commit 812ed15

1 file changed

Lines changed: 26 additions & 14 deletions

File tree

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)