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

fix(engine-render): check box render #3776

Merged
merged 2 commits into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@ export class FontAndBaseLine extends docExtension {
return;
}

// const { asc = 0, marginTop: lineMarginTop = 0, paddingTop: linePaddingTop = 0 } = line;

// const maxLineAsc = asc + lineMarginTop + linePaddingTop;

const { ts: textStyle, content, fontStyle, bBox } = glyph;

const { spanPointWithFont = Vector2.create(0, 0) } = this.extensionOffset;
Expand Down Expand Up @@ -78,7 +74,6 @@ export class FontAndBaseLine extends docExtension {
spanPointWithFont.y += bBox.sbo;
}

// console.log(content, spanPointWithFont.x, spanPointWithFont.y, startX, startY);
this._fillText(ctx, glyph, spanPointWithFont);
}

Expand Down Expand Up @@ -110,14 +105,12 @@ export class FontAndBaseLine extends docExtension {
if ((content === UNCHECKED_GLYPH || content === CHECKED_GLYPH) && glyph.glyphType === GlyphType.LIST) {
const size = Math.ceil((glyph.ts?.fs ?? 12) * 1.2);
ctx.save();
const fontWidth = glyph.bBox.width;
const fontHeight = glyph.bBox.aba - glyph.bBox.abd;
const bottom = spanPointWithFont.y;
const top = bottom - fontHeight;
const left = spanPointWithFont.x;
const right = left + fontWidth;
const topOffset = top + (bottom - top - size) / 2;
const leftOffset = left + (right - left - size) / 2;
const leftOffset = left;
const BORDER_WIDTH = 1;
ctx.translate(leftOffset - BORDER_WIDTH / 2, topOffset - BORDER_WIDTH / 2);
Checkbox.drawWith(ctx, {
Expand Down