Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
sunnipaul opened this issue Aug 12, 2024 · 0 comments
Open

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

sunnipaul opened this issue Aug 12, 2024 · 0 comments

Comments

@sunnipaul
Copy link

sunnipaul commented Aug 12, 2024

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

No tasks being tracked yet.
@sunnipaul sunnipaul changed the title ctx.fillStyle caused bug ? Draw cell triangle mark: ctx.fillStyle caused bug ? Aug 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant