Adding some emulated canvas support.
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 20/100
- Issue 类型
- 功能
- 描述清晰度
- 需要澄清
- 活跃度
- 停滞
- 技术栈
- typescript
- 领域
- web-dev
调研方向
从 linkedom 的 document.createElement 入口点开始,检查 issue 的 EmulatedCanvas2D 示例如何提供 canvas 元素和上下文。确定集成范围和兼容性要求,然后验证 Observable Plot Mandelbrot notebook 能够创建 canvas 并成功渲染。
由索引模型根据 Issue 内容生成。
描述
Hi,
After viewing the Deno 2.0 anoncement video, I tryed to use observablehq's samples in deno Jupyter Notebooks.
some samplkes use canvas, and so do crash.
by implementing some ugly code I can make canvas's dependent code to works, so it's posible to use an EmulatedCanvas2D to make canvas works in linkdom.
the question is: Can a canvas like can be integrated to the project ?
for reference there is a deno Notebooks of plot-mandelbrot-set:
import * as Plot from "npm:@observablehq/plot";
import { document } from "jsr:@ry/jupyter-helper";
import { createCanvas, type EmulatedCanvas2D } from "https://deno.land/x/[email protected]/mod.ts";
function mandelbrot(x: number, y: number) {
for (let n = 0, zr = 0, zi = 0; n < 80; ++n) {
[zr, zi] = [zr * zr - zi * zi + x, 2 * zr * zi + y];
if (zr * zr + zi * zi > 4) return n;
}
}
const old = document.createElement;
document.createElement = (...args: any[]) => {
if (args.length === 1 && args[0] === "canvas") {
let realCanvas: EmulatedCanvas2D | undefined;
const canvas = {
height: 200,
width: 200,
getContext: (drv: string) => {
realCanvas = createCanvas(canvas.width, canvas.height);
return realCanvas.getContext(drv);
},
toDataURL: () => {
return realCanvas?.toDataURL();
}
}
return canvas;
}
return old.apply(document, args);
}
Plot.raster({fill: mandelbrot, x1: -2, x2: 1, y1: -1.164, y2: 1.164}).plot({aspectRatio: 1, document})
- 主要语言
- HTML
- 星标
- 2.1k
- 派生
- 108
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
WebReflection/linkedom 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 68/100
WebReflection/linkedom#329 · 5 条评论 ·
-
难度 3/5 1-2 天 新手友好度 52/100
WebReflection/linkedom#327 · 1 条评论 ·
-
难度 3/5 1-2 天 新手友好度 48/100
WebReflection/linkedom#326 · 5 条评论 ·
-
难度 5/5 一周以上 新手友好度 15/100
WebReflection/linkedom#321 · 1 条评论 ·
-
难度 5/5 一周以上 新手友好度 25/100
WebReflection/linkedom#318 · 6 条评论 ·
查看 WebReflection/linkedom 的全部 Issue
相似的 Issue
-
accepted bug small
难度 2/5 1-3 小时 新手友好度 72/100
refined-github/refined-github#10133 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
lichess-org/lila#21826 ·
维护者通常 1 天内回复
-
dfm.ru未关闭N: AdGuard for Mac P4: Low T: Social Widget
难度 2/5 1-3 小时 新手友好度 65/100
AdguardTeam/AdguardFilters#242670 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复