forked from HEL/chronos
		
	added auto fit wrapper function
This commit is contained in:
		| @@ -40,4 +40,24 @@ | ||||
|   } | ||||
|  | ||||
|   panic("Invalid type for parameter mods, expected auto or dictionary, got " + str(type(mods))) | ||||
| } | ||||
| } | ||||
|  | ||||
| #let fit-canvas(canvas, width: auto) = layout(size => { | ||||
|   let m = measure(canvas) | ||||
|   let w = m.width | ||||
|   let h = m.height | ||||
|   let r = if w == 0pt {0} else { | ||||
|     if width == auto {1} else { | ||||
|       size.width * width / w | ||||
|     } | ||||
|   } | ||||
|   let new-w = w * r | ||||
|   let new-h = h * r | ||||
|   r *= 100% | ||||
|    | ||||
|   box( | ||||
|     width: new-w, | ||||
|     height: new-h, | ||||
|     scale(x: r, y: r, reflow: true, canvas) | ||||
|   ) | ||||
| }) | ||||
		Reference in New Issue
	
	Block a user