Skip to content

Commit

Permalink
Adjust comment styling for extended cells to ensure consistent appear…
Browse files Browse the repository at this point in the history
…ance

Signed-off-by: banobepascal <banobe.pascal@collabora.com>
Change-Id: Ia3b6ac17ad1f4677e61d9128806bac90a819bfb3
  • Loading branch information
Pascal committed Dec 19, 2024
1 parent cb100b9 commit 3aff15e
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions browser/src/canvas/sections/CommentSection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 3aff15e

Please sign in to comment.