Draw canvas image preview in a widget (#2952)

This commit is contained in:
Chenlei Hu
2025-03-09 21:56:50 -04:00
committed by GitHub
parent 60022134ed
commit ec013cc511
9 changed files with 355 additions and 264 deletions

View File

@@ -2,7 +2,17 @@
import { app } from '../app'
import { $el } from '../ui'
export function calculateImageGrid(imgs, dw, dh) {
export function calculateImageGrid(
imgs,
dw,
dh
): {
cellWidth: number
cellHeight: number
cols: number
rows: number
shiftX: number
} {
let best = 0
let w = imgs[0].naturalWidth
let h = imgs[0].naturalHeight