|
|
|
|
@ -455,17 +455,12 @@ const Image2DEditor: m.Component<{ si: number; ei: number; el: MonoDisplay.MonoF |
|
|
|
|
drawing: false, |
|
|
|
|
drawValue: 1, |
|
|
|
|
|
|
|
|
|
oncreate({ dom }) { |
|
|
|
|
const canvas = dom as HTMLCanvasElement; |
|
|
|
|
const el = (canvas as any)._el as MonoDisplay.MonoFormatImage2D; |
|
|
|
|
drawImage2DCanvas(canvas, el.image); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
onupdate({ dom, attrs }) { |
|
|
|
|
drawImage2DCanvas(dom as HTMLCanvasElement, attrs.el.image); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
view({ attrs: { si, ei, el }, state }) { |
|
|
|
|
if (!el.image) { |
|
|
|
|
const w = (el as any).width || W; |
|
|
|
|
const h = (el as any).height || H; |
|
|
|
|
el.image = { pixels: new Uint8Array(w * h), width: w, height: h }; |
|
|
|
|
} |
|
|
|
|
const img = el.image; |
|
|
|
|
|
|
|
|
|
function pixelFromEvent(e: MouseEvent): { x: number; y: number } | null { |
|
|
|
|
|