correct? rendering

This commit is contained in:
cqc
2022-09-02 21:34:47 -05:00
parent 6a484c3a06
commit 399280d9c4
2 changed files with 8 additions and 11 deletions

6
dune
View File

@ -1,10 +1,6 @@
(env (env
(dev (flags (:standard -warn-error -A)) (dev (flags (:standard -warn-error -A))
(js_of_ocaml (flags --pretty --no-inline --source-map --debug-info) (compilation_mode separate))) (js_of_ocaml (flags) (compilation_mode separate))))
)
(executable (executable
(name boot_js) (name boot_js)

View File

@ -374,14 +374,12 @@ module Display = struct
let path_box vg color ?(width = 0.) b = let path_box vg color ?(width = 0.) b =
let module Path = NVG.Path in let module Path = NVG.Path in
NVG.save vg ;
Path.begin_ vg ; Path.begin_ vg ;
Path.rect vg ~x:(Box2.ox b) ~y:(Box2.oy b) ~w:(Box2.w b) Path.rect vg ~x:(Box2.ox b) ~y:(Box2.oy b) ~w:(Box2.w b)
~h:(Box2.h b) ; ~h:(Box2.h b) ;
if width != 0. then NVG.set_stroke_width vg ~width ; if width != 0. then NVG.set_stroke_width vg ~width ;
NVG.set_stroke_color vg ~color ; NVG.set_stroke_color vg ~color ;
NVG.stroke vg ; NVG.stroke vg ;
NVG.restore vg ;
Box2.max b Box2.max b
(* Display.state.box as supplied to a widget defines the allowed drawing area for the widget. (* Display.state.box as supplied to a widget defines the allowed drawing area for the widget.
@ -849,7 +847,8 @@ module Panel = struct
let x, y = (V2.x t, V2.y t +. metrics.ascender) in let x, y = (V2.x t, V2.y t +. metrics.ascender) in
F.epr "Panel.Ui.Draw.uchar x=%f y=%f \"%s\" @." x y text ; F.epr "Panel.Ui.Draw.uchar x=%f y=%f \"%s\" @." x y text ;
Text.text vg ~x ~y text ; Text.text vg ~x ~y text ;
P2.v bounds.advance P2.v
(P2.x t +. bounds.advance)
( P2.y t +. metrics.ascender +. metrics.descender ( P2.y t +. metrics.ascender +. metrics.descender
+. metrics.line_height ) +. metrics.line_height )
@ -905,9 +904,11 @@ module Panel = struct
| `Atom a -> atom t b a | `Atom a -> atom t b a
| `Attr a -> attr t b a | `Attr a -> attr t b a
| `Join a -> join t b a in | `Join a -> join t b a in
Display.path_box t.vg ignore
(Display.path_box t.vg
(Color.rgbaf ~r:1. ~g:0. ~b:0. ~a:0.2) (Color.rgbaf ~r:1. ~g:0. ~b:0. ~a:0.2)
(Box2.v b b2) (Box2.of_pts b b2) ) ;
b2
end end
module Action = struct module Action = struct