1 | import { findDOM } from '../../utils/index.js';
|
2 | import { CanvasContext } from './CanvasContext.js';
|
3 |
|
4 |
|
5 |
|
6 |
|
7 | const createCanvasContext = (canvasId, inst) => {
|
8 | const el = findDOM(inst);
|
9 | const canvas = el === null || el === void 0 ? void 0 : el.querySelector(`canvas[canvas-id="${canvasId}"]`);
|
10 | const ctx = canvas === null || canvas === void 0 ? void 0 : canvas.getContext('2d');
|
11 | const context = new CanvasContext(canvas, ctx);
|
12 | if (!ctx)
|
13 | return context;
|
14 | context.canvas = canvas;
|
15 | context.ctx = ctx;
|
16 | return context;
|
17 | };
|
18 |
|
19 | export { createCanvasContext };
|
20 |
|