| 1 | module gg |
| 2 | |
| 3 | pub enum HorizontalAlign { |
| 4 | left |
| 5 | center |
| 6 | right |
| 7 | } |
| 8 | |
| 9 | pub enum VerticalAlign { |
| 10 | top |
| 11 | middle |
| 12 | bottom |
| 13 | baseline |
| 14 | } |
| 15 | |
| 16 | pub fn (mut ctx Context) draw_text(x int, y int, text_ string, cfg TextCfg) { |
| 17 | ctx.context.fillStyle = cfg.color.to_css_string().str |
| 18 | ctx.context.font = cfg.to_css_string().str |
| 19 | ctx.context.fillText(text_.str, JS.Number(x), JS.Number(y)) |
| 20 | } |
| 21 |