From 3aff15e71c5f6b3ecf10e41effefa6fab11f6138 Mon Sep 17 00:00:00 2001 From: Pascal Date: Thu, 19 Dec 2024 13:58:54 +0300 Subject: [PATCH] Adjust comment styling for extended cells to ensure consistent appearance Signed-off-by: banobepascal Change-Id: Ia3b6ac17ad1f4677e61d9128806bac90a819bfb3 --- browser/src/canvas/sections/CommentSection.ts | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/browser/src/canvas/sections/CommentSection.ts b/browser/src/canvas/sections/CommentSection.ts index 46ca59d8e0f5..4f68a084d5ba 100644 --- a/browser/src/canvas/sections/CommentSection.ts +++ b/browser/src/canvas/sections/CommentSection.ts @@ -1338,15 +1338,17 @@ export class Comment extends CanvasSectionObject { // For calc comments (aka postits) draw the same sort of square as ScOutputData::DrawNoteMarks // does for offline var margin = cellSize[0] * 0.06; - var squareDim = 6; - // this.size may currently have an artifically wide size if mouseEnter without moveLeave seen - // so fetch the real size - var x = this.isCalcRTL() ? margin : cellSize[0] - (margin + squareDim); + var verticalMargin = cellSize[1] * 0.06; // Vertical margin (to move it below the top border) + var triangleLength = cellSize[0] * 0.15; // Consistent ratio for triangle size + + var x = this.isCalcRTL() ? margin : cellSize[0] - margin - triangleLength; // Adjusted for right-to-left or left-to-right layouts + var y = verticalMargin; // Starting y position for the triangle (offset below top border) + this.context.fillStyle = '#BF819E'; var region = new Path2D(); - region.moveTo(x, 0); - region.lineTo(cellSize[0], 0); - region.lineTo(cellSize[0], cellSize[1]/2); + region.moveTo(x, y); + region.lineTo(x + triangleLength, y); + region.lineTo(x + triangleLength, y + triangleLength); region.closePath(); this.context.fill(region); }