添加 comment & canvas

This commit is contained in:
shenjack 2024-04-05 12:41:24 +08:00
parent b9d2d1f014
commit 432ea546b5
Signed by: shenjack
GPG Key ID: 7B1134A979775551
2 changed files with 112 additions and 43 deletions

File diff suppressed because one or more lines are too long

View File

@ -113,6 +113,19 @@ void main() {
// Find an element by class (a-class).
Element classElement = querySelector('.a-class')!;
Comment comment = Comment("comment");
// canvas
CanvasElement canvas = CanvasElement(width: 100, height: 100);
CanvasRenderingContext2D ctx = canvas.getContext('2d') as CanvasRenderingContext2D;
ctx.fillStyle = 'black';
ctx.fillRect(0, 0, 100, 100);
ctx.fillStyle = 'white';
drawText(ctx, 'Hello, World!', 0, 0, 100, true);
// Add a click event listener to the class element.
comment.addEventListener('click', (event) => null);
classElement.addEventListener('click', (event) {
print("click");
});