Skip to content

Commit 881efc5

Browse files
authored
Image fixes (#191)
* contain vs. clip image * hide image until loading is fully complete
1 parent d41ecd1 commit 881efc5

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

Diff for: docs/Examples2/Image.example.purs

+5-5
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,19 @@ docs =
1818
, example
1919
$ Image.image
2020
$$$ "http://via.placeholder.com/640x360"
21-
, h4_ "Image + resize { width: 120px, height: 40px }, respects image's aspect ratio & clips overflow"
21+
, h4_ "Image + resize { width: 120px, height: 40px }, scales image to respect it's aspect ratio"
2222
, example
2323
$ Image.image
2424
$ Image.resize { width: 120, height: 40 }
25-
$$$ "http://via.placeholder.com/640x360"
25+
$$$ "http://via.placeholder.com/360x640"
2626
, h4_ "Thumbnail default (will always have a square aspect ratio)"
2727
, example
2828
$ Image.thumbnail
29-
$$$ "http://via.placeholder.com/640x360"
30-
, h4_ "Thumbnail + resize 48px"
29+
$$$ "http://via.placeholder.com/360x640"
30+
, h4_ "Thumbnail + resize 400px"
3131
, example
3232
$ Image.thumbnail
33-
$ Image.resizeSquare 80
33+
$ Image.resizeSquare 400
3434
$$$ flexo
3535
, h4_ "Thumbnail + small"
3636
, example

Diff for: src/Lumi/Components2/Image.purs

+6-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,12 @@ image =
102102
, E.element R.img'
103103
{ src: props.content
104104
, className: ""
105-
, css: E.css { maxWidth: E.percent 100.0 }
105+
, css: E.css
106+
{ maxWidth: E.percent 100.0
107+
, maxHeight: E.percent 100.0
108+
, objectFit: E.str "contain"
109+
, display: E.str $ if loaded then "block" else "none"
110+
}
106111
, onLoad: handler_ $ setLoaded true
107112
, onError: handler_ $ setLoaded true
108113
}

0 commit comments

Comments
 (0)