Skip to content

Draw cell triangle mark: ctx.fillStyle caused bug ?  #990

@sunnipaul

Description

@sunnipaul

I am implementing a "comment cell" function, when there is a comment text for a cell there will be a solid orange triangle at the top right corner of the cell. When clicking the cell, the comment text will be displayed.
I implemented it in drawCell function in core package. I think it's the right place for it. (I've ever tried implement in a GridCellKind.Custom way, however it's hard for NumberCell, TextCell etc. )

How ever it seems after it causes the text displayed in yellow in cells in the same column below the row.

Can anyone help me work it out?

image
    const r = getCellRenderer(cell);
    if (r !== undefined) {
        if (lastPrep?.renderer !== r) {
            lastPrep?.deprep?.(args);
            lastPrep = undefined;
        }
        const partialPrepResult = r.drawPrep?.(args, lastPrep);
        if (drawCellCallback !== undefined && !isInnerOnlyCell(args.cell)) {
            drawCellCallback(args as DrawArgs<GridCell>, () => r.draw(args, cell));
        } else {
            r.draw(args, cell);
        }
        if (cell.memoMark === true){   // here is where I draw triangle in the cell.
            setTimeout(()=>{
                ctx.save();
                ctx.fillStyle = 'orange';
                ctx.beginPath();
                ctx.moveTo(x + w - 8, y);
                ctx.lineTo(x + w, y);
                ctx.lineTo(x + w, y + 8);
                ctx.lineTo(x + w - 8, y);
                ctx.fill();
                ctx.restore();
                console.log(`memoMark`);
            }, 0);
        }
        result =
### Tasks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions