Skip to content

Commit dbee1ea

Browse files
committed
-
1 parent e4425ce commit dbee1ea

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

src/web/manifest.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@
1313
}],
1414
"background_color": "#464d2e",
1515
"theme_color": "#5f8fd9",
16-
"display": "fullscreen"}
16+
"display": "fullscreen",
17+
"orientation": "natural"}

src/web/viewer.ml

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -412,9 +412,10 @@ let draw terrain_pid terrain_geo tile_texture gradient_texture triangle_pid
412412
*. cos (orientation.beta *. pi /. 180.))
413413
(sin (orientation.beta *. pi /. 180.))
414414
in
415-
let proj =
416-
Matrix.project ~x_scale:(scale /. aspect) ~y_scale:scale ~near_plane:0.1
415+
let x_scale, y_scale =
416+
if aspect < 1. then (scale /. aspect, scale) else (scale, scale *. aspect)
417417
in
418+
let proj = Matrix.project ~x_scale ~y_scale ~near_plane:0.1 in
418419
let points =
419420
List.filter_map
420421
(fun (pt, (x', y')) ->
@@ -505,14 +506,15 @@ let draw terrain_pid terrain_geo tile_texture gradient_texture triangle_pid
505506
Gl.blend_func ctx Gl.one Gl.one_minus_src_alpha;
506507
List.iter
507508
(fun (_, x, y, shown) ->
508-
let x = x *. scale /. aspect in
509-
let y = y *. scale in
509+
let x = x *. x_scale in
510+
let y = y *. y_scale in
510511
let angle = if shown then -.pi /. 4. else 0. in
511512
let transform =
513+
let sx = 0.6 *. text_height *. x_scale /. scale in
514+
let sy = 0.6 *. text_height *. y_scale /. scale in
512515
Matrix.(
513516
rotate_z (angle +. (screen_inclination *. pi /. 180.))
514-
* scale (0.6 *. text_height /. aspect) (0.6 *. text_height) 1.
515-
* translate x y 0.)
517+
* scale sx sy 1. * translate x y 0.)
516518
in
517519
Gl.uniform_matrix4fv ctx transform_loc false
518520
(Brr.Tarray.of_bigarray1 (Matrix.array transform));
@@ -533,14 +535,15 @@ let draw terrain_pid terrain_geo tile_texture gradient_texture triangle_pid
533535
List.iter
534536
(fun (texture, x, y, shown) ->
535537
if shown then
536-
let x = x *. scale /. aspect in
537-
let y = y *. scale in
538+
let x = x *. x_scale in
539+
let y = y *. y_scale in
538540
let transform =
541+
let sx = text_height *. x_scale /. scale in
542+
let sy = text_height *. y_scale /. scale in
539543
Matrix.(
540544
translate 0.7 (-0.5) 0.
541545
* rotate_z ((pi /. 4.) +. (screen_inclination *. pi /. 180.))
542-
* scale (text_height /. aspect) text_height 1.
543-
* translate x y 0.)
546+
* scale sx sy 1. * translate x y 0.)
544547
in
545548
draw_text ctx transform_loc transform texture)
546549
points;

0 commit comments

Comments
 (0)